Skip to content

Preserve per-session routing for gRPC code mode - #52381

Merged
copyberry[bot] merged 1 commit into
mainfrom
copyberry/codex-internal-to-codex-oss/5d60ef1afa56beb8c70ba7ab27865128225b0d3d
Oct 9, 2026
Merged

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

Conversation

@copyberry

@copyberry copyberry Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Preserve per-session routing for gRPC code mode

Why

Sessions sharing a transport can be admitted to different hosts. Each session needs its own routing token so subsequent RPCs reach the host holding its state.

What changed

  • Capture the optional x-code-mode-route metadata from successful OpenSession responses and attach it to subsequent session RPCs. Reject tokens longer than 256 bytes and keep new admission attempts free of existing session routes.
  • Invalidate a routed session when an Unavailable response explicitly sets x-code-mode-route-lost: true, allowing a later operation to reopen it without replaying the failed execution. Ordinary Unavailable responses preserve the session.
  • Allow up to five admission attempts for Unavailable and ResourceExhausted, with an immediate first retry followed by jittered exponential backoff.
  • Order session failure with shutdown so late callback errors cannot cancel an in-flight CloseSession RPC.

Testing

Add regression coverage for independent routing on a shared provider, route-loss recovery without execution replay, preservation of unaffected session state, and callback failures racing shutdown. Extend admission tests to verify the five-attempt limit and recovery tests to distinguish explicit route loss from ordinary unavailability.

## Why

Sessions sharing a transport can be admitted to different hosts. Each session needs its own routing token so subsequent RPCs reach the host holding its state.

## What changed

- Capture the optional `x-code-mode-route` metadata from successful `OpenSession` responses and attach it to subsequent session RPCs. Reject tokens longer than 256 bytes and keep new admission attempts free of existing session routes.
- Invalidate a routed session when an `Unavailable` response explicitly sets `x-code-mode-route-lost: true`, allowing a later operation to reopen it without replaying the failed execution. Ordinary `Unavailable` responses preserve the session.
- Allow up to five admission attempts for `Unavailable` and `ResourceExhausted`, with an immediate first retry followed by jittered exponential backoff.
- Order session failure with shutdown so late callback errors cannot cancel an in-flight `CloseSession` RPC.

## Testing

Add regression coverage for independent routing on a shared provider, route-loss recovery without execution replay, preservation of unaffected session state, and callback failures racing shutdown. Extend admission tests to verify the five-attempt limit and recovery tests to distinguish explicit route loss from ordinary unavailability.

GitOrigin-RevId: 5d60ef1afa56beb8c70ba7ab27865128225b0d3d
@copyberry
copyberry Bot force-pushed the copyberry/codex-internal-to-codex-oss/5d60ef1afa56beb8c70ba7ab27865128225b0d3d branch from b491391 to 5b3c152 Compare October 9, 2026 02:51
@copyberry
copyberry Bot merged commit 5b3c152 into main Oct 9, 2026
1 check passed
@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-09T02:51:12.283885Z b491391 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 deleted the copyberry/codex-internal-to-codex-oss/5d60ef1afa56beb8c70ba7ab27865128225b0d3d branch October 9, 2026 02:51
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 9, 2026
@3Asuka
3Asuka deployed to issue-triage October 9, 2026 02:53 — with Image GitHub Actions Active
@3Asuka
3Asuka deployed to issue-triage October 9, 2026 02:53 — with Image GitHub Actions Active
@3Asuka
3Asuka deployed to issue-triage October 9, 2026 02:53 — with Image GitHub Actions Active
@Pat205945
Pat205945 deployed to issue-triage October 9, 2026 02:53 — with Image GitHub Actions Active
@Pat205945
Pat205945 deployed to issue-triage October 9, 2026 02:53 — with Image GitHub Actions Active
@Pat205945
Pat205945 deployed to issue-triage October 9, 2026 02:53 — with Image GitHub Actions Active
@Pat205945
Pat205945 deployed to issue-triage October 9, 2026 02:54 — with Image GitHub Actions Active
@3Asuka
3Asuka deployed to issue-triage October 9, 2026 02:54 — with Image GitHub Actions Active

This branch was successfully deployed

1 active deployment
issue-triage — 5b3c1522 Deployed Oct 9, 2026 by 3Asuka via Identify potential duplicates (open issues fallback) #53458
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.

3 participants