fix: keep subagent spinner and footer live while a subagent runs#3604
Draft
MattPua wants to merge 2 commits into
Draft
fix: keep subagent spinner and footer live while a subagent runs#3604MattPua wants to merge 2 commits into
MattPua wants to merge 2 commits into
Conversation
|
Merging to
After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here |
|
React Doctor found no issues in the changed files. 🎉 Reviewed by React Doctor for commit |
PR #3522 hid both `wait` and `closeAgent` collab-agent events. `wait` ("Waiting for subagents") is the visible state that the main thread is blocked on a running subagent; dropping it made the conversation look done while a subagent was still working. Keep `closeAgent` hidden as lifecycle noise but restore `wait` so the in-progress spinner shows. Generated-By: PostHog Code Task-Id: 515f2e33-762c-412a-8a2d-a217bbace052
A subagent (Task/Agent tool call) keeps running after the parent turn ends or after the spawn tool call settles, but the conversation UI derived "loading" from the parent turn's turnComplete and the spawn's own status, so the spinner and the footer's generating indicator stopped mid-subagent, making the conversation look done. Derive live state from the subagent's own nested child tool calls: - SubagentToolView keeps its spinner while any child is non-terminal, even after the parent turn completes. - The new-thread ToolGroup / chip summary stay "Using" while a subagent in the group has active children. - Both footers (legacy ConversationView and ChatThreadFooter) keep the generating indicator alive via conversationHasActiveSubagent. Display-only: the prompt-lifecycle gates (queue/steer) still read the raw isPromptPending, so a follow-up message sends rather than queuing while a detached subagent finishes. Works for both Claude and Codex. Generated-By: PostHog Code Task-Id: 515f2e33-762c-412a-8a2d-a217bbace052
MattPua
force-pushed
the
posthog-code/restore-subagent-wait-indicator
branch
from
July 20, 2026 20:54
406ead5 to
880a27a
Compare
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.
Problem
When a sub-agent (Task/Agent tool call) is running, the conversation UI sometimes looked done while the sub-agent was still working. Two faces:
This affects both the Claude and Codex adapters.
Changes
Derive live state from the sub-agent's own nested child tool calls instead of the parent turn's
turnComplete/ the spawn's own status:SubagentToolViewkeeps its spinner while any child tool call is non-terminal, even after the parent turn completes.ToolGroup/ chip summary stay "Using" while a sub-agent in the group has active children.ConversationViewandChatThreadFooter) keep the generating indicator alive via a newconversationHasActiveSubagenthelper.Display-only: the prompt-lifecycle gates (message queue / steer) still read the raw
isPromptPending, so a follow-up message sends rather than queuing while a detached sub-agent finishes.Also restores Codex's
waitcollab-agent event ("Waiting for subagents" row) that PR #3522 had hidden alongsidecloseAgent;closeAgentstays hidden as lifecycle noise.How did you test this?
buildConversationItems.test.tsforconversationHasActiveSubagent(active child, detached sub-agent after turn end, clears on settle, ignores non-subagent).SubagentToolView.test.tsxasserting the spinner stays up while a child isin_progresswithturnComplete=true, and clears when settled.pnpm --filter @posthog/ui exec vitest run src/features/sessions/(467 passing)pnpm --filter agent exec vitest run src/adapters/codex-app-server/mapping.test.ts(39 passing)pnpm --filter @posthog/ui typecheck,biome linton changed filesAutomatic notifications
Created with PostHog Code