Steer the running turn instead of queuing messages - #2
Merged
Conversation
Typed-while-busy input was held in a local queue and only handed to claude one-per-turn after the result event, so it could never influence work already in flight. But claude's stream-json subprocess accepts a user envelope mid-turn and injects it at the next step boundary. Send immediately when busy so a message steers the running turn, landing in the transcript inline. Retires the now-dead local queue: pending tray, flushQueue, up-arrow edit-queued / dequeueLast, the queue field, and the esc-clear-queue stage (Esc now goes straight to interrupt, which is the undo for a mis-sent steer).
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
Typed-while-busy input was held in a local queue and only handed to
claudeone-per-turn after theresultevent, so it could never influence work already in flight. Butclaude's stream-json subprocess accepts auserenvelope mid-turn and injects it at the next step boundary (verified with a live probe: a steering message sent ~5s into a 3-step tool run was honored instead of the remaining steps, folded into the same turn).This sends immediately when busy so the message steers the running turn, landing in the transcript inline.
Changes
keys.go:sendTurn— busy path now callsengine.Sendright away + adds the message inline; first-prompt session label only captured when opening a turn.chrome.go/render.go/view.go),flushQueue(update.go/stream.go), up-arrow edit-queued +dequeueLast(keys.go), thequeuefield (model.go), and the esc-clear-queue stage —Escnow goes straight to interrupt, which is the undo for a mis-sent steer.queue_test.go+ tray-budget test; repurposed the frame-fit test into a height-fit regression guard.Net: −235 / +40 across 10 files. Build +
go vet+ full test suite green.