fix(codex): enable 24h prompt cache retention on Bedrock Mantle - #70083
fix(codex): enable 24h prompt cache retention on Bedrock Mantle#70083israellot wants to merge 5 commits into
Conversation
OpenAI documents GPT-5.5 / GPT-5.5 Pro as extended-cache-only: in-memory prompt cache retention is not available for them, and only prompt_cache_retention: "24h" is supported. Responses requests that omit the field see near-zero cached_tokens even with a stable prompt_cache_key and identical prefixes (observed on an OpenAI-compatible Responses relay: 0 cached across repeated identical calls before; 97% cache reads after). Send the field for the gpt-5.5 model family (bare and namespaced ids like openai.gpt-5.5) on OpenAI-compatible Responses routes, mirrored in the auxiliary Codex adapter, and pass it through preflight normalization. Skipped for xAI, GitHub/Copilot, and the chatgpt.com Codex backend, which reject or ignore body-level cache fields.
|
Scope update: the automatic This positive endpoint gate supersedes the earlier broad compatible-endpoint behavior. Direct OpenAI, Azure OpenAI, GitHub Models, Copilot, xAI, ChatGPT Codex, and arbitrary compatible relays do not receive the automatic field. |
|
suggesting changes
An invocation-level adapter probe emitted no retention field on current main, Security evidence:
Signed: GPT-5.6-sol-xhigh in Codex |
|
Addressed in ecd2e92.
Verification:
Result: 407 passed, 0 failed across both focused test files. |
|
suggesting changes The auxiliary Responses path still sends The exact PR patch replayed cleanly on current main, the supported relay and namespaced GPT-5.5 Pro cases emitted Security evidence:
Signed: GPT-5.6-sol-xhigh in Codex |
|
Addressed in f89b2f3.
Verification:
Result: 408 passed, 0 failed across both focused test files (includes the new negative case). |
|
looks mergeable The latest commit addresses the remaining auxiliary GitHub Models gap: The exact PR head passed the two focused test files (408 tests), and the patch replayed cleanly onto current main where the same files passed 440 tests. A direct transport probe on that replay emitted Security evidence:
Signed: GPT-5.6-sol-xhigh in Codex |
|
Superseded by 3c07966. The implementation now uses a positive endpoint capability gate: automatic 24-hour retention is emitted only for supported models on Focused result: 544 tests passed, 0 failed. |
|
Narrowed the fix in 3c07966. Instead of maintaining a denylist of incompatible Responses endpoints, the transport now automatically sends
This means GitHub Models, Copilot, xAI, ChatGPT Codex, direct OpenAI, Azure OpenAI, custom relays, and spoofed host/path forms are excluded by default. Main and auxiliary request paths share the same gate. Verification: 544 tests passed, 0 failed, plus the Windows-footgun scan and |
|
suggesting changes
The current-main invocation omits the field; this head's replay emits and preserves it through preflight. The 576 focused tests pass, but they only prove request construction, not that Mantle accepts the field or provides 24-hour retention. Please remove the injected parameter, or add authoritative AWS contract evidence plus a Mantle-level regression/E2E showing that the field is accepted and produces the claimed retention behavior. Security evidence:
Signed: GPT-5.6-sol-xhigh in Codex |
|
Merged via #70992 with your authorship preserved on all three commits — 24h retention scoped to Bedrock Mantle supported models with the models.github.ai auxiliary exclusion. Thanks for working through the review rounds. |
What & why
Amazon Bedrock Mantle supports extended prompt-cache retention for documented pre-GPT-5.6 models, but Hermes' Responses transport did not select it. At the same time,
prompt_cache_retentionis not part of every OpenAI-compatible Responses implementation; automatically sending it to endpoints such as GitHub Models can cause compatibility failures.This PR deliberately applies the automatic
prompt_cache_retention: "24h"default only when both conditions hold:bedrock-mantle.<region>.api.aws.Other endpoints—including direct OpenAI, Azure OpenAI, xAI, GitHub Models, Copilot, ChatGPT Codex, and arbitrary compatible relays—do not receive the automatic field.
Implementation
Models
The model gate covers the documented extended-retention set: GPT-5.5/Pro, GPT-5.4, GPT-5.2, GPT-5.1 and its listed variants, GPT-5/Codex, and GPT-4.1, including provider-prefixed and dated IDs. GPT-5.6+ and unknown model families remain excluded.
Tests
Result: 544 passed, 0 failed.
Also verified: