fix: guard cache_breakpoint marking behind is_anthropic check#5971
fix: guard cache_breakpoint marking behind is_anthropic check#5971fedyaahmed135-star wants to merge 1 commit into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughTwo agent executor implementations now conditionally apply Anthropic-specific cache breakpoint markers only when the LLM provider is Anthropic, preventing non-Anthropic providers (Groq, OpenAI-compatible) from receiving unsupported cache_breakpoint fields in message dictionaries. ChangesAnthropic-conditional cache breakpoint wrapping
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Suggested labels
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
Fixes #5886
Problem
mark_cache_breakpoint()is called unconditionally increw_agent_executor.pyfor every LLM provider. Thecache_breakpointflag is a CrewAI-internal marker that only the Anthropic provider adapter knows how to translate and strip before the API call.Every other provider — Groq, OpenAI-compatible endpoints, Bedrock, Gemini, LiteLLM — receives
cache_breakpoint: Truein the raw message dict and rejects the request with400 Bad Request.Root cause
mark_cache_breakpoint()was imported and called unconditionally. Onlyllms/providers/anthropic/completion.pystrips this flag — no other provider does.Fix
Added
use_cache_breakpointguard that checksself.llm.is_anthropicbefore callingmark_cache_breakpoint(). WhenFalse, a no-op_maybe_mark()is used instead.Applied to both:
agents/crew_agent_executor.pyexperimental/agent_executor.pyResult
cache_breakpointfield, requests succeedSummary by CodeRabbit