Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(web): show a reused child agent's current run in Lineage #12977

Closedt3dotgg(GitHub profile, opens in a new tab)wants to merge 250+ commits intomain fromfix/v2-reused-child-lineage-statusopened View on GitHub

When a delegated child thread finishes its task and then gets a follow-up turn, the parent's Lineage panel kept showing the first task. The child sat under Previous agents, was missing from the running count, and its timer was frozen on the old duration (2m 28s and 2m 51s on two live judge threads while both were on turn 3). The row title came from the child thread, so a current title sat next to a stale timer.

The parent's subagent record is the delegated task's result, and the server keeps it on purpose after the result is published. The child thread shell is the live thread. This change adds one resolver in thread-relationships that picks the display state for an app-owned child: the shell's activity run or latest run decides status and the timer anchors when a shell is present. The relationship graph and the web panel's row status, icon, tooltip, timer, and running count all use it. Provider-native subagents and children with no shell keep the record. The tooltip still shows the task result as history.

Tests cover the full sequence: task completes, a later run starts and the timer advances from that run, the run completes and the timer freezes on it. They also cover waiting and queued shells, a shell with no runs, a missing shell, and a provider-native subagent with a live shell.

Verified with focused tests, lint, and typecheck for client-runtime and web. No browser or installed app check in this pass, so screenshots are pending.

Created with Claude Fable 5.1 in Claude Code.

🤖 Generated with Claude Code

    1. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted

    2. @@ -47,0 +108,21 @@
      108+ startedAt: subagent.startedAt,
      109+ completedAt: subagent.completedAt,
      110+ };
      111+ if (subagent.origin !== "app_owned" || childThread === null) return record;
      112+ const activityRunStatus = childThread.activityRunStatus ?? null;
      113+ if (activityRunStatus !== null) {
      114+ // Preparing and starting count as running so the timer ticks from the
      115+ // activity run's anchor, the same anchor the sidebar working timer uses.
      116+ return {
      117+ status: activityRunStatus === "waiting" ? "waiting" : "running",
      118+ startedAt: childThread.activityRunStartedAt ?? subagent.startedAt,
      119+ completedAt: null,
      120+ };
      121+ }
      122+ const status = subagentStatusFromShellStatus(childThread.status);
      123+ if (status === null) return record;
      124+ // A queued follow-up has not started, so there is nothing to time yet.
      125+ if (status === "pending") return { status, startedAt: null, completedAt: null };
      126+ return {
      127+ status,
      128+ startedAt: childThread.latestRunStartedAt ?? subagent.startedAt,
      macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      🟡 Medium state/threadRelationships.ts:128

      A cancelled or failed reused run with latestRunStartedAt === null is displayed with a duration starting at the original delegated task's startedAt, producing an incorrect interval through the new latestRunCompletedAt. Do not fall back to subagent.startedAt when the latest run never started.

      Suggested change
      128- startedAt: childThread.latestRunStartedAt ?? subagent.startedAt,
      128+ startedAt: childThread.latestRunStartedAt ?? null,
      🚀 Reply "fix it for me" or copy this AI Prompt for your agent:
      In file @packages/client-runtime/src/state/threadRelationships.ts around line 128:
      
      A cancelled or failed reused run with `latestRunStartedAt === null` is displayed with a duration starting at the original delegated task's `startedAt`, producing an incorrect interval through the new `latestRunCompletedAt`. Do not fall back to `subagent.startedAt` when the latest run never started.
    3. Thread transfer impact

      ✅ Thread transfer remains within every enforced ceiling.

      ℹ️ No successful main baseline artifact is available yet. This run establishes the initial measurement.

      ProviderMetricMain baselineThis PRImpactPR ceiling
      CodexTotal thread wire—4.9 KiB—6.8 KiB✅
      CodexThread snapshot wire—3.7 KiB—4.9 KiB✅
      CodexLive turn WebSocket wire—1.2 KiB—2.0 KiB✅
      CodexLive turn WebSocket decoded—20.4 KiB—29.3 KiB✅
      CodexLive turn messages—2—8✅
      ClaudeTotal thread wire—4.9 KiB—6.8 KiB✅
      ClaudeThread snapshot wire—3.7 KiB—4.9 KiB✅
      ClaudeLive turn WebSocket wire—1.2 KiB—2.0 KiB✅
      ClaudeLive turn WebSocket decoded—20.8 KiB—29.3 KiB✅
      ClaudeLive turn messages—2—8✅

      Baseline: unavailable · PR result: 32cc0d1 · Source CI: failure

      Scenario and decoded snapshot size

      10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.

      • Codex decoded thread snapshot: 106.1 KiB
      • Claude decoded thread snapshot: 106.4 KiB

      Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.

    4. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      Approvability

      Verdict: Not approved

      Macroscope's review found this PR not approvable — The supplied base-to-head diff is a broad 1,495-file change containing new runtime capabilities, release/default changes, and a static-analysis suppression, rather than only the focused Lineage fix. An unresolved Medium finding also identifies an incorrect timer interval for cancelled or failed reused runs that never started.

      Not approved because:

      • 1 blocking correctness issue found at or above your repo's Minimum Blocking Severity
      Adjust the Minimum Blocking Severity for this repo — including turning it Off — in [Settings](https://app.macroscope.com/pingdotgg/settings#Repos). You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    5. juliusmarminge added labelsmacroscope-review

    6. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      Macroscope skipped reviewing this pull request. Per-review cost limit exceeded (workspace setting).

      This review would cost an estimated $41.44, which exceeds your per-review limit of $15.00.

      The top 3 files driving up this estimate:

      FileDiff SizeEstimate
      apps/server/src/orchestration-v2/Orchestrator.ts360.11KB$10.40
      packages/contracts/src/orchestrationV2.ts116.28KB$3.36
      apps/server/src/mcp/OrchestratorMcpService.ts75.10KB$2.17

      Tip

      To get this pull request reviewed, you can:

      1. Comment @macroscope-app on this PR to request a manual review (monthly spend limits still apply).
      2. Exclude the file(s) above from review by adding a pattern to your .macroscope/ignore.md — note that creating this file replaces Macroscope's built-in default ignores rather than extending them.
      3. Raise your cost limit in your workspace billing settings.
      [Turn off this reminder going forward](https://app.macroscope.com/pingdotgg/settings#Personal)
    7. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      All clear

      Posted via Macroscope — Effect Service Conventions

Sign in to join this conversation.