fix(anthropic): guard tools event emission with truthiness check#4248
fix(anthropic): guard tools event emission with truthiness check#4248QuentinBisson wants to merge 2 commits into
Conversation
tools=NOT_GIVEN (the anthropic sentinel) is not None, so the previous is-not-None guard caused the sentinel to leak into the OTLP log body on tool-free requests. Use a truthiness check, matching the system check two lines above.
|
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughIn ChangesTools guard fix and regression test
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Possibly related issues
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 |
What
event_emitter.pychecksif kwargs.get("tools") is not None:before emittingtool
MessageEvents.anthropic.NOT_GIVEN(the sentinel used for omittedparameters) is not
None, so on tool-free requests the sentinel leaks into theOTLP log body.
Fix
Change the guard to
if kwargs.get("tools"):, matching thesystemtruthinesscheck two lines above.
Severity: observability-only — produces noisy/wrong log records, no functional
impact on the instrumented application.
Summary by CodeRabbit
Bug Fixes
Tests