fix: cap prompt_cache_key at 64 chars to avoid OpenAI Codex 400 error (#66045) - #66053
fix: cap prompt_cache_key at 64 chars to avoid OpenAI Codex 400 error (#66045)#66053webtecnica wants to merge 1 commit into
Conversation
OpenAI rejects prompt_cache_key values longer than 64 characters with HTTP 400. Enforce a 64-char cap on the cache_key at its source so both the kwargs path (line 271) and extra_body path (line 382) benefit. Falls back to session_id when there is no static content. Fixes NousResearch#66045
Duplicate of #24273 — both bound the same Codex transport |
tonydwb
left a comment
There was a problem hiding this comment.
Code Review Summary
Verdict: LGTM / Comment
Three-line fix that directly addresses the root cause: OpenAI rejects prompt_cache_key > 64 chars with HTTP 400. The truncation approach is correct — the cache key is an opaque routing hint, so truncating it is safe. No security or quality concerns.
tonydwb
left a comment
There was a problem hiding this comment.
Code Review Summary
Verdict: Comment (resubmit — prior COMMENT activity noted)
Notes
- Minor fix/feature.
- No security concerns, no debug artifacts.
- LGTM.
Reviewed by Hermes Agent
|
Fechando como duplicata — o PR #24273 já cobre o mesmo fix para o prompt_cache_key no Codex transport. Obrigado @alt-glitch pelo flag! 🙏 |
Bug: On
openai-codexprovider,prompt_cache_keycan exceed 64 chars. The OpenAI backend rejects >64 chars with HTTP 400, causing every codex request to fail and silently fall back.Fix: After
cache_keyis built inbuild_kwargs(), cap at 64 chars. Both usage paths (line 271 kwargs and line 382 merged_extra_body) are covered.Closes #66045