Skip to content

Interrupt and drain canceled classifier responses before socket reuse - #53698

Merged
copyberry[bot] merged 1 commit into
mainfrom
copyberry/codex-internal-to-codex-oss/c4e7aac49d36cea2c2d0e9f2ba5f6147f67471dd
Oct 13, 2026
Merged

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

Conversation

@copyberry

@copyberry copyberry Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Interrupt and drain canceled classifier responses before socket reuse

Why

Canceled classifier requests need bounded cleanup that preserves received token usage and returns only safe WebSocket connections to the pool.

What changed

  • Own classifier response streams and connection leases together, interrupting dropped responses with a one-second cleanup deadline.
  • Require a matching interruption acknowledgement and response completion before reusing a canceled response's socket. Retire sockets on rejection, invalid acknowledgements, or timeout while preserving any received completion and token usage.
  • Skip requests canceled before dispatch and return their unused sockets to the pool.
  • Distinguish cancellation from ordinary steering, which continues draining without requiring an interruption acknowledgement.

Testing

Add regression coverage for cancellation, acknowledgement ordering and failures, cleanup timeouts, socket reuse, and token accounting under backpressure. Extend steering tests to cover rejected and missing acknowledgements.

…#53698)

## Why

Canceled classifier requests need bounded cleanup that preserves received token usage and returns only safe WebSocket connections to the pool.

## What changed

- Own classifier response streams and connection leases together, interrupting dropped responses with a one-second cleanup deadline.
- Require a matching interruption acknowledgement and response completion before reusing a canceled response's socket. Retire sockets on rejection, invalid acknowledgements, or timeout while preserving any received completion and token usage.
- Skip requests canceled before dispatch and return their unused sockets to the pool.
- Distinguish cancellation from ordinary steering, which continues draining without requiring an interruption acknowledgement.

## Testing

Add regression coverage for cancellation, acknowledgement ordering and failures, cleanup timeouts, socket reuse, and token accounting under backpressure. Extend steering tests to cover rejected and missing acknowledgements.

GitOrigin-RevId: c4e7aac49d36cea2c2d0e9f2ba5f6147f67471dd
@copyberry
copyberry Bot force-pushed the copyberry/codex-internal-to-codex-oss/c4e7aac49d36cea2c2d0e9f2ba5f6147f67471dd branch from 1a49ca0 to ffc1402 Compare October 13, 2026 15:24
@chatgpt-codex-connector

Copy link
Copy Markdown
Contributor

Codex Review Summary

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

Review Status Commit Review trigger
πŸ“ Code Review πŸ”„ Running since 2026-10-13T15:24:14.439132Z 1a49ca0 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 ffc1402 into main Oct 13, 2026
1 check passed
@copyberry
copyberry Bot deleted the copyberry/codex-internal-to-codex-oss/c4e7aac49d36cea2c2d0e9f2ba5f6147f67471dd branch October 13, 2026 15:24
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 13, 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