Skip to content

fix(responses): drop the retired prompt_cache_retention for gpt-5.6 - #2138

Open
lidge-jun wants to merge 1 commit into
devfrom
codex/consolidate-prompt-cache-retention
Open

fix(responses): drop the retired prompt_cache_retention for gpt-5.6#2138
lidge-jun wants to merge 1 commit into
devfrom
codex/consolidate-prompt-cache-retention

Conversation

@lidge-jun

@lidge-jun lidge-jun commented Aug 19, 2026

Copy link
Copy Markdown
Owner

Summary

The ChatGPT backend rejects a gpt-5.6 request that still carries prompt_cache_retention with 400 Unsupported parameter (#2092, reproduced 3/3 by the reporter: field present → 400, field omitted → 200). GPT-5.6 replaced it with prompt_cache_options.ttl.

This strips the retired field on the canonical ChatGPT forward path, for the gpt-5.6 family only.

Credit: the implementation is @lilinxiong's from #2102, which had the right contract of the three proposals. @yzxcj797's #2099 contributed the Fixes #2092 link and the repro-shaped fixture. @luvs01's #2091 raised the same defect.

Why the narrowness is the fix

Two deliberate limits, each pinned by a test that a wider strip would fail:

  • Model: exact gpt-5.6 or a dashed gpt-5.6-* prefix. A bare startsWith("gpt-5.6") also matches a future gpt-5.60, silently changing an unrelated model.
  • Backend: canonical ChatGPT forward only. A self-hosted or third-party forward gateway may still honor the field; the issue reporter explicitly withdrew the broader "never send it anywhere" claim, and tests/openai-responses-passthrough.test.ts:807 already pins that a gpt-5.5 forward request keeps it.

The retired value is not translated into prompt_cache_options. 5.6 carries a different TTL contract and implicit caching still applies when the caller sent no replacement options, so synthesizing one would change a caching decision the caller never made.

Verification

  • Extended tests/openai-responses-passthrough.test.ts, driven RED first: reverting only the adapter change fails 5 of the new tests. The two narrowness guards (gpt-5.60, noncanonical gateway) stay green in both directions, which is what proves they are guards rather than restatements.
  • bun test --isolate tests — 13,537 pass, 0 fail, 10 skip (855 files).
  • bun test --isolate tests/openai-responses-passthrough.test.ts — 75 pass, 0 fail.
  • bun run typecheck — clean.
  • bun run privacy:scan — passed.

Supersedes

Once this lands, #2102, #2099, and #2091 are all resolved by it. I will close them with attribution rather than leaving three open PRs for one defect.

Note: #2092's intermittent 400s on bodies that already lacked the field are not addressed here and remain open — that is a separate backend/retry question, and widening the strip would not fix it.

Checklist

  • Scope stays focused and avoids unrelated cleanup.
  • Docs or release notes were updated when needed. (No user-facing documented behavior: a request that previously 400'd now succeeds.)
  • Security-sensitive changes were reviewed for secrets, auth, and unsafe defaults. (Removes one request field on one backend; no auth, credential, or workflow surface touched. Privacy scan green.)

Closes #2092

Summary by CodeRabbit

  • Bug Fixes
    • Updated requests for the gpt-5.6 model family to omit the retired prompt cache retention setting when using the canonical OpenAI backend.
    • Preserves replacement prompt cache options provided by callers.
    • Keeps existing behavior for other models and compatible third-party gateways.

The ChatGPT backend 400s a gpt-5.6 request that still carries
prompt_cache_retention: "Unsupported parameter". GPT-5.6 replaced the field
with prompt_cache_options.ttl.

Strip it on the canonical ChatGPT forward path for the gpt-5.6 family only.
The retired value is not translated into the replacement field: 5.6 carries a
different TTL contract and implicit caching still applies, so inventing one
would change a caching decision the caller never made.

The narrowness is the fix, not an omission. An older model may still honor the
field, and a self-hosted or third-party forward gateway may still accept it, so
both axes are pinned by non-match tests.

Based on @lilinxiong's implementation in #2102, with an exact-or-dashed-prefix
family match so a future gpt-5.60 is not swept up.

Closes #2092
@lidge-jun
lidge-jun requested a review from Ingwannu as a code owner August 19, 2026 18:16
@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.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@github-actions github-actions Bot added the bug Something isn't working label Aug 19, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Deterministic PR hygiene checks passed.

@coderabbitai

coderabbitai Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 4869c43c-0a7e-40c6-bddc-f43f3da81865

📥 Commits

Reviewing files that changed from the base of the PR and between 890d339 and 5904178.

📒 Files selected for processing (2)
  • src/adapters/openai-responses.ts
  • tests/openai-responses-passthrough.test.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 5 remain after this review.


📝 Walkthrough

Walkthrough

The passthrough adapter removes prompt_cache_retention for canonical OpenAI forward requests using gpt-5.6 or dashed variants. Tests cover replacement options, exact model matching, and noncanonical provider behavior.

Changes

GPT-5.6 prompt-cache retention handling

Layer / File(s) Summary
Sanitizer and canonical forwarding
src/adapters/openai-responses.ts
Lines 188–209 add a sanitizer for gpt-5.6 and gpt-5.6-*. Lines 1516–1520 apply it only to canonical OpenAI forward requests.
Model and provider regression coverage
tests/openai-responses-passthrough.test.ts
Lines 825–909 verify supported variants, preserve caller-provided prompt_cache_options, exclude gpt-5.60, and retain the field for noncanonical gateways.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to 59041

The change narrowly removes an unsupported field for the gpt-5.6 ChatGPT forwarding path, with the affected behavior covered by tests and no actionable merge-blocking risk remaining after normal checks and review.

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant OpenAIResponsesPassthroughAdapter
  participant ChatGPTCodexBackend
  Client->>OpenAIResponsesPassthroughAdapter: Send gpt-5.6 request with prompt_cache_retention
  OpenAIResponsesPassthroughAdapter->>OpenAIResponsesPassthroughAdapter: Remove deprecated retention field
  OpenAIResponsesPassthroughAdapter->>ChatGPTCodexBackend: Forward sanitized request
Loading

Suggested labels: review-ready

Suggested reviewers: ingwannu

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the adapter fix: removing the retired prompt_cache_retention field for gpt-5.6 models.
Linked Issues check ✅ Passed The implementation strips prompt_cache_retention for the required gpt-5.6 canonical backend path and adds tests for the issue’s boundaries.
Out of Scope Changes check ✅ Passed The changes are limited to the targeted adapter behavior and focused regression tests described in Issue #2092.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/consolidate-prompt-cache-retention

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.

@lidge-jun

Copy link
Copy Markdown
Owner Author

리뷰 · 우선순위 64 / 80

#2092의 재현 반쪽임. 필드 있으면 400, 없으면 200. 지금 devprompt_cache_retention을 패스스루로 그대로 보냄. tests/openai-responses-passthrough.test.ts:807이 gpt-5.5 forward가 필드를 지킨다고 단언함. gpt-5.6 패밀리는 ChatGPT 백엔드가 거절함. prompt_cache_options.ttl로 안 바꿈. 호출자가 안 보낸 TTL을 합성하면 캐시 결정이 바뀜. 그 제한이 맞음.

좁힌 두 가드가 포인트임. 모델은 exact gpt-5.6이거나 gpt-5.6-*. startsWith("gpt-5.6")gpt-5.60을 삼킴. 백엔드는 canonical ChatGPT forward만. 셀프호스트 게이트웨이는 필드를 아직 먹을 수 있음. 리포터도 전역 strip을 철회했음. 테스트가 어댑터만 되돌리면 5개 빨개지고, 두 가드는 양방향 초록.

#2102가 구현을 가져왔고 #2099가 Fixes 링크, #2091이 같은 결함. 이 PR이 그 셋을 흡수함. 세 개 열어두지 말고 이걸로 닫으면 됨. types.ts/config.ts 안 건드림. 닫고 리베이스하라는 쪽 아님.

Closes #2092는 과함. 본문이 필드 없는 간헐 400은 안 고친다고 적음. 그건 백엔드/리트라이임. 이슈를 쪼개거나 Closes 대신 필드-present만 닫는 게 맞음.

해결방안: 머지하고 #2102 #2099 #2091은 닫음. #2092는 간헐 400 남으면 열어 두거나 후속 이슈로 자름. 2.27에 넣어도 됨. 범위가 어댑터 한 파일임.

이 댓글은 grok-bot이 작성했습니다

@Ingwannu Ingwannu left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The implementation scope is correct: it strips only exact/dashed-prefix gpt-5.6 models on the canonical ChatGPT forward backend, preserves gpt-5.5, preserves noncanonical forward gateways, and does not invent prompt_cache_options.

I am requesting one integration update before approval: the current head 5904178c349c is 22 commits behind the current dev head caf20353f, so the green jobs validate the old base at 890d339dec9f. Please rebase onto the latest dev and rerun required CI on the new exact head. Keep the current narrow predicate and tests unchanged in scope.

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.

2 participants