Skip to content

feat(subagents): disclose projected results consistently#3866

Open
PixPMusic wants to merge 4 commits into
pingdotgg:t3code/codex-turn-mappingfrom
PixPMusic:pixpmusic/fix-subagent-results
Open

feat(subagents): disclose projected results consistently#3866
PixPMusic wants to merge 4 commits into
pingdotgg:t3code/codex-turn-mappingfrom
PixPMusic:pixpmusic/fix-subagent-results

Conversation

@PixPMusic

@PixPMusic PixPMusic commented Jul 10, 2026

Copy link
Copy Markdown

Important

This PR is stacked on #2829 and should be reviewed and merged after it.

Summary

  • Show completed subagent results in an expandable parent timeline row.
  • Keep child-thread navigation separate from result disclosure.
  • Assert Codex replay projections keep authoritative results on parent lifecycle items.

Validation

  • vp test run apps/web/src/components/chat/MessagesTimeline.test.tsx
  • vp test run apps/server/src/orchestration-v2/testkit/OrchestratorReplayFixtures.integration.test.ts -t 'runs subagent(_v2)?/codex'
  • vp check
  • vp run typecheck

Note

Low Risk
Chat timeline presentation and test-only orchestration assertions; no auth, data, or API changes.

Overview
Completed/failed subagent rows in V2LifecycleRow now pick detail text by status: live progress while running (even if a partial result is streaming), then result/progress/prompt when terminal; only completed/failed with non-blank trimmed result get a collapsible full result disclosure (expandedDetail on RelatedThreadCard), with open child thread as a separate control when expanded.

Behavioral tweaks: cancelled/interrupted rows show streamed partial output instead of stale progress; whitespace-only final results fall back to progress and skip disclosure.

Tests: Codex replay fixtures assert each subagent’s parent lifecycle turnItems entry matches subagent.result; MessagesTimeline tests cover disclosure, running partials, cancel, and blank-result cases.

Reviewed by Cursor Bugbot for commit 86a63f0. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Disclose projected subagent results in lifecycle rows based on run status

  • V2LifecycleRow now selects detail text based on subagent status: running subagents prefer progress over streamed result, terminal statuses prefer streamed result, and whitespace-only results are ignored.
  • RelatedThreadCard gains an optional expandedDetail prop that renders an inline <details> disclosure block with data-v2-subagent-result-disclosure, data-v2-subagent-result, and an aria-label; when present, opening the thread uses a dedicated overlay button instead of the whole card.
  • Full result disclosure is shown only for completed/failed subagents; cancelled and interrupted states omit it.
  • Test fixtures for subagent and subagent_v2 assert that parent lifecycle turn items carry matching results, and MessagesTimeline tests cover the full matrix of subagent states.

Macroscope summarized 86a63f0.

@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 71826862-6b7b-4faa-a7ac-82035e31f574

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:M 30-99 changed lines (additions + deletions). labels Jul 10, 2026
Comment thread apps/web/src/components/chat/V2LifecycleRow.tsx
Comment thread apps/web/src/components/chat/V2LifecycleRow.tsx Outdated
@macroscopeapp

macroscopeapp Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Needs human review

1 blocking correctness issue found. This PR introduces new user-facing behavior for subagent result disclosure, and has an unresolved review comment identifying a bug where rolled_back status is missing from terminal status handling, causing incorrect display behavior.

You can customize Macroscope's approvability policy. Learn more.

Only surface the expandable result card once the subagent reaches a
terminal status (completed/failed/cancelled/interrupted); running
subagents keep the live-progress summary even when the projection
carries a partial result. Normalize the trimmed result-presence check
once so whitespace-only results fall back to progress/prompt in both
the summary line and the disclosure.
Comment thread apps/web/src/components/chat/V2LifecycleRow.tsx
Comment thread apps/web/src/components/chat/V2LifecycleRow.tsx Outdated
Cancelled and interrupted subagents keep whatever result text streamed
before the abort, so only completed/failed results get the full-result
disclosure. Running or aborted subagents now surface the streamed
result as the live detail line when no progress text exists.

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit d11f70a. Configure here.

Comment thread apps/web/src/components/chat/V2LifecycleRow.tsx Outdated
Cancelled and interrupted subagents showed the stale progress line even
when partial result text was available. Terminal statuses now prefer
the streamed result; running subagents keep live progress first.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Medium

const TERMINAL_SUBAGENT_STATUSES = new Set<OrchestrationV2TurnItem["status"]>([

A subagent in rolled_back status takes the non-terminal branch when computing detail, so item.progress is preferred over item.result. Users see a stale in-progress line for a stopped subagent instead of its final output. TERMINAL_SUBAGENT_STATUSES is missing "rolled_back", which the server treats as terminal during rollback.

🤖 Copy this AI Prompt to have your agent fix this:
In file @apps/web/src/components/chat/V2LifecycleRow.tsx around line 41:

A subagent in `rolled_back` status takes the non-terminal branch when computing `detail`, so `item.progress` is preferred over `item.result`. Users see a stale in-progress line for a stopped subagent instead of its final output. `TERMINAL_SUBAGENT_STATUSES` is missing `"rolled_back"`, which the server treats as terminal during rollback.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rolled_back is a run status (OrchestrationV2RunStatus), not a turn-item status: OrchestrationV2TurnItemStatus in packages/contracts/src/orchestrationV2.ts has no rolled_back member, so item.status here can never hold it (adding it to the set would not typecheck against Set<OrchestrationV2TurnItem["status"]>). Items belonging to rolled-back runs are excluded by the projection layer (r.status <> 'rolled_back' in ProjectionStore.ts) rather than surfaced with a rolled-back item status.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I'm unable to act on this request because you do not have permissions within this repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M 30-99 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant