Skip to content

🤖 fix: preserve queued follow-ups during dispatch handoff - #3924

Open
ammar-agent wants to merge 4 commits into
mainfrom
fix/queued-message-compaction-handoff
Open

🤖 fix: preserve queued follow-ups during dispatch handoff#3924
ammar-agent wants to merge 4 commits into
mainfrom
fix/queued-message-compaction-handoff

Conversation

@ammar-agent

@ammar-agent ammar-agent commented Aug 22, 2026

Copy link
Copy Markdown
Collaborator

Summary

Fix the visual gap where a follow-up sent during compaction could disappear between leaving the queued-message card and appearing as a durable transcript row.

Background

The composer clears as soon as a send begins, so a follow-up queued behind compaction is represented only by the queued-message card. Queue draining previously removed the entry and emitted an empty queue projection before asynchronous history persistence emitted the corresponding user row. During that interval the text appeared nowhere in the UI.

Implementation

  • Retain a dequeued user entry in an authoritative server-side dispatch projection until its durable acceptance callback runs.
  • Use that projection for live events, reconnect snapshots, and subsequent queue mutations, so the card cannot disappear early or duplicate later entries.
  • Enter the existing PREPARING lifecycle before publishing the projection and disable Edit, dispatch-mode, send-now, and queued-message keyboard actions during persistence.
  • Consolidate the previous per-field visible queue getters into one projection and reuse one no-stream cleanup path.
  • Add deterministic regression coverage that blocks history persistence, mutates the remaining queue, and verifies the card-to-transcript handoff order without duplication.

Validation

  • make static-check
  • Targeted queued-message suite: 109 passed, 8 skipped
  • tests/ui/chat/queuedMessageBanner.test.tsx: 21 passed
  • tests/ipc/streaming/queuedMessages.completing.test.ts: 6 passed

Risks

Moderate but scoped risk in queued-message projection and action timing. Persistence and FIFO dispatch semantics are unchanged; the added state only spans dequeue through durable acceptance. Tests cover reconnect-equivalent projection rebuilding, concurrent queue mutation, cancellation/failure cleanup, and disabled dispatching actions.

Subtractive ledger

The authoritative in-flight projection and action gate require a small production addition. The same change removes five parallel visible-queue getters and consolidates three duplicated failure/cancellation cleanup paths in the queue/session modules.


Generated with xum • Model: openai:gpt-5.6-sol • Thinking: xhigh • Cost: $133.55

Keep a dequeued user follow-up visible until its durable transcript row is emitted, and consolidate no-stream queue cleanup. Add a regression test that verifies the queue card-to-transcript event ordering.

---

_Generated with `xum` • Model: `openai:gpt-5.6-sol` • Thinking: `xhigh` • Cost: `$25.07`_

<!-- mux-attribution: model=openai:gpt-5.6-sol thinking=xhigh costs=25.07 -->
@ammar-agent

Copy link
Copy Markdown
Collaborator Author

@codex review

Please review the queued-message visibility handoff and failure-path cleanup.

@chatgpt-codex-connector

This comment has been minimized.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4d570a81b9

ℹ️ 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".

Comment thread src/node/services/agentSession.ts
Retain the in-flight user entry in the server queue projection through durable acceptance, include it in reconnect and mutation snapshots, and disable stale queue actions during the handoff.

---

_Generated with `xum` • Model: `openai:gpt-5.6-sol` • Thinking: `xhigh` • Cost: `$64.30`_

<!-- mux-attribution: model=openai:gpt-5.6-sol thinking=xhigh costs=64.30 -->
@ammar-agent
ammar-agent force-pushed the fix/queued-message-compaction-handoff branch from fa060e3 to 0baeab9 Compare August 22, 2026 03:46
@ammar-agent

Copy link
Copy Markdown
Collaborator Author

@codex review

The in-flight entry is now part of the authoritative server projection through durable acceptance, including reconnect and queue-mutation snapshots, with stale actions disabled during PREPARING. Please take another look.

@chatgpt-codex-connector

This comment has been minimized.

@ammar-agent

Copy link
Copy Markdown
Collaborator Author

@codex review

Please perform the code review for commit 0baeab9. The prior security-only response is resolved; the authoritative in-flight projection and disabled-action behavior are ready for review.

@chatgpt-codex-connector

This comment has been minimized.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0baeab9ec3

ℹ️ 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".

Comment thread src/browser/components/ChatPane/ChatPane.tsx Outdated
Comment thread src/node/services/agentSession.ts Outdated
Update the disposal-race assertion to verify synthetic attribution remains intact while allowing the queue handoff to add its durable-acceptance callback.

---

_Generated with `xum` • Model: `openai:gpt-5.6-sol` • Thinking: `xhigh` • Cost: `$64.30`_

<!-- mux-attribution: model=openai:gpt-5.6-sol thinking=xhigh costs=64.30 -->
@ammar-agent

Copy link
Copy Markdown
Collaborator Author

@codex review

Please review the current head 6414887. The only follow-up after the authoritative projection fix updates the affected disposal-race assertion to accept the wrapped durable-acceptance callback; local tests and static checks pass.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Another round soon, please!

Reviewed commit: 6414887b99

ℹ️ 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".

@chatgpt-codex-connector

This comment has been minimized.

Expose dispatching state from the authoritative queue projection instead of general stream startup, and omit an in-flight card from reconnect snapshots once its user row is already durable in replayed history.

---

_Generated with `xum` • Model: `openai:gpt-5.6-sol` • Thinking: `xhigh` • Cost: `$64.30`_

<!-- mux-attribution: model=openai:gpt-5.6-sol thinking=xhigh costs=64.30 -->
@chatgpt-codex-connector

This comment has been minimized.

@ammar-agent

Copy link
Copy Markdown
Collaborator Author

@codex review

Addressed both findings in ecd686cfd: queued dispatch state now comes from the authoritative projection rather than general stream startup, and reconnect replay omits an in-flight card once its durable user row is already present in replayed history. Both threads include implementation details and regression coverage.

@chatgpt-codex-connector

This comment has been minimized.

@ammar-agent

Copy link
Copy Markdown
Collaborator Author

@codex review

All prior findings are addressed and their threads are resolved. Please perform a fresh code review of ecd686cfd and leave an explicit approval signal if no issues remain.

@chatgpt-codex-connector

This comment has been minimized.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. You're on a roll.

Reviewed commit: ecd686cfd5

ℹ️ 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".

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