Repository navigation
fix(supervisor): a message that joins the running turn no longer leaves the bot busy - #71
Merged
Merged
Conversation
…es the bot busy The supervisor counted one turn per message written and closed one per `result`. Claude Code takes up a message written between two tool calls inside the turn already running and ends both with a single `result` (checked with 2.1.284), so the count stayed at one and the bot showed "working" forever after a real turn. The slot now keeps the uuids written and not yet replayed, plus whether a turn is open: a replay takes its uuid out and opens the turn, `init` opens it, `result` closes it. Replays with a uuid nobody wrote (the output `/compact` gives back) only open the turn. Routines had the same assumption: a message joining a run's turn dropped the run, which then never finished. A turn now keeps every run it took up. Spec 7.2, 8.1, 9.1, 19 and 20 updated with the probe results.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What happened
A crew's chief finished its turn but kept showing "working" (typing dots, spinner in the composer) forever. While it was between tool calls, another bot's message was delivered. Claude Code took that message up inside the running turn and closed both with a single
result. The supervisor counted one turn per message written and closed one perresult, so one turn was left over and the bot never went back toidle.Fix
system/initopens it,resultcloses it. Busy = something waiting, a turn open, a subagent, or an approval./compactalso gives back its output with a uuid nobody wrote (spec 8.6/19).write_messagenow takes the line's uuid (courier, compaction, test helper).result.Checked with the real Claude Code (2.1.284, Haiku, the daemon's flags)
system/init, oneresult(num_turns: 5).init, replay,result)./compactwith nothing to compact: replays the command with the uuid sent.Recorded in spec 19; spec 7.2, 8.1, 9.1 and 20 updated.
Tests
a_message_that_joins_the_running_turn_ends_with_it,a_message_that_joins_the_runs_turn_leaves_the_run_to_it.cargo fmt,clippy -D warnings,cargo test --workspace(3 runs) pass.Manual step (real Claude Code)
With the dev daemon, ask a bot to read several files one at a time. While it's reading, send it a second message from the chat. The bot should go back to idle (no dots, no spinner) after the single reply.