Skip to content

Save and restore user span context on hibernation.#6516

Draft
mar-cf wants to merge 9 commits intomar/worker-context-2from
mar/worker-context-hibernation
Draft

Save and restore user span context on hibernation.#6516
mar-cf wants to merge 9 commits intomar/worker-context-2from
mar/worker-context-hibernation

Conversation

@mar-cf
Copy link
Copy Markdown
Contributor

@mar-cf mar-cf commented Apr 7, 2026

No description provided.

@mar-cf mar-cf requested a review from jasnell April 7, 2026 20:06
@ask-bonk
Copy link
Copy Markdown
Contributor

ask-bonk bot commented Apr 7, 2026

The restore side is safe — when autogate is disabled, userSpanContext is kj::none, so .map(...) returns kj::none, meaning SubrequestMetadata.userSpanContext is kj::none and the previous behavior is preserved. The asymmetric gating (capture gated, restore not) is actually the correct pattern — it's simpler and safe.

This PR is clean. The changes are minimal, well-gated behind an autogate, and the types all align correctly. The test update correctly reflects the new parenting relationship.

LGTM

github run

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 7, 2026

The generated output of @cloudflare/workers-types has been changed by this PR. If this is intentional, run just generate-types to update the snapshot. Alternatively, you can download the full generated types:

Full Type Diff

@mar-cf mar-cf force-pushed the mar/worker-context-2 branch from 628fde6 to e513522 Compare April 8, 2026 20:16
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