Title: LangChain: explicit callback handler produces flat spans and drops the conversation id on chain and tool spans · Issue #25327 · getsentry/sentry-javascript · GitHub
Open Graph Title: LangChain: explicit callback handler produces flat spans and drops the conversation id on chain and tool spans · Issue #25327 · getsentry/sentry-javascript
X Title: LangChain: explicit callback handler produces flat spans and drops the conversation id on chain and tool spans · Issue #25327 · getsentry/sentry-javascript
Description: Found while writing the test in #25326. Both show up with `Sentry.createLangChainCallbackHandler()` passed explicitly, and both behave the same on `@langchain/core` 1.2.16 and 1.2.17. Flat spans. A runnable that calls a tool, which then ...
Open Graph Description: Found while writing the test in #25326. Both show up with `Sentry.createLangChainCallbackHandler()` passed explicitly, and both behave the same on `@langchain/core` 1.2.16 and 1.2.17. Flat spans. A...
X Description: Found while writing the test in #25326. Both show up with `Sentry.createLangChainCallbackHandler()` passed explicitly, and both behave the same on `@langchain/core` 1.2.16 and 1.2.17. Flat spans. A...
Opengraph URL: https://github.com/getsentry/sentry-javascript/issues/25327
X: @github
Domain: github.com
IPv4 address: 140.82.112.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"LangChain: explicit callback handler produces flat spans and drops the conversation id on chain and tool spans","articleBody":"Found while writing the test in #25326. Both show up with \\`Sentry.createLangChainCallbackHandler()\\` passed explicitly, and both behave the same on \\`@langchain/core\\` 1.2.16 and 1.2.17.\n\n**Flat spans.** A runnable that calls a tool, which then runs a nested chain and model, produces \\`invoke_agent outer\\`, \\`execute_tool lookup_weather\\`, \\`invoke_agent nested_chain\\` and the chat span as siblings under the caller's span. The handler ignores \\`parentRunId\\` and parents each span to whatever span is active, and the run spans it starts never become active. The trace loses which tool made which model call.\n\n**No conversation id on chain and tool spans.** \\`handleChainStart\\` and \\`handleToolStart\\` read \\`gen_ai.conversation.id\\` from run metadata. Since core 1.1.40, \\`configurable\\` is only copied into metadata for LangSmith tracers, so on 1.x those spans never get \\`thread_id\\` or \\`sessionId\\`. Chat spans still get it, because the integration copies the id onto the model call options (\\`getConversationIdMetadataFromConfig\\`).\n\nThe scenario in #25326 (\\`suites/tracing/langchain/v1/scenario-nested-runtime-context.mjs\\`) reproduces both.","author":{"url":"https://github.com/RulaKhaled","@type":"Person","name":"RulaKhaled"},"datePublished":"2026-10-13T12:14:51Z","url":"https://github.com/getsentry/sentry-javascript/issues/25327"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:3c94d677-1453-10c0-6b51-264baecce2bf |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C56C:25A901:19C911:22AC91:6B043007 |
| html-safe-nonce | 5322bceeb8d784fe402b1a490aa836e3caacdc4617966df71c705532c631387c |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDNTZDOjI1QTkwMToxOUM5MTE6MjJBQzkxOjZCMDQzMDA3IiwidmlzaXRvcl9pZCI6IjY1OTY1MjU1Nzg5MTUxNjQxNjciLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | ae0035e7aee39994ecba24e46d4a0e4f6c9c86f448b856850662b25c17314a8b |
| hovercard-subject-tag | issue:5830109468 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/getsentry/sentry-javascript/25327/issue_layout |
| twitter:image | https://opengraph.githubassets.com/d6a20e1a3bca93a98f8492bd4012a52fdb0fd6aaf5953baa9fce4a58fa34e4b2/getsentry/sentry-javascript/issues/25327 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/d6a20e1a3bca93a98f8492bd4012a52fdb0fd6aaf5953baa9fce4a58fa34e4b2/getsentry/sentry-javascript/issues/25327 |
| og:image:alt | Found while writing the test in #25326. Both show up with `Sentry.createLangChainCallbackHandler()` passed explicitly, and both behave the same on `@langchain/core` 1.2.16 and 1.2.17. Flat spans. A... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | RulaKhaled |
| hostname | github.com |
| expected-hostname | github.com |
| None | b7a1d2b9101496921b08579fbee988d014345aef2f5bd660d1f8c7332d81560e |
| turbo-cache-control | no-preview |
| go-import | github.com/getsentry/sentry-javascript git https://github.com/getsentry/sentry-javascript.git |
| octolytics-dimension-user_id | 1396951 |
| octolytics-dimension-user_login | getsentry |
| octolytics-dimension-repository_id | 3328572 |
| octolytics-dimension-repository_nwo | getsentry/sentry-javascript |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 3328572 |
| octolytics-dimension-repository_network_root_nwo | getsentry/sentry-javascript |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | c3dd496c3da6ea6b77e69c09279d2b81604654f1 |
| ui-target | canary-2 |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width