Skip to content

fix(core): honor enabled=false in nested tracing #31986

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

hinthornw
Copy link
Collaborator

No description provided.

@hinthornw hinthornw requested a review from eyurtsev as a code owner July 11, 2025 21:37
Copy link

vercel bot commented Jul 11, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
langchain ⬜️ Ignored Preview Aug 11, 2025 10:39pm

@hinthornw hinthornw changed the title fix: Honor enabled:false in nested tracing fix: Honor enabled=false in nested tracing Jul 11, 2025
Copy link

codspeed-hq bot commented Jul 11, 2025

CodSpeed WallTime Performance Report

Merging #31986 will not alter performance

Comparing wfh/honor_context (3e3f8ba) with master (166c027)

⚠️ Unknown Walltime execution environment detected

Using the Walltime instrument on standard Hosted Runners will lead to inconsistent data.

For the most accurate results, we recommend using CodSpeed Macro Runners: bare-metal machines fine-tuned for performance measurement consistency.

Summary

✅ 13 untouched benchmarks

@hinthornw hinthornw changed the title fix: Honor enabled=false in nested tracing fix: honor enabled=false in nested tracing Jul 11, 2025
@hinthornw hinthornw changed the title fix: honor enabled=false in nested tracing fix(core): honor enabled=false in nested tracing Jul 11, 2025
Copy link

codspeed-hq bot commented Jul 11, 2025

CodSpeed Instrumentation Performance Report

Merging #31986 will not alter performance

Comparing wfh/honor_context (3e3f8ba) with master (166c027)

Summary

✅ 14 untouched benchmarks

@mdrxy mdrxy added the core Related to the package `langchain-core` label Jul 28, 2025
@mdrxy mdrxy changed the title fix(core): honor enabled=false in nested tracing fix(core): honor enabled=false in nested tracing Jul 28, 2025
@mdrxy mdrxy requested a review from Copilot July 29, 2025 13:09
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes a bug where the enabled=false parameter in nested tracing contexts was not being properly honored, allowing traces to be persisted when they should have been disabled.

Key changes:

  • Updated the LangSmithTracer to check tracing context enablement state and mark runs as disabled
  • Added early returns in persistence methods to skip disabled runs
  • Enhanced test coverage to verify nested tracing behavior with disabled contexts

Reviewed Changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated no comments.

File Description
libs/core/langchain_core/tracers/langchain.py Implements the core fix by checking tracing context state and skipping persistence for disabled runs
libs/core/tests/unit_tests/runnables/test_tracing_interops.py Adds test case to verify nested tracing with disabled context works correctly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Related to the package `langchain-core`
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants