Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@
"dependencies": {
"@langfuse/otel": "^5.11.1",
"@langfuse/tracing": "^5.11.1",
"@opentelemetry/api": "^1.9.0",
"@opentelemetry/core": "^2.11.0",
"@opentelemetry/exporter-trace-otlp-http": "^0.222.0",
"@opentelemetry/resources": "^2.11.0",
"@opentelemetry/sdk-trace-base": "^2.11.0",
"@opentelemetry/sdk-trace-node": "^2.11.0",
"@opentelemetry/api": "^1.10.0",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔴 Users whose hook process already has an OpenTelemetry 1.9.x API registered lose session, user, tag and metadata grouping on every exported turn. With @ opentelemetry/api 1.10.0, the shared global registry no longer accepts a 1.9.x entry. The context-manager registration is refused and lookups fall back to a no-op, so propagateAttributes at trace.ts:807 has no effect. Fix: keep the plugin on the API minor that foreign instrumentations register (hold api at 1.9 until the plugin no longer needs the global context). Also make instrumentation.test.ts:66 register the installed version and assert sessionId.

Why this was flagged

The trigger is a Codex hook process where another instrumentation set up the global Symbol.for("opentelemetry.js.api.1") entry first with API 1.9.x, for example through NODE_OPTIONS. The plugin plans for this case: see plugins/tracing/test/instrumentation.test.ts:51-53 and "the global registry can refuse the registration silently" at instrumentation.ts:88. On base the plugin's API is 1.9.1, so the versions match. provider.register() (instrumentation.ts:86) can then add the AsyncLocalStorage context manager to the foreign entry, and getGlobal accepts a foreign manager of the same minor. With 1.10.0, registerGlobal refuses because the versions differ. getGlobal's isCompatible also rejects minor 9 when its own minor is 10, so context.with and context.active() become no-ops. propagateAttributes (trace.ts:807-816) then never reaches the spans started in emitTurn. Exported turns lose sessionId, userId, tags, metadata and traceName. Tests stay green because the fixture hardcodes version: "1.9.1" (instrumentation.test.ts:66) and never checks propagated attributes.

Verification: With a foreign API 1.9.x global, isCompatible rejects it (own minor 10 > 9) and registerGlobal refuses any version mismatch. So provider.register() (instrumentation.ts:86) cannot install the context manager, and propagateAttributes at trace.ts:807 has no effect. On base (1.9.1), a 1.9.x global is compatible, so this is a regression.

"@opentelemetry/core": "^3.0.0",
"@opentelemetry/exporter-trace-otlp-http": "^0.300.0",
"@opentelemetry/resources": "^3.0.0",
Comment on lines +36 to +39

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔴 Users of the bundled hook get two incompatible OpenTelemetry lines in one process: core/resources 3.x run beside the 2.x tracer provider and outside @ langfuse/otel's supported range. The bump moves @ opentelemetry/core, @ opentelemetry/resources and the 0.300 exporter to 3.x, while sdk-trace-base/node stay on ^2.12.0. No @ opentelemetry/api version satisfies both lines' peer ranges. Fix: keep the whole OpenTelemetry group on one major. Revert core/resources to ^2.12.0 and pin the exporter to a 0.2xx release built on 2.x, since @ langfuse/otel 5.11.1 still declares @ opentelemetry/core: ^2.0.1.

Why this was flagged

The locked graph cannot satisfy its own peer ranges. In pnpm-lock.yaml, sdk-trace-base@ 2.12.0, sdk-trace-node@ 2.12.0, core@ 2.12.0 and resources@ 2.12.0 all declare @ opentelemetry/api <1.10.0. Meanwhile core@ 3.0.0, resources@ 3.0.0, sdk-trace@ 3.0.0 and otlp-transformer@ 0.300.0 require >=1.10.0 <1.11.0, and the lock resolves api@ 1.10.0. @ langfuse/otel@ 5.11.1 declares peer @ opentelemetry/core: ^2.0.1, but the lock wires it to core@ 3.0.0. In plugins/tracing/src/instrumentation.ts:48-52 the Resource is built with resources@ 3. At line 79 it is handed to NodeTracerProvider from sdk-trace-node@ 2.12. On the base branch every package sat on 2.11.0/0.222.0 with api 1.9.1, so there was no cross-major mixing. tsdown bundles both copies of core, resources and sdk-trace into dist/index.mjs (plugins/tracing/tsdown.config.ts noExternal), so pnpm's non-strict peer warnings do not stop it from shipping.

Verification: The graph it resolves breaks the version contracts its own packages declare. No api version fits both. The lock resolves api@ 1.10.0 (l.106, l.1315). @ langfuse/otel declares peer '@ opentelemetry/core': ^2.0.1 (l.89), but is wired to '@ opentelemetry/core': 3.0.0 (l.1299). On the base commit all peer ranges are met.

"@opentelemetry/sdk-trace-base": "^2.12.0",
"@opentelemetry/sdk-trace-node": "^2.12.0",
"zod": "^4.6.5"
},
"devDependencies": {
Expand Down
Loading
Loading