Repository navigation
fix(server-utils): Cap the runs the LangChain callback handler keeps open - #25595
Open
RulaKhaled wants to merge 2 commits into
Open
RulaKhaled wants to merge 2 commits into
RulaKhaled wants to merge 2 commits into
Conversation
…open `@langchain/core` never calls the end or error callback when a consumer stops reading a stream, so those runs stayed in the shared handler's map forever. The map is now an `LRUMap` capped at 1000 runs. An evicted run is dropped without ending its span, since ending it would send a span that lasted until eviction. Fixes #25510 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
size-limit report 📦Compared: 538a908 (PR test merge using develop at 2028b68) Against: d250a38 (develop) · base run #62866
|
Collaborator
Author
|
bugbot run |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 596ad0a. Configure here.
RulaKhaled
marked this pull request as ready for review
October 21, 2026 09:23
RulaKhaled
requested review from
andreiborza and
isaacs
and removed request for
a team
October 21, 2026 09:23
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
@langchain/corenever calls the end or error callback when a consumer stops reading a stream. The handler is shared across the process, so those runs stay in its map forever, each keeping its request's span tree in memory.The map is now an
LRUMapcapped at 1000 runs. An evicted run is dropped without ending its span, since ending it would send a span that lasted until eviction. Starting a run marks its ancestors as used, so a busy agent run isn't dropped.Fixes #25510
🤖 Generated with Claude Code