fix(openai): omit prompt_cache_key for openai-compatible providers - #636
Conversation
Interactive TUI always has a session ID, so every completion request forwarded OpenAI's prompt_cache_key. Strict openai-compatible gateways (e.g. NVIDIA NIM) reject unknown fields with a 400, while plain zero exec usually has no session and omits the field. Disable prompt_cache_key for ProviderKindOpenAICompatible; keep it for official OpenAI. ZERO_DISABLE_PROMPT_CACHE_KEY remains a global kill switch. Fixes #624
Zero automated PR reviewVerdict: No blockers found Blockers
Validation
ScopeHead: This deterministic review checks validation status and basic diff hygiene. A human reviewer still owns product judgment and design quality. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (5)
WalkthroughChangesPrompt cache key routing
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Summary
prompt_cache_key.Unsupported parameter(s): prompt_cache_key, while plainzero execusually has no session and works.prompt_cache_keyforProviderKindOpenAICompatibleand keeps it for official OpenAI cache routing.ZERO_DISABLE_PROMPT_CACHE_KEY=1remains a global kill switch.Fixes #624
Changes
internal/providers/openai/provider.go— addDisablePromptCacheKeyoption and gate request mappinginternal/providers/factory.go— set the flag for openai-compatible profiles onlyTest plan
go test ./internal/providers/openai/ ./internal/providers/ -count=1 -run 'TestOpenAIRequestPromptCacheKey|TestPromptCacheKeyOnlyOnOfficialOpenAI'zeroagainst an openai-compatible provider (e.g. NIM) — send a prompt, noprompt_cache_keyvalidation errorprompt_cache_keywhen a session is presentZERO_DISABLE_PROMPT_CACHE_KEY=1still forces omit on OpenAISummary by CodeRabbit
Bug Fixes
prompt_cache_keyfield, preventing request rejections.Tests