Skip to content

emrg: a round that dispatched one tool call is followed by a request ending in batch call #2683

Closed

Description

@argszero

What happens today

The requirement that a round may carry several tool calls lives only in the system prompt. It holds while it is the most recent thing said and decays within a round or two: the model goes back to dispatching one tool call per round. A requirement stated only in the prompt is too far from the decision point.

What is wanted

The daemon enforces it. When a round dispatches exactly one tool call, the next request carries one extra user message, {"role": "user", "content": "batch call"}, as its last entry. That message lives only in that request.

The mechanism belongs to _run_tool_loop (emrg/server/daemon.py), which serves both an interactive turn and a scheduled task.

Acceptance

# Requirement
1 A round whose tool-call count is exactly 1 → the next request's last message is {"role": "user", "content": "batch call"}
2 A round with 0 tool calls, or with 2 or more, → nothing is appended
3 Consecutive single-call rounds each append one — not only the first of the run
4 It exists only in that request: never written to session history, absent when the session is reopened, readable from no file the turn persists
5 A context rebuild (auto-compact) neither duplicates it nor leaves a residue
6 Host conversation and scheduled task alike — one code path, no per-session distinction, no switch that turns it off; it stays until something better replaces it

How this is checked

  • One test per requirement 1–4, plus 5. Each reads the messages the provider was actually handed (a stub LLM that captures the request), so the readings are about requests, not about the shape of the code that built them. Requirement 4 is read twice: the session's records on disk, and a rebuilt request for the same session.
  • Three mutation arms, each of which must redden the corresponding test: the count comparison inverted, the append moved before the tool results instead of after them, and the message written into session history.
  • CI green on ubuntu, windows-2025 and macOS.

Activity

  1. argszero commented on Nov 3, 2026

    @argszero
    OwnerAuthor

    Handled by #2684

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions