Skip to content

fix(responses): handle Codex 0.164 request controls - #7473

Merged
lidge-jun merged 2 commits into
devfrom
fix/codex-0164-request-compat
Oct 21, 2026
Merged

lidge-jun merged 2 commits into
devfrom
fix/codex-0164-request-compat

Conversation

@lidge-jun

@lidge-jun lidge-jun commented Oct 21, 2026 •

Copy link
Copy Markdown
Owner

Summary

Codex 0.164 (openai/codex 816fa702..af91f6ef2c) changes three things on the request side. This PR makes opencodex handle each one.

configuration_update input item (ResponseItem::ConfigurationUpdate, {type: "configuration_update", reasoning: {effort}}). This is a durable reasoning-effort control that the backend interprets at its position in history. Codex sends it whenever its provider identity is openai, which loopback injection always satisfies, and only for catalog rows with supports_reasoning_effort_updates.

  • Before: GPT‑6 roster rows set that flag, and routed rows cloned from them kept it. A routed Responses gateway would get the item verbatim and reject the whole body as an unknown item type. A trailing update after an agent_message also hid the task from the encrypted-task guard and recovery, because both walkers stop at the first unrecognized tail item.
  • After: OpenAI-operated destinations (canonical ChatGPT and api.openai.com) receive the item verbatim and in order. Other Responses gateways get the conversation without it, through a new CANONICAL_ONLY_INPUT_ITEM_TYPES table applied in both the passthrough and the native /responses/compact gateway replay. The translated parser drops it without clearing pending reasoning. The tail walkers skip it the way they skip compaction_trigger. normalizeRoutedCatalogEntry removes supports_reasoning_effort_updates from routed rows. Upstream declares that field #[serde(default)] and documents that missing metadata keeps effort changes on the ordinary request parameter. The native row and the exact Codex-forward alias keep it.
  • The effort value is not mapped onto routed requests; that needs a separate decision ([Feature]: Keep the Anthropic prompt cache across mid-conversation reasoning effort changes (per-message effort) #6895).

prompt_cache_key policy (openai/codex#55587). Hosts can keep the session-derived key, send a Custom key, or Omit the field. Session and thread headers stay the same, and sub-agents inherit the policy. An audit found nothing broken: lineage cohorts, pool affinity, OAuth affinity and request-log conversation ids all key on the session-id/thread-id headers. Every adapter forwards the key only when the caller sent one. Cache diagnostics record an absent key as present: false and only compare when both sides have one. New tests pin this end to end through handleResponses:

  • On the native route, each policy is sent verbatim with identical identity headers and the same logged conversation id.
  • A sub-agent that inherits Omit keeps its headers, log identity, and its root's lineage/affinity cohort.
  • On the translated Chat route, a Custom key is forwarded and an omitted key stays omitted.
  • Cache diagnostics record Omit as absent on both sides, with no mismatch.

voice-session-id (openai/codex#53784). This is the client voice session id, distinct from the realtime x-session-id. It is added to LIVE_CLIENT_PROTOCOL_HEADERS, so it is relayed on call-create and the sideband join only when the caller sent it.

Provenance metadata (openai/codex#53831) needed no change. Upstream sends per-content content_item_metadata only for use_responses_lite rows, inside internal_chat_message_metadata_passthrough. Routed rows and pre‑5.6 natives already drop use_responses_lite. Noncanonical Responses destinations already strip that whole block unless preserveResponsesMessageMetadata is set. The new gateway test asserts it with a content_item_metadata payload.

sci/sci_plus are out of scope (covered by #7444).

Verification

  • bun run typecheck: pass
  • bun run privacy:scan: pass
  • bun run structure:check: pass
  • bun test tests/responses/codex-0164-request-compat.test.ts (new, 9 cases), tests/server/server-live.test.ts, tests/codex-integration/codex-model-entitlements-program-shape.test.ts, tests/test-layout.test.ts, tests/test-layout-tooling.test.ts: pass
  • With the src/ changes stashed, the gateway strip, tail-walker, live-header and routed-catalog cases fail. The prompt_cache_key cases pass either way, as expected for regression pins on behavior that was already correct.
  • bun run test:changed: 34309 pass / 42 skip / 0 fail (1530 files)
  • bun run test: run under the machine lock. It reported two failures. One was the file-size ratchet: registering the new file pushed scripts/test-layout/layout.json to 2000 lines. Fixed in 019cbc79a by folding the entry onto an existing line; the ratchet and layout guards were rerun green. The other is claude-desktop-remote-hub.test.ts > connected Desktop uses hub IDs across a cold restart (stored profile=false), which fails the same way on an unmodified origin/dev checkout (845ac6b87) on this machine and passes in CI. The full suite was not rerun after the one-line layout fix.
  • CI on 019cbc79a: all required checks pass, including test shards 1–4 (https://github.com/lidge-jun/opencodex/actions/runs/39584927669)

Checklist

  • Scope stays focused and avoids unrelated cleanup.
  • Docs or release notes were updated when needed. (proxy-formats.md en/ko relayed-header list; structure/transports/responses.md)
  • Security-sensitive changes were reviewed for secrets, auth, and unsafe defaults. (No auth or CORS change; the live relay list remains send-only-when-present.)

Summary by CodeRabbit

  • New Features

    • Added support for forwarding the optional voice-session-id header in live and realtime connections.
    • Updated proxy-format documentation to describe voice session identification separately from realtime session identification.
  • Bug Fixes

    • Improved compatibility for Codex 0.164 requests across OpenAI and third-party Responses gateways.
    • Prevented provider-specific configuration updates from being incorrectly forwarded or applied to unsupported routed models.
    • Preserved request identity, cache behavior, reasoning state, and agent-task recovery across supported request paths.

Codex 0.164 adds a positional configuration_update input item, a
prompt_cache_key Omit/Custom policy, and a voice-session-id realtime
header.

- Strip configuration_update for Responses gateways OpenAI does not
  operate (passthrough and native compact replay); OpenAI-operated
  destinations keep it verbatim and in order.
- Drop it explicitly in the translated parser and skip it in the
  agent-task tail walkers so a trailing update cannot hide the task.
- Stop routed catalog rows inheriting supports_reasoning_effort_updates
  from GPT-6 templates, so Codex keeps effort on the request parameter.
- Relay voice-session-id on live call-create and sideband join.
- Pin prompt_cache_key SessionDerived/Custom/Omit across native,
  translated, cache-diagnostic, lineage and log-identity paths.
@coderabbitai

coderabbitai Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: lidge-jun/opencodex/.coderabbit.yaml
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 44ab163a-2235-4741-8fbe-cfd06ac1fe3b
📥 Commits

Reviewing files that changed from the base of the PR and between 845ac6b and 019cbc7.

📒 Files selected for processing: 16
  • docs-site/src/content/docs/ko/reference/proxy-formats.md
  • docs-site/src/content/docs/reference/proxy-formats.md
  • scripts/test-layout/layout.json
  • src/adapters/openai-responses/passthrough.ts
  • src/adapters/openai-responses/request-strips.ts
  • src/codex/catalog/parsing.ts
  • src/responses/parser.ts
  • src/server/live.ts
  • src/server/responses/agent-task-recovery.ts
  • src/server/responses/compact.ts
  • src/server/responses/encrypted-payload.ts
  • structure/transports/responses.md
  • tests/codex-integration/codex-model-entitlements-program-shape.test.ts
  • tests/fixtures/test-layout-expected.json
  • tests/responses/codex-0164-request-compat.test.ts
  • tests/server/server-live.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.

📝 Walkthrough

The changes add handling for Codex 0.164 configuration updates across Responses routing and parsing, add compatibility coverage for request behavior, and forward the optional voice-session-id header in live relays.

Changes: Codex 0.164 request compatibility

Layer / File(s) Summary
Outbound request handling
src/adapters/openai-responses/request-strips.ts, src/adapters/openai-responses/passthrough.ts, src/server/responses/compact.ts, src/codex/catalog/parsing.ts
A shared sanitizer removes canonical-only input items from non-OpenAI requests. Routed catalog entries no longer retain supports_reasoning_effort_updates.
Translated parsing and task recovery
src/responses/parser.ts, src/server/responses/agent-task-recovery.ts, src/server/responses/encrypted-payload.ts
Translated parsing skips configuration_update without clearing pending reasoning. Agent-task scans skip the item when locating the latest agent message.
Compatibility validation and documentation
tests/responses/codex-0164-request-compat.test.ts, tests/codex-integration/codex-model-entitlements-program-shape.test.ts, tests/fixtures/test-layout-expected.json, scripts/test-layout/layout.json, structure/transports/responses.md
Tests cover cache-key behavior, destination-specific configuration-update handling, parsing, and agent-task recovery. The transport documentation and test-layout mappings are updated.

Live voice session header

Layer / File(s) Summary
Live header forwarding
src/server/live.ts, tests/server/server-live.test.ts, docs-site/src/content/docs/reference/proxy-formats.md, docs-site/src/content/docs/ko/reference/proxy-formats.md
The live relay forwards voice-session-id when supplied. Tests cover forwarding and omission; the documentation distinguishes it from x-session-id.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Bug fix

Suggested reviewers: ingwannu

Merge Risk: ⚪ Minimal · up to 019cb

No merge-blocking issue was identified; the reviewed compatibility and live-header changes are ready to merge after normal checks.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 15.38% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 13 functions across 11 files. (5 skipped:… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title accurately identifies the primary change: compatibility handling for Codex 0.164 request controls. It is concise, specific, and covers the configuration updates, prompt cache policies, and v…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title accurately identifies the primary change: compatibility handling for Codex 0.164 request controls. It is concise, specific, and covers the configuration updates, prompt cache policies, and voice-session handling without unnecessary detail.

Full details: Docstring Coverage

Explanation

Docstring coverage is 15.38% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 13 functions across 11 files. (5 skipped: 5 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown
Contributor

✅ Deterministic PR hygiene checks passed.

@github-actions github-actions Bot added the bug Something isn't working label Oct 21, 2026
@lidge-jun
lidge-jun marked this pull request as ready for review October 21, 2026 10:41
@lidge-jun
lidge-jun requested a review from Ingwannu as a code owner October 21, 2026 10:41
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-21T10:44:23.477843Z 019cbc7 Draft marked ready
ℹ️ 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.

@lidge-jun

Copy link
Copy Markdown
Owner Author

Merged with owner authority per maintainer decision 2026-10-21 (jun): the project owner authorized owner-path (--admin) merges for the pending green PRs after the 2.90.0 release; no second-maintainer approval is available.

Exact-head verification on 019cbc79aef1ec93887bb9f3a10579b21f64f607: all checks completed with no failures, the PR is mergeable, there are no change requests, and no unresolved current Major/Critical/P0/P1 review threads. A local squash of this head onto current dev cdcd39ed4 passed typecheck, structure:check, the file-size, import-cycle and test-layout ratchets, and this PR's own tests ( 173 pass 0 fail ). The merge is a squash pinned with --match-head-commit.

@lidge-jun
lidge-jun merged commit 561347c into dev Oct 21, 2026
40 of 41 checks passed
@lidge-jun
lidge-jun deleted the fix/codex-0164-request-compat branch October 21, 2026 13:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant