Skip to content

fix(sdk): don't send children of a traceable run that isn't sent - #118

Open
Caio Theodoro (caiotheodoro) wants to merge 1 commit into
langchain-ai:mainfrom
caiotheodoro:fix/traceable-explicit-parent
Open

Caio Theodoro (caiotheodoro) wants to merge 1 commit into
langchain-ai:mainfrom
caiotheodoro:fix/traceable-explicit-parent

Conversation

@caiotheodoro

@caiotheodoro Caio Theodoro (caiotheodoro) commented Nov 22, 2026 •

Copy link
Copy Markdown

Fixes #117

When _setup_run doesn't send a run and the context has no tracing flag, it now stores the answer it got in the run's context. Nested runs then get the same answer and aren't sent under a parent that never arrives. The run itself behaves as before.

I went with skipping the children because test_client_not_passed_when_traceable_parent already pins the parent as not sent. Happy to flip it if sending both is the intended behaviour.

The new test_children_not_sent_when_traceable_parent[run_tree|headers] fails on main (assert 1 == 0, from the child's POST). scripts/test (3775 passed) and scripts/lint are green.

Drafted with Devin (Claude Opus 5.5, SWE-2).

With LANGSMITH_TRACING unset, a @Traceable called with
langsmith_extra={"parent": ...} builds its run but does not send it.
The run is still the current run inside the call, so nested traceables
take tracing_is_enabled() as true and send themselves with a
parent_run_id that never reaches LangSmith.

When a run is not sent and the context does not set tracing, store the
answer the run got in its context so its children get the same one.
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.

@traceable with langsmith_extra={"parent": ...} and tracing off sends its child runs but not itself

1 participant