Skip to content

Send a queued reply as soon as the turn ends, even while background agents still run - #225

Draft
yobazy wants to merge 2 commits into
mainfrom
moment-2026-11-16t16-35-43-276z
Draft

yobazy wants to merge 2 commits into
mainfrom
moment-2026-11-16t16-35-43-276z

Conversation

@yobazy

@yobazy yobazy commented Nov 16, 2026

Copy link
Copy Markdown
Owner

From the marked moment 2026-11-16T16-35-43-276Z: "it doesnt handle queueing right when we have background agents running. we want all the claude terminal features captured".

What was wrong. A reply queued while a thread was mid-turn waited until every background agent was done ("Queued, sent when its agents finish"). In that moment the turn ended at 16:35:33 with a builder still working, so the reply would have waited out a 20+ minute build. Claude's terminal takes a message as soon as the turn ends. The queue runner only sent on finished and never read the log's turn ending. Replies from Decisions, the palette and menus didn't pass turnEndedAt either, so a thread held for its subagents always queued them.

Now

  • The queue runner reads the log's turn ending (thread_transcript, cheap because Rust reads on from where it was) and sends the next reply once the turn is over, even with subagents still out (holdNext(…, turnEndedAt)).
  • enqueue reads it too when the caller didn't pass it, so Decisions, palette and menu replies to a held thread go straight in.
  • A batch's next step is marked afterAgents and still waits for the agents. This keeps Keep talking to a thread from the Read view while its subagents work #148's caution where it applies.
  • The Read view's queued row says "Its turn is over, so it goes in a moment" for a reply, and "sent when its agents finish" only for an afterAgents step.
  • Fixture tests/fixtures/moments/2026-11-16T16-35-43-276Z.json checks the moment. The Keep talking to a thread from the Read view while its subagents work #148 fixture gains holdReply: null.
  • scripts/fake-agent.sh gains a background turn: it works for 15s, sends a builder off and logs its turn end.

Not checked live. The Mac sandbox's daemon is a stale one from the removed idle-cpu worktree (its fake agent and demo repos are gone), and auto mode blocked stopping it. The PC needs a Tailscale re-auth. Draft until it's been seen in the sandbox: background go in a thread, queue a reply during the 15s, and the reply should go in about 5s after "a builder is working in the background."

Checks: npm run build && npm test pass (636). No Rust changes.

🤖 Generated with Claude Code

yobazy and others added 2 commits November 16, 2026 11:39
…gents still run

Claude's terminal takes a message once its turn is over, with subagents
still out. The queue only sent on finished, so a reply queued mid-turn
sat until every background agent was done. The runner now reads the
log's turn ending and sends then; replies from Decisions, the palette
and menus read it too, so they go straight in. A batch's next step
still waits out the agents.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant