Skip to content

fix(server-utils): Nest Flue runs on Node under the request that dispatched them - #25549

Open
RulaKhaled wants to merge 2 commits into
developfrom
fix/flue-node-agent-trace
Open

RulaKhaled wants to merge 2 commits into
developfrom
fix/flue-node-agent-trace

Conversation

@RulaKhaled

@RulaKhaled RulaKhaled commented Oct 20, 2026 •

Copy link
Copy Markdown
Collaborator

On Node, every Flue agent run after the first landed in the trace of the first request that dispatched one, and later requests' traces had no agent spans. Flue's Node coordinator runs all submissions from one long-lived loop that keeps the first request's async context (withastro/flue#813).

Flue emits submission_queued inside the admitting call, so the integration now records the active span and isolation scope there and restores them when the run starts. Cloudflare is unchanged, since each turn there already starts from its own Durable Object alarm. This relies on Flue's current coordinator, which Flue plans to replace with pi-durable, so it needs another look then.

Found by the Node send-to-sentry e2e app for Flue (#24753, PR #25550).

🤖 Generated with Claude Code

…atched them

Flue's Node coordinator runs every submission from one long-lived loop
that keeps the async context of the first request that started it
(withastro/flue#813), so every later agent run landed in that request's
trace. Record the active span and isolation scope on `submission_queued`,
which Flue emits inside the admitting call, and restore them when the run
starts. Cloudflare is left as it is.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ean scopes

A submission admitted by another process, replayed by idempotency key or
evicted from the map has no record to restore, so its run kept the context
the claim loop inherited from an unrelated request, and lost its
`traceparent`. Run it in clean scopes with a new trace instead, through the
existing `withCleanScopes` helper, which also gives restored runs a clean
current scope.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@RulaKhaled

Copy link
Copy Markdown
Collaborator Author

bugbot run

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit b4f85a5. Configure here.

@RulaKhaled
RulaKhaled marked this pull request as ready for review October 20, 2026 12:38
@RulaKhaled
RulaKhaled requested a review from a team as a code owner October 20, 2026 12:38
@RulaKhaled
RulaKhaled requested review from JPeer264, isaacs and mydea and removed request for a team October 20, 2026 12:38

This branch has not been deployed

No deployments
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.

1 participant