Add HTTP window ID to Responses client metadata#26923
Conversation
12c7505 to
11fad7f
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 11fad7f20a
ℹ️ 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".
| ( | ||
| X_CODEX_WINDOW_ID_HEADER.to_string(), | ||
| self.current_window_id(), | ||
| ), |
There was a problem hiding this comment.
Add metadata to legacy compact payloads
When RemoteCompactionV2 is disabled, remote compaction still goes through compact_conversation_history and posts an ApiCompactionInput to /v1/responses/compact; that path destructures the ResponsesApiRequest and drops client_metadata before serializing the compact body. As a result, the compaction requests called out in the commit message still have no body client_metadata["x-codex-window-id"] for the backend to preserve if the direct x-codex-window-id header is stripped, while only normal /v1/responses and v2 compaction get the new metadata.
Useful? React with 👍 / 👎.
d535bce to
219baef
Compare
Summary
x-codex-window-idHTTP header unchanged.client_metadata, allowing supported backend paths to surface it asx-client-meta-x-codex-window-id.Why
In the
2026-06-06T23production hour, all 28,729 HTTP compaction requests hadwindow_idinx-codex-turn-metadata, but only 73 retained the directx-codex-window-idheader. The request-bodyclient_metadatapath is already used for installation ID and is preserved through supported Responses API paths.This is additive metadata only. It does not change the direct header, request count, model input, compaction routing, window generation, or user response behavior.
Legacy
/v1/responses/compactis intentionally unchanged. Its current server-sideCompressBodyschema does not acceptclient_metadataand rejects unknown fields, so supporting that path requires a backend schema change before the Codex client can safely send this field.Validation
219baef3c, rebased ontoorigin/mainat26d932983.22insertions,6deletions); the legacy experiment remains fully reverted.just test -p codex-core responses_stream_includes_subagent_header_on_review: passed; validates normal HTTP Responses metadata.just test -p codex-core remote_compact_v2_reuses_compaction_trigger_for_followups: passed; validates remote compaction v2.just test -p codex-core remote_manual_compact_chatgpt_auth_reuses_service_tier_and_prompt_cache_key: passed; validates that legacy compact keeps its accepted payload shape.just test -p codex-core remote_manual_compact_api_auth_omits_service_tier_and_reuses_prompt_cache_key: passed; validates the legacy API-key payload as well.just fmt: passed; an unrelated rootjustfilerewrite produced by the formatter was discarded.git diff --check origin/main...HEAD: passed.The focused server pytest could not start in the local monorepo environment because test setup is missing the
dotenvmodule. Server source and tests explicitly show thatCompressBodyomitsclient_metadataand/v1/responses/compactreturns HTTP 400 for unknown body fields.