Skip to content

Conversation

jacoblee93
Copy link
Collaborator

Previously the callback manager would always prefer the implicit parent ids, which flattened deeply nested runnables within traceables.

@jacoblee93 jacoblee93 requested review from dqbd and hntrl September 5, 2025 04:53
Copy link

changeset-bot bot commented Sep 5, 2025

🦋 Changeset detected

Latest commit: ae3acfa

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@langchain/core Patch
@langchain/standard-tests Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

vercel bot commented Sep 5, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
langchainjs-docs Ready Ready Preview Comment Sep 5, 2025 7:09pm
1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
langchainjs-api-refs Ignored Ignored Sep 5, 2025 7:09pm

const tracerV2 = callbackManager.handlers.find(
(handler) => handler.name === "langchain_tracer"
) as LangChainTracer;
tracerV2?.updateFromRunTree(implicitRunTree);
Copy link
Collaborator Author

@jacoblee93 jacoblee93 Sep 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previously this was always setting callbackManager._parentRunId to the implicit traceable value, so runs would get flattened

Before #8849, this only applied in the case where a LangChainTracer was instantiated automatically, which happens if it is not manually passed and environment variables are set. My fix in #8849 for cases where a tracer is passed manually caused this reparenting logic to apply even if the tracer were already present, exposing the issue

This change only applies the reparenting on the initial handoff from LangSmith to LangChain (if there's no already existing parent id on the callback manager and there is an implicit one from a wrapping LangSmith traceable). The reverse handoff is handled in langsmith traceable

});
expect(thirdCallParams).toMatchObject({
end_time: expect.any(Number),
inputs: {
Copy link
Collaborator Author

@jacoblee93 jacoblee93 Sep 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing inputs in these tests is a side-effect of bumping langsmith - we made an optimization to stop unnecessarily double-sending inputs in the second update call for a run when they were not changing.

@hntrl hntrl changed the base branch from main to hunter/fix/milvus-mocks September 5, 2025 18:53
Base automatically changed from hunter/fix/milvus-mocks to main September 5, 2025 18:59
@hntrl hntrl merged commit d6d841f into main Sep 5, 2025
44 checks passed
@hntrl hntrl deleted the jacob/tracing branch September 5, 2025 19:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants