🤖 fix: hide synthetic queued messages from the user queue UI#3684
Open
ammar-agent wants to merge 1 commit into
Open
🤖 fix: hide synthetic queued messages from the user queue UI#3684ammar-agent wants to merge 1 commit into
ammar-agent wants to merge 1 commit into
Conversation
Collaborator
Author
|
@codex review |
|
Codex Review: Didn't find any major issues. Already looking forward to the next diff. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
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.
Summary
Background bash monitor wake prompts (and other system-injected messages) no longer flash in the queued-message banner or leak into the composer:
MessageQueuenow tracks per-entry synthetic origin and all user-facing queue surfaces exclude synthetic entries.Background
When a background bash monitor matched output while the owner session was actively streaming, the wake prompt was deliberately queued with
queueDispatchMode: "tool-end"so it could preempt at the next tool boundary. The queue'ssynthetic: trueflag was only used to re-tag the outgoing batch for transcript metadata —queued-message-changedemittedgetMessages()/getDisplayText()verbatim. The raw system prompt ("A background bash monitor matched output. …") therefore appeared in the user queue banner until the next tool boundary flushed it, complete with Edit/Send-now affordances that could pull system text into the input box. The same gap affected every synthetic queue producer (goal continuations, workspace-turn follow-ups, compaction handler follow-ups) andrestoreQueueToInput()on user interrupt.Implementation
System vs user segregation now lives in the queue's data model:
MessageQueuestoresQueueEntry { text, synthetic }instead of bare strings. Dispatch (produceMessage) still joins all entries in order.getMessages()/getDisplayText()are replaced by explicitly namedgetUserMessages()/getUserDisplayText(), which exclude synthetic entries. The/compactand agent-skill rawCommand shortcuts only apply when no synthetic entry shares the queue, so rawCommand never misrepresents a mixed batch.AgentSessionbuilds itsqueued-message-changedpayload through a sharedbuildQueuedMessageChangedEvent()(used by both live emits and the reconnect replay snapshot), so both paths only expose user-authored entries.restoreQueueToInput()restores only user content; a synthetic-only queue is still cleared (canceling wake callbacks as before) but emits norestore-to-inputevent.No schema or frontend changes needed: the wire format is unchanged, and the frontend's existing
queuedMessages.length > 0content check naturally hides synthetic-only queues.Risks
Low-to-moderate: touches the queue snapshot every workspace uses for the queued banner, interrupt-restore, and reconnect replay. For all-user queues, behavior is byte-identical to before. The main behavioral change is intentional: synthetic entries disappear from display/restore surfaces while still dispatching. Covered by new unit tests for synthetic-only, mixed, and rawCommand-adjacent cases plus session-level event assertions.
Generated with
mux• Model:anthropic:claude-fable-5• Thinking:high