Skip to content

fix(proxy-responses): adapt explicit prompt cache controls - #1565

Open
Komzpa wants to merge 2 commits into
Soju06:mainfrom
Komzpa:fix/subscription-prompt-cache-breakpoint-fallback-20260802
Open

fix(proxy-responses): adapt explicit prompt cache controls#1565
Komzpa wants to merge 2 commits into
Soju06:mainfrom
Komzpa:fix/subscription-prompt-cache-breakpoint-fallback-20260802

Conversation

@Komzpa

@Komzpa Komzpa commented Aug 1, 2026

Copy link
Copy Markdown
Collaborator

Summary

Prevent public explicit prompt-cache controls from causing 400 responses on
the Codex subscription upstream. The subscription egress now omits unsupported
controls while preserving prompt text, order, and prompt_cache_key; successful
fallbacks report their effective semantics in a response header.

Head: ecc281960393c1be719dcfb07236c0d19744f3ef

Type of change

  • fix: - bug fix (no behavior change beyond the bug)
  • feat: - new user-facing feature or capability
  • refactor: - internal refactor (no behavior change, no API change)
  • docs: - documentation only
  • chore: / ci: / build: - tooling, CI, packaging
  • test: - test-only change
  • Breaking change

Linked issue: None; this is a focused Responses compatibility regression.

OpenSpec

  • This PR includes / updates an OpenSpec change
  • Not applicable - bug fix that matches the existing spec
  • Not applicable - docs / CI / chore only
  • This PR touches a codex-faithful path and preserves upstream-equivalent behavior

Change directory: openspec/changes/adapt-subscription-prompt-cache-controls/

The intentional divergence is limited to Codex subscription egress, whose
upstream rejects these public API controls. OpenAI-compatible model-source
egress keeps the public request unchanged.

Changes

  • Strip prompt_cache_options and supported content-block
    prompt_cache_breakpoint fields only during subscription serialization.
  • Preserve explicit controls for OpenAI-compatible model sources.
  • Return X-Codex-LB-Prompt-Cache-Mode: subscription-implicit after a
    successful subscription fallback so clients can observe the semantic
    downgrade.
  • Cover both routes with unit and /v1/responses integration regressions.

Simplicity

  • Works with zero configuration.
  • Adds no required setup step or setting.
  • New settings: none.
  • Adds no README section, .env.example entry, or dashboard navigation.

Test plan

uv run pytest tests/unit/test_strict_schema_validation.py tests/integration/test_openai_compat_features.py
# 89 passed

make lint
# proxy architecture checks passed; Ruff check and format check passed across 858 files

uv run ty check
# All checks passed

uv run openspec validate adapt-subscription-prompt-cache-controls --strict
# Change is valid

uv run pre-commit run local-ci --hook-stage manual --all-files
# passed

Output

A successful subscription request containing an explicit cache breakpoint now
returns:

X-Codex-LB-Prompt-Cache-Mode: subscription-implicit

The corresponding subscription wire payload retains prompt_cache_key and
content but omits the unsupported explicit controls. The model-source negative
control retains all three fields and does not return the fallback header.

Checklist

  • Title is in Conventional Commits format.
  • No related public issue exists.
  • Added tests covering the change.
  • Ran the relevant local CI gate.
  • Strict OpenSpec validation passes.
  • Simplicity gates reviewed.
  • CHANGELOG.md is unchanged.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@Komzpa

Komzpa commented Aug 2, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

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