feat: inject queued messages into next API call for mid-task guidance#11813
Open
shdomi8599 wants to merge 1 commit intoRooCodeInc:mainfrom
Open
feat: inject queued messages into next API call for mid-task guidance#11813shdomi8599 wants to merge 1 commit intoRooCodeInc:mainfrom
shdomi8599 wants to merge 1 commit intoRooCodeInc:mainfrom
Conversation
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.
Related GitHub Issue
Closes: #11802
Roo Code Task Context (Optional)
N/A
Description
TL;DR: Queued messages now get injected into the very next API call instead of waiting for the task to fully complete.
After discussing the approach with @hannesrudolph in DMs, we agreed that the simplest and most natural UX is to enhance the existing message queue rather than adding a separate steering mechanism. When users type a message while the agent is working, they expect it to be noticed at the next step — not after the entire task finishes.
Implementation (25 lines in Task.ts):
finalUserContentassembly point in recursivelyMakeClineRequests, drain the message queue[USER_MID_TASK_MESSAGE]blockWhat's NOT changed:
Design trade-off: This is "reactive" injection (between API calls), not "preemptive" (mid-stream abort). Preemptive injection is noted as future work. The reactive approach is zero-risk to existing behavior and covers the most common use case.
Test Procedure
Automated:
npx vitest run core/task/__tests__/mid-task-message-injection.spec.ts— 5 tests covering: empty queue, single message injection, multiple message ordering, queue drain completeness, and post-drain independenceManual (F5 Extension Development Host):
Pre-Submission Checklist
Screenshots / Videos
No UI changes.
Documentation Updates
Additional Notes
The original issue proposed using an external
@steer-agent/corelibrary. After feedback from @hannesrudolph ("Why not make that the default?"), the approach was simplified to a minimal change to the existing queue behavior — no external dependencies, no new UI, just 25 lines that make the queue smarter.Future work: Preemptive injection — abort the current stream when a queued message arrives and restart with the message injected, enabling truly real-time mid-stream course correction.
Get in Touch
Discord: shdomi_8599
Interactively review PR in Roo Code Cloud