Lightweight coding agent that runs in your terminal
Rust
Add HTTP window ID to Responses client metadata (#26923)
ningyi-oaia81531146609
diff --git a/codex-rs/core/src/client.rs b/codex-rs/core/src/client.rsindex dd7b9f400c..02d231c962 100644--- a/codex-rs/core/src/client.rs+++ b/codex-rs/core/src/client.rs@@ -802,10 +802,16 @@ impl ModelClient {service_tier,prompt_cache_key,text,- client_metadata: Some(HashMap::from([(- X_CODEX_INSTALLATION_ID_HEADER.to_string(),- self.state.installation_id.clone(),- )])),+ client_metadata: Some(HashMap::from([+ (+ X_CODEX_INSTALLATION_ID_HEADER.to_string(),+ self.state.installation_id.clone(),+ ),+ (+ X_CODEX_WINDOW_ID_HEADER.to_string(),+ self.current_window_id(),+ ),+ ])),};Ok(request)}diff --git a/codex-rs/core/tests/responses_headers.rs b/codex-rs/core/tests/responses_headers.rsindex 75649fa4bc..1ba93aec10 100644--- a/codex-rs/core/tests/responses_headers.rs+++ b/codex-rs/core/tests/responses_headers.rs@@ -158,6 +158,10 @@ async fn responses_stream_includes_subagent_header_on_review() {request.body_json()["client_metadata"]["x-codex-installation-id"].as_str(),Some(TEST_INSTALLATION_ID));+ assert_eq!(+ request.body_json()["client_metadata"]["x-codex-window-id"].as_str(),+ Some(expected_window_id.as_str())+ );assert_eq!(request.header("x-codex-sandbox"), None);}diff --git a/codex-rs/core/tests/suite/compact_remote.rs b/codex-rs/core/tests/suite/compact_remote.rsindex 2200c7b778..12fd570c56 100644--- a/codex-rs/core/tests/suite/compact_remote.rs+++ b/codex-rs/core/tests/suite/compact_remote.rs@@ -883,6 +883,10 @@ async fn remote_compact_v2_reuses_compaction_trigger_for_followups() -> Result<(compact_metadata["window_id"].as_str(),compact_request.header("x-codex-window-id").as_deref());+ assert_eq!(+ compact_request.body_json()["client_metadata"]["x-codex-window-id"].as_str(),+ compact_metadata["window_id"].as_str()+ );assert_eq!(compact_metadata["compaction"],json!({diff --git a/codex-rs/core/tests/suite/snapshots/all__suite__compact_remote__remote_manual_compact_api_auth_prompt_cache_key_request_diff.snap b/codex-rs/core/tests/suite/snapshots/all__suite__compact_remote__remote_manual_compact_api_auth_prompt_cache_key_request_diff.snapindex 750250f86a..89796cb918 100644--- a/codex-rs/core/tests/suite/snapshots/all__suite__compact_remote__remote_manual_compact_api_auth_prompt_cache_key_request_diff.snap+++ b/codex-rs/core/tests/suite/snapshots/all__suite__compact_remote__remote_manual_compact_api_auth_prompt_cache_key_request_diff.snap@@ -7,7 +7,8 @@ Scenario: After five varied API-key-auth turns, remote manual compaction omits s--- Last Normal /responses Request+++ Remote /responses/compact Request- "client_metadata": {-- "x-codex-installation-id": "<UUID>"+- "x-codex-installation-id": "<UUID>",+- "x-codex-window-id": "<UUID>:0"- },- "include": [- "reasoning.encrypted_content"diff --git a/codex-rs/core/tests/suite/snapshots/all__suite__compact_remote__remote_manual_compact_chatgpt_auth_service_tier_prompt_cache_key_request_diff.snap b/codex-rs/core/tests/suite/snapshots/all__suite__compact_remote__remote_manual_compact_chatgpt_auth_service_tier_prompt_cache_key_request_diff.snapindex e28ddd30d1..ab6c9d1b37 100644--- a/codex-rs/core/tests/suite/snapshots/all__suite__compact_remote__remote_manual_compact_chatgpt_auth_service_tier_prompt_cache_key_request_diff.snap+++ b/codex-rs/core/tests/suite/snapshots/all__suite__compact_remote__remote_manual_compact_chatgpt_auth_service_tier_prompt_cache_key_request_diff.snap@@ -7,7 +7,8 @@ Scenario: After five varied ChatGPT-auth turns, remote manual compaction reuses--- Last Normal /responses Request+++ Remote /responses/compact Request- "client_metadata": {-- "x-codex-installation-id": "<UUID>"+- "x-codex-installation-id": "<UUID>",+- "x-codex-window-id": "<UUID>:0"- },- "include": [- "reasoning.encrypted_content"