0
Fork 0
mirror of https://github.com/zeronsh/comet.git synced 2026-11-16 18:57:19 +00:00

engine: a steer during a running command is read at once, background work kept

A steer sent while the agent ran a blocking command (a `sleep`, a test
run, a wait) reached a step-boundary agent only once the command
returned: two minutes for a `sleep 120`. Now, while a tool call is open,
an explicit steer (the Steer command, and a queued row's Steer) stops the
turn in place first: the foreground call ends, the runtime and its
background work stay, and the steer starts the next turn in that same
runtime. Steers sent earlier that the stop cancels go again first, under
their own ids. With no tool call open, or while a question is waiting,
a steer is as it was.

The stop uses each agent's in-place interrupt (Claude's interrupt
control request, Codex's and Muse's `turn/interrupt`) and, unlike Send
now's stop, never falls back to tearing the runtime down: a stop that
doesn't settle leaves the steer to its step boundary. Agents opt in with
`Harness::steer_stops_tool`: Claude Code, Codex and Muse. Cursor keeps
today's steer (its stop cancels the SDK run, whose shell tree it may
take).

The engine counts each run's open tool calls. The mock gains
`ZERON_MOCK_LONG_TOOL` (real foreground and background `sleep`s, their
PIDs written out) for timing steers; `ZERON_MOCK_STEER_WAITS` times the
old behaviour against it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Wing 2026-11-06 10:51:59 -07:00
commit 76ca2e17bf
8 changed files with 849 additions and 5 deletions