🤖 feat: queue messages behind special sends instead of erroring (FIFO message queue)#3696
Conversation
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 294388fed2
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
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".
|
@codex review Addressed the P2: |
|
Codex Review: Didn't find any major issues. Keep it up! 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". |
1 similar comment
|
Codex Review: Didn't find any major issues. Keep it up! 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". |
|
@codex review Updated the queue fix to keep background work non-disruptive:
Local targeted tests, typecheck, and |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b985a91d59
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
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".
|
@codex review Addressed the send-now priority issue: the queued-message card now promotes the oldest user-authored entry ahead of hidden synthetic/background entries before dispatch. Hidden work stays queued and resumes through the normal drain lifecycle. Added a regression test for user/background/user ordering; targeted tests, typecheck, and |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ebeb42fe6b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
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".
|
@codex review Addressed the partial-drain send-now guard issue: queued card identity now derives from the visible queue projection, so dispatching one FIFO entry changes the id and resets the in-flight guard for the remaining card. Added a WorkspaceStore regression test; targeted tests, typecheck, and |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 57a0e064fd
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
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".
|
@codex review Addressed the queue-card id allocation issue: identity now includes only lightweight attachment/review metadata (media type, filename, URL length, file/line), never attachment data URLs or review bodies. WorkspaceStore tests, typecheck, and |
|
@codex review Addressed the attachment-id performance concern: queued card identity now includes only lightweight attachment/review metadata (media type, filename, URL length, file path, line range), never serialized data URLs or review payloads. WorkspaceStore regression test, typecheck, and |
|
Codex Review: Didn't find any major issues. Hooray! 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". |
Summary
Sending a message while an internal workspace-turn follow-up (or another metadata-bound send) was queued failed with a hard error dialog. This PR restructures
MessageQueuefrom a single merged batch into FIFO dispatchable entries, so special sends own their turn and later messages queue behind them without errors. It also keeps backend-initiated queue work non-disruptive: background monitor wakes are hidden from/restored separately from the user's composer, and live foreground bashes are moved to background before a monitor wake dispatches after the current step.Background
MessageQueuepreviously merged every queued message into one combined send (joined text, one metadata object, one callback set). That forced hard rejections for sends that must stay attached to exactly one dispatch, including workspace-turn follow-ups, agent-skill invocations, and compaction requests.The FIFO change made background and user entries able to coexist, exposing two related UX risks that this PR also addresses:
Implementation
MessageQueuenow holds orderedQueueEntryitems and dispatches one entry at a time withdequeueNext().Cannot queue ...throw paths are removed.hasQueuedMessagessignal so background follow-up bookkeeping remains correct even when the renderer has no user-visible queued message.restore-to-inputclears/cancels the complete queue but emits only user-authored text/files/reviews. Restore events are workspace-scoped so a background workspace cannot overwrite the currently mounted composer.Validation
messageQueue,agentSession.queueDispatch,workspaceService, andWorkspaceStore.make typecheckpassed.make static-checkpassed.Risks
Medium: this changes the hot path for mid-stream sends, queue rendering/restoration, and bash-monitor wake dispatch. Existing batching semantics remain for compatible user messages; special sends and ownership boundaries are isolated into FIFO entries. Synthetic entries are hidden only from user-editable projections, while all-entry queue state is preserved for dispatch and response-completion logic. Monitor wake behavior matches the existing user send-after-step UX by migrating foreground bash work before soft-stopping the stream.
Generated with
mux• Model:openai:gpt-5.6-sol• Thinking:high• Cost:$41.31