Skip to content

fix(temporal): preserve trace context across continue-as-new - #1057

Merged
Abhijeet Prasad (AbhiPrasad) merged 2 commits into
mainfrom
abhi/braintrust-pr-1054-9edfc013
Nov 3, 2026
Merged

Abhijeet Prasad (AbhiPrasad) merged 2 commits into
mainfrom
abhi/braintrust-pr-1054-9edfc013

Conversation

@AbhiPrasad

Copy link
Copy Markdown
Member

🤖 This text was AI-generated.

BraintrustPlugin did not attach span context to continue-as-new commands. Continued runs could lose the original trace or skip the span that requested the continuation.

Propagate the current span through Temporal headers using the same helper as activities and child workflows. Each run keeps its own workflow span while remaining in the original trace:

before: run 1    run 2    run 3

after:  run 1
        └─ run 2
           └─ nested span
              └─ run 3

Cover both transitions in one real Temporal workflow chain, with and without a client parent and with cached and replayed workflow execution. Span end-time handling remains outside this change.

Fixes https://linear.app/braintrustdata/issue/SDK-780

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-03T18:24:00.206525Z 71dd6bd New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Base automatically changed from abhi/temporal-subagent-spans-2610819b to main November 3, 2026 17:20
@AbhiPrasad
Abhijeet Prasad (AbhiPrasad) force-pushed the abhi/braintrust-pr-1054-9edfc013 branch from d3cb476 to 4b4fbc5 Compare November 3, 2026 17:21
> 🤖 **This text was AI-generated.**

BraintrustPlugin did not attach span context to continue-as-new commands.
Continued runs could lose the original trace or skip the span that requested
the continuation.

Propagate the current span through Temporal headers using the same helper
as activities and child workflows. Each run keeps its own workflow span
while remaining in the original trace:

```text
before: run 1    run 2    run 3

after:  run 1
        └─ run 2
           └─ nested span
              └─ run 3
```

Cover both transitions in one real Temporal workflow chain, with and
without a client parent and with cached and replayed workflow execution.
Span end-time handling remains outside this change.

Fixes https://linear.app/braintrustdata/issue/SDK-780
@AbhiPrasad
Abhijeet Prasad (AbhiPrasad) merged commit 6da449c into main Nov 3, 2026
98 checks passed
@AbhiPrasad
Abhijeet Prasad (AbhiPrasad) deleted the abhi/braintrust-pr-1054-9edfc013 branch November 3, 2026 18:34
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.

2 participants