René's URL Explorer Experiment


Title: fix(core): mint the fallback external trace id per run by NERLOE · Pull Request #4526 · triggerdotdev/trigger.dev · GitHub

Open Graph Title: fix(core): mint the fallback external trace id per run by NERLOE · Pull Request #4526 · triggerdotdev/trigger.dev

X Title: fix(core): mint the fallback external trace id per run by NERLOE · Pull Request #4526 · triggerdotdev/trigger.dev

Description: Problem Runs that carry no external trace context (schedules, task-to-task triggers, anything not started from an incoming traceparent) fall back to a generated external trace id. That id is generated once, in the TracingSDK constructor: https://github.com/triggerdotdev/trigger.dev/blob/main/packages/core/src/v3/otel/tracingSDK.ts#L165 With experimental_processKeepAlive enabled, the TracingSDK outlives the run, so every run that executes on a warm process is exported to the external OTLP endpoint under that same trace id and unrelated runs get merged into one trace on the receiving backend. This is the same warm-start hazard that c043c4a fixed for the external-context path. That commit made the wrappers read traceContext.getExternalTraceContext() live instead of capturing it at construction, but deliberately left the fallback captured, so the bug survives for exactly the runs that have no external context. What it looks like in production We export to a self-hosted Langfuse via telemetry.exporters. Measured over our production traces: 80.3% of traces contain spans from more than one Trigger run worst case: 25 distinct runs collapsed into a single trace Per-trace cost and latency attribution is meaningless as a result: a trace shows an unrelated mix of workloads, and drilling into one run is impossible. Disabling experimental_processKeepAlive avoids it, but that is a significant throughput regression and not a real option for us. Fix FallbackExternalTraceId holds the generated id and remints it when the run changes. The TracingSDK constructs one instance and passes it to every ExternalSpanExporterWrapper and ExternalLogRecordExporterWrapper, so a run's spans and logs agree on the id after a remint. That matches the old behaviour, where all wrappers received one identical string. The run boundary comes from the manager rather than being inferred. StandardTraceContextManager.traceContext becomes an accessor pair that advances an epoch whenever the context is replaced, which is exactly what starting a run does, so no call site changes. getTraceContextEpoch() is added to TraceContextManager, and the noop manager reports a constant, so with no manager registered there are no boundaries to react to. I did first try inferring the boundary from reference-identity of getTraceContext(). It works, but guarding it against the noop manager's freshly allocated {} requires testing the context for emptiness, and since traceContext is z.record(z.unknown()) that silently stops reminting for a run whose context is legitimately empty, merging it back into the previous run's trace. The epoch avoids the heuristic entirely. One behaviour held deliberately: an empty configured id still means external export is off, so the empty seed short-circuits rather than minting an id and switching the feature on for a deployment that never asked for it. Tests packages/core/test/externalSpanExporterWrapper.test.ts gains six cases: mints a new fallback trace id per run when there is no external context mints a new fallback trace id for a run whose trace context is empty keeps one fallback trace id across every export within a run leaves external export off when no external trace id was configured keeps a run's spans and logs on the same id after a remint holds the id when no trace context manager is registered Mutation-checked. Removing the epoch bump fails three of them, and reinstating the emptiness heuristic fails the empty-context case with the exact symptom it describes. Full packages/core suite passes (674 tests). The harness needed one fix to make these meaningful. traceContext.setGlobalManager() delegates to registerGlobal, which ignores a second registration, so the beforeEach only ever installed the first test's manager and every later test was mutating an object that was no longer global. Calling traceContext.disable() first makes each test's manager actually take effect. Happy to split the traceContext epoch into its own commit or PR if you'd rather review it separately, or to take a different approach to the boundary entirely. 🤖 Generated with Claude Code

Open Graph Description: Problem Runs that carry no external trace context (schedules, task-to-task triggers, anything not started from an incoming traceparent) fall back to a generated external trace id. That id is genera...

X Description: Problem Runs that carry no external trace context (schedules, task-to-task triggers, anything not started from an incoming traceparent) fall back to a generated external trace id. That id is genera...

Opengraph URL: https://github.com/triggerdotdev/trigger.dev/pull/4526

X: @github

direct link

Domain: github.com

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf
route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:fcadf5ce-3efc-73bf-c27f-ea32edd8b8d0
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idA7FC:1E77:5FEFCD:8F5A87:6AFAF20E
html-safe-noncec5e5f1978ba737d8b5c5affdd88d15654b9a39dbb0f6c5fb97bf4d1ebb62e0c5
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBN0ZDOjFFNzc6NUZFRkNEOjhGNUE4Nzo2QUZBRjIwRSIsInZpc2l0b3JfaWQiOiIzMjIzNjUwMzkwODU1MzE1OTgyIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac101097d979644fb62dbbe0d01481cde1d1787938875be43e4c9eca9e40b52f73
hovercard-subject-tagpull_request:4227046380
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/triggerdotdev/trigger.dev/pull/4526/files
twitter:imagehttps://avatars.githubusercontent.com/u/32075361?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/32075361?s=400&v=4
og:image:altProblem Runs that carry no external trace context (schedules, task-to-task triggers, anything not started from an incoming traceparent) fall back to a generated external trace id. That id is genera...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None0178036d8230524a18422872393ab7e708443ae4c2047f758560a2db870c1913
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/triggerdotdev/trigger.dev git https://github.com/triggerdotdev/trigger.dev.git
octolytics-dimension-user_id95297378
octolytics-dimension-user_logintriggerdotdev
octolytics-dimension-repository_id572570113
octolytics-dimension-repository_nwotriggerdotdev/trigger.dev
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id572570113
octolytics-dimension-repository_network_root_nwotriggerdotdev/trigger.dev
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releasea85e96a83bed7871993e6b1ffda24105928eee17
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/triggerdotdev/trigger.dev/pull/4526/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Ftriggerdotdev%2Ftrigger.dev%2Fpull%2F4526%2Ffiles
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Ftriggerdotdev%2Ftrigger.dev%2Fpull%2F4526%2Ffiles
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=triggerdotdev%2Ftrigger.dev
Reloadhttps://github.com/triggerdotdev/trigger.dev/pull/4526/files
Reloadhttps://github.com/triggerdotdev/trigger.dev/pull/4526/files
Reloadhttps://github.com/triggerdotdev/trigger.dev/pull/4526/files
triggerdotdevhttps://github.com/triggerdotdev
trigger.devhttps://github.com/triggerdotdev/trigger.dev
Codehttps://github.com/triggerdotdev/trigger.dev
Issues203 (203)https://github.com/triggerdotdev/trigger.dev/issues
Pull requests67 (67)https://github.com/triggerdotdev/trigger.dev/pulls
Discussionshttps://github.com/triggerdotdev/trigger.dev/discussions
Actionshttps://github.com/triggerdotdev/trigger.dev/actions
Projectshttps://github.com/triggerdotdev/trigger.dev/projects
Security and quality39 (39)https://github.com/triggerdotdev/trigger.dev/security
Insightshttps://github.com/triggerdotdev/trigger.dev/pulse
Sign up for GitHub https://github.com/signup?return_to=%2Ftriggerdotdev%2Ftrigger.dev%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Ftriggerdotdev%2Ftrigger.dev%2Fissues%2Fnew%2Fchoose
NERLOEhttps://github.com/NERLOE
triggerdotdev:mainhttps://github.com/triggerdotdev/trigger.dev/tree/main
NERLOE:fix/external-trace-id-per-runhttps://github.com/NERLOE/trigger.dev/tree/fix/external-trace-id-per-run
Conversation 7 https://github.com/triggerdotdev/trigger.dev/pull/4526
Commits 1 https://github.com/triggerdotdev/trigger.dev/pull/4526/commits
Checks 45 https://github.com/triggerdotdev/trigger.dev/pull/4526/checks
Files changed https://github.com/triggerdotdev/trigger.dev/pull/4526/files
Please reload this pagehttps://github.com/triggerdotdev/trigger.dev/pull/4526/files
fix(core): mint the fallback external trace id per run https://github.com/triggerdotdev/trigger.dev/pull/4526/files#top
Show all changes 1 commit https://github.com/triggerdotdev/trigger.dev/pull/4526/files
75f95c9 fix(core): mint the fallback external trace id per run NERLOE Aug 7, 2026 https://github.com/triggerdotdev/trigger.dev/pull/4526/commits/75f95c9e39b78f852edfa3364dfbe0da2f2433cf
Clear filters https://github.com/triggerdotdev/trigger.dev/pull/4526/files
Please reload this pagehttps://github.com/triggerdotdev/trigger.dev/pull/4526/files
Please reload this pagehttps://github.com/triggerdotdev/trigger.dev/pull/4526/files
external-trace-id-per-run.md https://github.com/triggerdotdev/trigger.dev/pull/4526/files#diff-416f3234329663494a1b88173077e38b3d8860e9fe3dcd58e596483b136279bb
tracingSDK.ts https://github.com/triggerdotdev/trigger.dev/pull/4526/files#diff-ce510b575f0568e5e9854cedbca289205f363324a89085ae9b668c3cc334cd93
externalSpanExporterWrapper.test.ts https://github.com/triggerdotdev/trigger.dev/pull/4526/files#diff-325ef3d1fe3b9db00f44b5307f25ba9c2db1ed06ec234dbe50dfa4bed7c014bd
.changeset/external-trace-id-per-run.mdhttps://github.com/triggerdotdev/trigger.dev/pull/4526/files#diff-416f3234329663494a1b88173077e38b3d8860e9fe3dcd58e596483b136279bb
View file https://github.com/NERLOE/trigger.dev/blob/75f95c9e39b78f852edfa3364dfbe0da2f2433cf/.changeset/external-trace-id-per-run.md
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/triggerdotdev/trigger.dev/pull/4526/{{ revealButtonHref }}
devin-ai-integrationhttps://github.com/apps/devin-ai-integration
Aug 7, 2026https://github.com/triggerdotdev/trigger.dev/pull/4526/files#r3734628747
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
https://app.devin.ai/review/triggerdotdev/trigger.dev/pull/4526
Please reload this pagehttps://github.com/triggerdotdev/trigger.dev/pull/4526/files
packages/core/src/v3/otel/tracingSDK.tshttps://github.com/triggerdotdev/trigger.dev/pull/4526/files#diff-ce510b575f0568e5e9854cedbca289205f363324a89085ae9b668c3cc334cd93
View file https://github.com/NERLOE/trigger.dev/blob/75f95c9e39b78f852edfa3364dfbe0da2f2433cf/packages/core/src/v3/otel/tracingSDK.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/triggerdotdev/trigger.dev/pull/4526/{{ revealButtonHref }}
https://github.com/triggerdotdev/trigger.dev/pull/4526/files#diff-ce510b575f0568e5e9854cedbca289205f363324a89085ae9b668c3cc334cd93
devin-ai-integrationhttps://github.com/apps/devin-ai-integration
Aug 7, 2026https://github.com/triggerdotdev/trigger.dev/pull/4526/files#r3734628879
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
https://app.devin.ai/review/triggerdotdev/trigger.dev/pull/4526
Please reload this pagehttps://github.com/triggerdotdev/trigger.dev/pull/4526/files
https://github.com/triggerdotdev/trigger.dev/pull/4526/files#diff-ce510b575f0568e5e9854cedbca289205f363324a89085ae9b668c3cc334cd93
https://github.com/triggerdotdev/trigger.dev/pull/4526/files#diff-ce510b575f0568e5e9854cedbca289205f363324a89085ae9b668c3cc334cd93
https://github.com/triggerdotdev/trigger.dev/pull/4526/files#diff-ce510b575f0568e5e9854cedbca289205f363324a89085ae9b668c3cc334cd93
devin-ai-integrationhttps://github.com/apps/devin-ai-integration
Aug 7, 2026https://github.com/triggerdotdev/trigger.dev/pull/4526/files#r3734628610
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
https://app.devin.ai/review/triggerdotdev/trigger.dev/pull/4526
Please reload this pagehttps://github.com/triggerdotdev/trigger.dev/pull/4526/files
https://github.com/triggerdotdev/trigger.dev/pull/4526/files#diff-ce510b575f0568e5e9854cedbca289205f363324a89085ae9b668c3cc334cd93
https://github.com/triggerdotdev/trigger.dev/pull/4526/files#diff-ce510b575f0568e5e9854cedbca289205f363324a89085ae9b668c3cc334cd93
packages/core/test/externalSpanExporterWrapper.test.tshttps://github.com/triggerdotdev/trigger.dev/pull/4526/files#diff-325ef3d1fe3b9db00f44b5307f25ba9c2db1ed06ec234dbe50dfa4bed7c014bd
View file https://github.com/NERLOE/trigger.dev/blob/75f95c9e39b78f852edfa3364dfbe0da2f2433cf/packages/core/test/externalSpanExporterWrapper.test.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/triggerdotdev/trigger.dev/pull/4526/{{ revealButtonHref }}
https://github.com/triggerdotdev/trigger.dev/pull/4526/files#diff-325ef3d1fe3b9db00f44b5307f25ba9c2db1ed06ec234dbe50dfa4bed7c014bd
https://github.com/triggerdotdev/trigger.dev/pull/4526/files#diff-325ef3d1fe3b9db00f44b5307f25ba9c2db1ed06ec234dbe50dfa4bed7c014bd
Please reload this pagehttps://github.com/triggerdotdev/trigger.dev/pull/4526/files
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.