fix(langchain): remove orphaned context_api.attach() in on_chain_end#4100
Conversation
|
Caution Review failedAn error occurred during the review process. Please try again later. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (2)
💤 Files with no reviewable changes (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThe PR removes an orphaned context_api.attach() in TraceloopCallbackHandler.on_chain_end that previously set SUPPRESS_LANGUAGE_MODEL_INSTRUMENTATION_KEY without detaching. It adds two regression tests ensuring the suppression context key is not left attached or accumulated across root chains. ChangesContext Stack Corruption Fix
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Suggested reviewers
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)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. 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 |
doronkopit5
left a comment
There was a problem hiding this comment.
can yuu add some reproduce test for this, a test that fails without your code
|
recheck |
11b718c to
226d5dd
Compare
Fixes #3526.
The SUPPRESS_LANGUAGE_MODEL_INSTRUMENTATION_KEY=False attach at the end
of on_chain_end() was redundant — _end_span() already detaches the
suppression token via SpanHolder. The orphaned attach was corrupting
the OTel context stack on every root chain completion.
Summary by CodeRabbit