Skip to content

fix(cursor): parent subagent spans to the spawning turn - #238

Open
Abhijeet Prasad (AbhiPrasad) wants to merge 1 commit into
mainfrom
subagent-shared-trace-8370294c
Open

Abhijeet Prasad (AbhiPrasad) wants to merge 1 commit into
mainfrom
subagent-shared-trace-8370294c

Conversation

@AbhiPrasad

Copy link
Copy Markdown
Member

🤖 This text was AI-generated.

Cursor subagent spans were children of the spawning tool, and the task was stored as a raw string. The instrumentation spec's turn tree puts the subagent on the same trace as the user turn that spawned it, with metadata.turn_span_id set to that turn. A raw string also broke stop correlation: a stop that omitted subagent_id compared the task to input as a string, so it could not find the open child.

Subagent spans now share the session root and hang directly off that user turn. The spawning tool call id stays in metadata. The task is a user message, and a stop without an id matches that same message.

session
└── turn
    ├── tool Task
    └── task Cursor subagent
        input: [{role: "user", content: "<task>"}]

Stops that do not match an open start still become a terminal observation on the turn. Inner model and tool work is not attached under the subagent, because Cursor does not provide a verified link for that activity.

> 🤖 **This text was AI-generated.**

Cursor subagent spans were children of the spawning tool, and the task was stored as a raw string. The instrumentation spec's turn tree puts the subagent on the same trace as the user turn that spawned it, with `metadata.turn_span_id` set to that turn. A raw string also broke stop correlation: a stop that omitted `subagent_id` compared the task to `input` as a string, so it could not find the open child.

Subagent spans now share the session root and hang directly off that user turn. The spawning tool call id stays in metadata. The task is a user message, and a stop without an id matches that same message.

```text
session
└── turn
    ├── tool Task
    └── task Cursor subagent
        input: [{role: "user", content: "<task>"}]
```

Stops that do not match an open start still become a terminal observation on the turn. Inner model and tool work is not attached under the subagent, because Cursor does not provide a verified link for that activity.

Co-authored-by: Cursor <cursoragent@cursor.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 27, 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-10-27T14:07:48.807515Z 47ce336 PR opened
ℹ️ 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.

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