Add interrupt and queue actions for running turns - #389
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5afa61b570
ℹ️ 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".
| if (terminalEventReceived) { | ||
| interruptTerminalInputIdsRef.current.add(input.id); | ||
| } |
There was a problem hiding this comment.
Reconcile pending inserts after resubscribing
If the user closes the session tab after requesting an insert but before the interrupted terminal event arrives, both subscription effects unsubscribe from that session because it is no longer open. This terminal flag is therefore never recorded, and reopening the session only reloads its terminal timeline—it does not call this handoff path—so the inserted message remains permanently queued and cannot even be cleared while its status is queued. Reconcile pending inserts against the loaded canonical turn state when subscribing or reopening rather than relying exclusively on observing the live terminal event.
Useful? React with 👍 / 👎.
Summary
Root cause
The composer UI and submission path used different sources of truth for running state, and each send mode assembled its input independently. This allowed an insert to bypass cancellation when session summary state was stale, lose the selected model or references, and retain a submitted item in the pending queue.
User impact
Users can now correct a running agent without overlapping turns or restarting the conversation. Queued input remains non-disruptive, and both paths use the same complete turn input as a normal send.
Validation
npm test— 75 files, 501 tests passednpx tsc --noEmitgit diff --check