Skip to content

[codex] cover attributable model and backend requests#26141

Open
cooper-oai wants to merge 1 commit into
cooper/codex-native-http-state/4from
cooper/codex-native-http-state/5
Open

[codex] cover attributable model and backend requests#26141
cooper-oai wants to merge 1 commit into
cooper/codex-native-http-state/4from
cooper/codex-native-http-state/5

Conversation

@cooper-oai
Copy link
Copy Markdown
Contributor

@cooper-oai cooper-oai commented Jun 3, 2026

Why

Several high-signal requests run through shared model and backend clients before or outside the main Responses path. They need explicit surface ownership so /models, /wham/usage, and related attributable requests use the same jar as the initiating session.

What changed

  • Thread request-scoped surface ownership through shared model-catalog refreshes and model-refresh preflights.
  • Add optional HTTP-state context to codex-backend-client so attributable backend routes attach and rotate state.
  • Pass the initialized app-server surface into account, catalog, thread, turn, external-agent, and session creation paths, including GET /wham/usage.
  • Preserve the initiating surface for child threads, subagents, and detached reviews.

Review guide

  • Ownership is optional by design. Process-global work without an initiating surface should remain unattributed instead of guessing a jar.
  • Child work should inherit the initiating session's surface before any attributable preflight begins.
  • This PR reuses the transport wrappers from #26139; it should not duplicate header policy.

Stack

This is PR 5 of 7 in the native HTTP-state stack. It depends on #26140.

  1. #26137: per-surface store
  2. #26138: app-server bridge
  3. #26139: HTTP and WebSocket transport
  4. #26140: login, refresh, logout, and remote control
  5. #26141: shared model and backend clients (this PR)
  6. #26142: app-owned requests
  7. #26143: standalone CLI requests

Validation

  • codex-models-manager, codex-model-provider, and codex-backend-client suites
  • Targeted app-server usage and inherited-surface tests
  • Scoped Clippy, formatting, whitespace, and Bazel lock checks

@cooper-oai cooper-oai marked this pull request as ready for review June 3, 2026 11:03
@cooper-oai cooper-oai requested a review from a team as a June 3, 2026 11:03
@cooper-oai cooper-oai force-pushed the cooper/codex-native-http-state/5 branch from 0f98cbc to 92a056e Compare June 3, 2026 11:03
@cooper-oai cooper-oai force-pushed the cooper/codex-native-http-state/4 branch from e8b459b to 4caefe4 Compare June 3, 2026 11:03
@cooper-oai cooper-oai force-pushed the cooper/codex-native-http-state/5 branch from 92a056e to acff8c9 Compare June 3, 2026 11:11
@cooper-oai cooper-oai force-pushed the cooper/codex-native-http-state/4 branch from 4caefe4 to 6772240 Compare June 3, 2026 11:11
@cooper-oai cooper-oai force-pushed the cooper/codex-native-http-state/5 branch from acff8c9 to 3512c13 Compare June 3, 2026 11:12
@cooper-oai cooper-oai force-pushed the cooper/codex-native-http-state/4 branch from 6772240 to 01090b4 Compare June 3, 2026 11:12
@chatgpt-codex-connector
Copy link
Copy Markdown
Contributor

💡 Codex Review

https://github.com/openai/codex/blob/0f98cbc128f32163f297bab873b4334482fc0d4c/codex-rs/Cargo.toml#L40
P2 Badge Commit the regenerated Bazel lockfile

Adding the new http-state workspace member changes Cargo metadata, but this commit does not include an updated MODULE.bazel.lock. The repo rule requires running just bazel-lock-update and committing the lockfile whenever Cargo.toml or Cargo.lock changes (AGENTS.md lines 34-36); I also checked just bazel-lock-check, and it reports MODULE.bazel.lock is out of date, so Bazel CI will fail until the regenerated lockfile is included.


https://github.com/openai/codex/blob/0f98cbc128f32163f297bab873b4334482fc0d4c/codex-rs/app-server-transport/src/transport/remote_control/clients.rs#L195-L196
P2 Badge Refresh remote-control client auth with its surface

These client-management requests now attach and rotate the CodexRemoteControl HTTP state, but the 401 retry path in send_client_management_request still constructs recovery with the generic auth_manager.unauthorized_recovery(). When remoteControl/client/list or remoteControl/client/revoke hits an expired token, that refresh omits the remote-control surface and does not replace the remote-control state returned by the refresh endpoint, so the subsequent retry can keep sending stale x-oai-is state; use the same remote_control_auth_recovery helper used by the websocket/enrollment paths before retrying.

ℹ️ 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".

@cooper-oai cooper-oai force-pushed the cooper/codex-native-http-state/5 branch from 3512c13 to bd0e5f8 Compare June 3, 2026 11:37
@cooper-oai cooper-oai force-pushed the cooper/codex-native-http-state/4 branch from 01090b4 to 0827999 Compare June 3, 2026 11:37
@cooper-oai cooper-oai force-pushed the cooper/codex-native-http-state/5 branch from bd0e5f8 to f8352e8 Compare June 3, 2026 12:33
@cooper-oai cooper-oai force-pushed the cooper/codex-native-http-state/4 branch 2 times, most recently from 43ac41a to 61b88ac Compare June 3, 2026 12:35
@cooper-oai cooper-oai force-pushed the cooper/codex-native-http-state/5 branch 2 times, most recently from d9daedf to f5944ee Compare June 3, 2026 13:08
@cooper-oai cooper-oai force-pushed the cooper/codex-native-http-state/4 branch 2 times, most recently from 9c482de to dc1dfd1 Compare June 3, 2026 13:25
@cooper-oai cooper-oai force-pushed the cooper/codex-native-http-state/5 branch from f5944ee to 77999e5 Compare June 3, 2026 13:25
@cooper-oai
Copy link
Copy Markdown
Contributor Author

@codex review

@cooper-oai cooper-oai force-pushed the cooper/codex-native-http-state/5 branch from 77999e5 to a9a7ba6 Compare June 3, 2026 13:52
Copy link
Copy Markdown
Contributor

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

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: 77999e5e43

ℹ️ 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 thread codex-rs/models-manager/src/manager.rs
Comment thread codex-rs/backend-client/Cargo.toml
Comment thread codex-rs/core/src/thread_manager.rs
@cooper-oai
Copy link
Copy Markdown
Contributor Author

@codex review

Copy link
Copy Markdown
Contributor

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

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: a9a7ba690f

ℹ️ 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 thread codex-rs/models-manager/src/manager.rs Outdated
Comment thread codex-rs/core/src/session/session.rs
Comment thread codex-rs/app-server/src/request_processors/turn_processor.rs Outdated
@cooper-oai cooper-oai force-pushed the cooper/codex-native-http-state/5 branch from a9a7ba6 to 115ba55 Compare June 3, 2026 14:44
@cooper-oai
Copy link
Copy Markdown
Contributor Author

@codex review

Copy link
Copy Markdown
Contributor

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

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: 115ba55887

ℹ️ 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 thread codex-rs/backend-client/Cargo.toml
Comment thread codex-rs/core/src/thread_manager.rs
@cooper-oai cooper-oai force-pushed the cooper/codex-native-http-state/4 branch from dc1dfd1 to fe42288 Compare June 3, 2026 21:25
@cooper-oai cooper-oai force-pushed the cooper/codex-native-http-state/5 branch from 115ba55 to 8450855 Compare June 3, 2026 21:25
@cooper-oai cooper-oai force-pushed the cooper/codex-native-http-state/4 branch from fe42288 to 118726f Compare June 3, 2026 23:03
@cooper-oai cooper-oai force-pushed the cooper/codex-native-http-state/5 branch from 8450855 to 9a10161 Compare June 3, 2026 23:03
@cooper-oai cooper-oai force-pushed the cooper/codex-native-http-state/4 branch from 118726f to b1e8dfa Compare June 3, 2026 23:28
@cooper-oai cooper-oai force-pushed the cooper/codex-native-http-state/5 branch from 9a10161 to 4119b85 Compare June 3, 2026 23:28
@cooper-oai cooper-oai force-pushed the cooper/codex-native-http-state/4 branch from b1e8dfa to ad4d4de Compare June 3, 2026 23:44
@cooper-oai cooper-oai force-pushed the cooper/codex-native-http-state/5 branch from 4119b85 to ec2e111 Compare June 3, 2026 23:44
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