-
Notifications
You must be signed in to change notification settings - Fork 7.4k
Turn-state sticky routing per turn #9332
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
@codex review this |
There was a problem hiding this 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: 1773236c50
ℹ️ 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".
codex-rs/core/src/default_client.rs
Outdated
| static REQWEST_CLIENT: LazyLock<reqwest::Client> = LazyLock::new(|| { | ||
| use reqwest::header::HeaderMap; | ||
|
|
||
| let mut headers = HeaderMap::new(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Preserve updated originator/User-Agent headers
Because REQWEST_CLIENT is initialized once from originator() and get_codex_user_agent(), later updates to USER_AGENT_SUFFIX/set_default_originator (e.g., the app-server or MCP initialize handlers) never reach the cached client. AuthManager::new calls create_client before initialize, so requests sent after client info is set will still use the default originator and omit the suffix. Previously each build_reqwest_client() rebuilt headers, so this change prevents per-client identification in any process that sets these values after startup.
Useful? React with 👍 / 👎.
|
@codex review this |
8fffd9b to
ac71c47
Compare
|
Codex Review: Didn't find any major issues. More of your lovely PRs please. ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
jif-oai
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good stuff
| pub session_source: Option<SessionSource>, | ||
| pub extra_headers: HeaderMap, | ||
| pub compression: Compression, | ||
| pub turn_state: Option<Arc<OnceLock<String>>>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That feels strange as a type but actually it works pretty nicely. OOC, was this your idea or Codex idea?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
my idea
| use tracing::debug; | ||
| use tracing::trace; | ||
|
|
||
| pub(crate) fn spawn_chat_stream( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2 weeks before nuking this endpoint!!!!
capture the header from SSE/WS handshakes, store it per ModelClientSession using
Oncelock, echo it on turn-scoped requests, and add SSE+WS integration tests for within-turn persistence + cross-turn reset.keep
x-codex-turn-statesticky within a user turn to maintain routing continuity for retries/tool follow-ups.