feat: live Cursor subagent activity in the task card - #99
Merged
Conversation
The 08-06 plan's transcript-tail design is annotated as superseded: the Cursor SDK streams nested subagent activity live via taskUpdate payloads on the parent task's tool-call-delta updates, and short subagents only checkpoint their on-disk transcript at completion.
A Cursor subagent's task card now behaves like a native opencode subagent
card: clickable while running, with a live activity subtitle.
- Child session is created up-front when the task call starts and
state.metadata.sessionId is stamped on the RUNNING task part via
part.update (the native task tool's execute-time equivalent), so the
card is navigable from the start of the run.
- Nested subagent activity (taskUpdate payloads on the parent task's
tool-call-delta updates) is normalized into subagent-events and
materialised as real tool parts in the child session (upserted via
part.update): running on tool-start, completed on tool-result, with
stragglers completed at finalize. This is what the TUI reads for its
live activity subtitle.
- The child session is seeded with the subagent's prompt and its
rendered activity (text, thinking, tool calls, conversation steps,
final answer, duration).
- upsertToolPart treats a resolved { error } response as failure
(hey-api's request does not throw on 4xx) and always sends
state.metadata on completed parts, which the schema requires.
- cursor_delegate also links a child session seeded with its transcript.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A Cursor subagent's
taskcard now behaves like a native opencode subagent card: navigable while running, with a live↳ <Tool> <title>activity subtitle, and the child session carries the subagent's own output.How it works
taskcall starts andstate.metadata.sessionIdis stamped on the running task part viapart.update(the native task tool's execute-time metadata equivalent). The TUI readspart.state.metadata.sessionIdfor navigation, so the card is clickable /ctrl+x-navigable from the start of the run, not just after completion.taskUpdatepayloads on the parent task'stool-call-deltaupdates (text, thinking, tool-start/tool-result with id + name + input). These are normalized intosubagent-events and written into the child session as realtoolparts via thepart.updateupsert — the exact mechanism opencode's processor uses — so the TUI's task card shows live activity while the subagent runs. Tool calls complete when theirtool-resultarrives; any call left open is completed at finalize.upsertToolParttreats a resolved{ error }response as failure (the hey-api client does not throw on 4xx) and always sendsstate.metadataon completed parts, which opencode's completed-state schema requires. Child-session writes are best-effort: a failed write is logged, never breaks the parent turn.cursor_delegatealso links a child session seeded with its transcript, discoverable via the TUI's subagent panel.Verification
npm run typecheck && npx vitest run && npm run build— 567/567 tests pass.opencode runexercise (with the local provider override): tool parts appear in the child session mid-run with real start/end timestamps, and the parent task part carriesstate.metadata.sessionIdwhile the subagent is still running.