Skip to content

Add interrupt and queue actions for running turns - #389

Merged
SudoJacky merged 1 commit into
masterfrom
fix/runtime-input-turns
Aug 6, 2026
Merged

Add interrupt and queue actions for running turns#389
SudoJacky merged 1 commit into
masterfrom
fix/runtime-input-turns

Conversation

@SudoJacky

Copy link
Copy Markdown
Owner

Summary

  • add explicit Insert into current task and Queue for next turn actions while an agent turn is running
  • make insert cancel the active turn and wait for both cancellation acknowledgement and the terminal interruption event before starting a new turn
  • preserve the selected model, attachments, and context references across normal, queued, and interrupt sends
  • restore the normal send action after the canonical turn becomes terminal
  • remove successfully submitted inputs from the pending-input queue

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 passed
  • npx tsc --noEmit
  • git diff --check

@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: 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".

Comment on lines +1757 to +1759
if (terminalEventReceived) {
interruptTerminalInputIdsRef.current.add(input.id);
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge 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 👍 / 👎.

@SudoJacky
SudoJacky merged commit 58e68b6 into master Aug 6, 2026
1 check passed
@SudoJacky
SudoJacky deleted the fix/runtime-input-turns branch August 6, 2026 12:39
@SudoJacky SudoJacky mentioned this pull request Aug 6, 2026
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