fix(clients): subagent threads fold their work like other threads - #13725
Conversation
A provider-native subagent thread has no runs, and turn folds were keyed by run, so its work never folded behind "Worked for ...". In a thread without runs, each prompt now keys its own response, which folds with the usual rules: the final answer stays visible, a failed or working response stays open, and the duration runs from the prompt to the answer. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
| terminalAssistantMessageIds, | ||
| latestRun: input.latestRun ?? null, | ||
| unfoldedRunIds: new Set([...activeVisualResponseRunIds, ...failedRunIds]), | ||
| isWorking: input.isWorking, |
There was a problem hiding this comment.
🟡 Medium chat/MessagesTimeline.logic.ts:1106
A settled runless response is unfolded whenever the broad input.isWorking flag is true, including during sending, connecting, checkpoint reverts, or compaction, so its existing fold is lost during those transient states. Pass the runless-specific input.runlessWorkActive state to deriveTurnFolds instead.
| isWorking: input.isWorking, | |
| isWorking: input.runlessWorkActive === true, |
🚀 Reply "fix it for me" or copy this AI Prompt for your agent:
In file @apps/web/src/components/chat/MessagesTimeline.logic.ts around line 1106:
A settled runless response is unfolded whenever the broad `input.isWorking` flag is true, including during sending, connecting, checkpoint reverts, or compaction, so its existing fold is lost during those transient states. Pass the runless-specific `input.runlessWorkActive` state to `deriveTurnFolds` instead.
ApprovabilityVerdict: Would Approve Macroscope's review found this PR approvable — This is a focused presentation bug fix that adds runless subagent work folding in web and mobile while preserving active and failed responses, with targeted test coverage. An unresolved medium-severity finding remains about transient Not approved because:
Adjust the Minimum Blocking Severity for this repo — including turning it Off — in Settings. You can add or adjust custom eligibility rules. Learn more. |
Thread transfer impact✅ Thread transfer remains within every enforced ceiling.
Baseline: unavailable · PR result: Scenario and decoded snapshot size10 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.
Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed. |
bb89d58
into
t3code/codex-turn-mapping
A provider-native subagent thread (a Claude/Codex subagent's child thread) showed every command and thought expanded, with no "Worked for …" row. Turn folds are keyed by run, and these threads have no runs by design (#13614): the whole child is one runless root turn, and each SendMessage resume adds another user prompt to it (#13668).
What changed
In a thread without runs (
latestRun === null), each user prompt now provides the fold key for its response (runless:<prompt entry id>). That key stands in for the missingrunIdof the items after it, so web (deriveTurnFolds) and mobile (deriveThreadFeedRunFolds) apply their normal fold rules per subagent run:erroritem.Threads with runs are unchanged, because the runless key is only used when there is no run at all. No contract or server change. I did not use
providerTurnIdor the node id as the key: every child item hasproviderTurnId: null, and every item shares the one root node, so neither separates a launch from a resume.Verification
apps/web:vp test run src/components/chat/MessagesTimeline.logic.test.ts src/components/chat/MessagesTimeline.test.tsx: 207/207 pass. The new test builds a child thread shaped like the live "Review src/math.ts" projection (no runs, one root node, a launch prompt and a resume prompt). It covers settled, expanded, resume-running, and failed-resume. It fails without the fix.apps/mobile:vp test run src/lib/threadActivity.test.ts: 73/73 pass, including the same case for the mobile feed.shows a provider-native subagent's runless tools as live work while it works) expected a settled runless response to stay unfolded. It now expects the fold, the same as a settled run with no answer on a normal thread.vp exec tsc --noEmit -p .inapps/webandapps/mobile: no errors or warnings.vp linton the touched files is clean.vp run knip:checkis clean.Model: Claude Opus 5.5 (Claude Code)
🤖 Generated with Claude Code