Skip to content

Preserve active recovery turns when clients reconnect - #61014

Merged
copyberry[bot] merged 1 commit into
mainfrom
copyberry/codex-internal-to-codex-oss/f295038c8502a9b2849ddc08614db4a3cb5610cf
Nov 12, 2026
Merged

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

Conversation

@copyberry

@copyberry copyberry Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

Preserve active recovery turns when clients reconnect

Why

A recovery turn can occupy the core turn slot before TurnStarted is published and thread statuses reflect it. During this window, thread/resume with configuration overrides could treat an unsubscribed thread as idle and shut it down, interrupting recovery.

What changed

Require the core turn slot to be empty before replacing a loaded thread during resume. Expose CodexThread::has_active_turn() and reuse it in the residency unload check.

Testing

Add a regression test that blocks paginated history writes to hold a recovery turn before status publication, reconnects with a configuration override, and verifies that the client receives completion for the preserved recovery turn.

## Why

A recovery turn can occupy the core turn slot before `TurnStarted` is published and thread statuses reflect it. During this window, `thread/resume` with configuration overrides could treat an unsubscribed thread as idle and shut it down, interrupting recovery.

## What changed

Require the core turn slot to be empty before replacing a loaded thread during resume. Expose `CodexThread::has_active_turn()` and reuse it in the residency unload check.

## Testing

Add a regression test that blocks paginated history writes to hold a recovery turn before status publication, reconnects with a configuration override, and verifies that the client receives completion for the preserved recovery turn.

GitOrigin-RevId: f295038c8502a9b2849ddc08614db4a3cb5610cf
@copyberry
copyberry Bot force-pushed the copyberry/codex-internal-to-codex-oss/f295038c8502a9b2849ddc08614db4a3cb5610cf branch from 3d2eb68 to b75ec48 Compare November 12, 2026 04:18
@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-12T04:18:21.458280Z 3d2eb68 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 b75ec48 into main Nov 12, 2026
8 of 23 checks passed
@copyberry
copyberry Bot deleted the copyberry/codex-internal-to-codex-oss/f295038c8502a9b2849ddc08614db4a3cb5610cf branch November 12, 2026 04:18
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 12, 2026

This branch was previously deployed

1 inactive deployment
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.

2 participants