Repository navigation
Conversation
On Node < 24.13 the ESM build is transformed on the Module.register loader thread, which reports the injection over a MessagePort. The integration can subscribe after the scenario's first call, leaving it uninstrumented. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The TypeSafe `[esm]` integration tests flake on Node 22: the first `systemOne` call sometimes has no `evaluate` span, so the expected 4 spans never arrive and the test times out.
On Node < 24.13, the ESM build of `@typesafe-ai/sdk` is transformed on the `Module.register` loader thread, which reports the injection back over a `MessagePort`. That message is delivered asynchronously, so the integration can subscribe to its channel after the scenario already made its first call. CJS goes through the synchronous `_compile` patch, which is why only `[esm]` fails.
The scenario now waits until the channel has subscribers before making calls. The underlying race also affects real apps that call an ESM-only instrumented package right after importing it on older Node; fixing that needs a synchronous main-thread signal and is out of scope here.
NOTE: Likely we should not merge this but fix this at the core 🤔
🤖 Generated with Claude Code