Skip to content

Fix turn interrupt reply ordering and shutdown handling - #62066

Merged
copyberry[bot] merged 1 commit into
mainfrom
copyberry/codex-internal-to-codex-oss/9695fc3f718baa6b792a14d54136bb87fc003100
Nov 17, 2026
Merged

copyberry[bot] merged 1 commit into
mainfrom
copyberry/codex-internal-to-codex-oss/9695fc3f718baa6b792a14d54136bb87fc003100

Conversation

@copyberry

@copyberry copyberry Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

Fix turn interrupt reply ordering and shutdown handling

Why

A delayed terminal event from an earlier turn could acknowledge interrupts for a later turn. Interrupts could also remain pending after the thread listener shut down.

What changed

  • Associate pending turn/interrupt requests with their target turn and reply only when that turn completes or aborts.
  • Track the current Core turn through stop hooks and resolve review delegate IDs to the owning turn when validating interrupts.
  • Settle pending interrupts with an error on listener shutdown and reject further interrupts against the retired runtime.

Testing

Add regression tests for delayed terminal events, queued turn starts, review delegates, and interrupt handling during thread revert and runtime replacement.

## Why

A delayed terminal event from an earlier turn could acknowledge interrupts for a later turn. Interrupts could also remain pending after the thread listener shut down.

## What changed

- Associate pending `turn/interrupt` requests with their target turn and reply only when that turn completes or aborts.
- Track the current Core turn through stop hooks and resolve review delegate IDs to the owning turn when validating interrupts.
- Settle pending interrupts with an error on listener shutdown and reject further interrupts against the retired runtime.

## Testing

Add regression tests for delayed terminal events, queued turn starts, review delegates, and interrupt handling during thread revert and runtime replacement.

GitOrigin-RevId: 9695fc3f718baa6b792a14d54136bb87fc003100
@copyberry
copyberry Bot force-pushed the copyberry/codex-internal-to-codex-oss/9695fc3f718baa6b792a14d54136bb87fc003100 branch from 17fc0dc to 58627e6 Compare November 17, 2026 15:33
@chatgpt-codex-connector

Copy link
Copy Markdown
Contributor
Codex Review Summary: 🔄 Running

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review 🔄 Running since 2026-11-17T15:33:49.684930Z 17fc0dc PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@copyberry
copyberry Bot merged commit 58627e6 into main Nov 17, 2026
9 of 23 checks passed
@copyberry
copyberry Bot deleted the copyberry/codex-internal-to-codex-oss/9695fc3f718baa6b792a14d54136bb87fc003100 branch November 17, 2026 15:33
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 17, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant