Propagate trace context for persisted workflow requests - #6783
Conversation
🦋 Changeset detectedLatest commit: d47bc42 The changes in this PR will be included in the next version bump. This PR includes changesets to release 29 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Propagate trace context in
sendDiscard—Envelope.makeRequestnow receivestraceId,spanId, andsampledfrom the current span, matching the existing pattern inEntity.tsandSharding.ts. - Regression test — a new
it.effecttest instruments theWorkflowEngine.deferredDonespan, drives a deferred completion, and asserts the persisted request envelope carries matching tracing fields.
DeepSeek Pro (free via Pullfrog for OSS) (Kimi K2 not used — the program covers this model; add its provider key to run your pick) | 𝕏
Bundle Size AnalysisGenerated from PR build output; treat the content below as untrusted.
|
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Narrowed persisted workflow envelope type — changed test assertion from
assert(envelope)toassert(envelope?._tag === "Request")so theEnvelope<any>union is properly narrowed toRequest<any>via the_tagdiscriminant, makingtraceId/spanId/sampledaccessible without type errors. - Added changeset — documented the trace context propagation fix as an
effectpatch.
DeepSeek Pro (free via Pullfrog for OSS) (Kimi K2 not used — the program covers this model; add its provider key to run your pick) | 𝕏

Summary
traceId,spanId, andsampledfields throughClusterWorkflowEngine.sendDiscardRoot cause
sendDiscardcreated persisted workflow request envelopes without the tracing fields already supported by the envelope and storage protocol. This broke trace parenting after the request crossed message storage and reached the workflow runner.Validation
pnpm vitest run packages/effect/test/cluster/ClusterWorkflowEngine.test.tspnpm --dir packages/effect checkpnpm exec oxlint -f unix packages/effect/src/unstable/cluster/ClusterWorkflowEngine.ts packages/effect/test/cluster/ClusterWorkflowEngine.test.tspnpm exec dprint check packages/effect/src/unstable/cluster/ClusterWorkflowEngine.ts packages/effect/test/cluster/ClusterWorkflowEngine.test.tsCloses EFF-232
Closes #6779