Repository navigation
fix(tui): show spinner while a continued subagent runs - #59950
Conversation
There was a problem hiding this comment.
Looks good: a continued background subagent row now spins while the child session runs and goes back to ↳ when it finishes. I checked this with an opencode-drive script using the simulated model, comparing the base and this PR side by side (screenshots below). The packages/tui tests near the change have the same results as on the base (two shell-output timeout failures on both).
Public API: unchanged (TUI rendering only).
One edge case is noted inline: the input.sessionID fallback also applies when the continuation was rejected. That can make a failed row spin and hide its error.
| const { navigate } = useRoute() | ||
| const data = useData() | ||
| const sessionID = createMemo(() => stringValue(props.metadata.sessionID) ?? stringValue(props.metadata.sessionId)) | ||
| const sessionID = createMemo( |
There was a problem hiding this comment.
The input.sessionID fallback also applies when the tool call failed. For example, the model passes its own or another session's ID and gets Session … is not a child of the current session or Subagent session not found. If that session is running (the parent's own ID always is during the turn), isRunning() is true, so the errored row spins. InlineTool hides the error while running is set, so the failure isn't visible until that session goes idle, and clicking the row opens the unrelated session. Skipping the fallback when props.part.state.status === "error" would avoid this.
There was a problem hiding this comment.
The new commit addresses my earlier point: the row now ignores the continuation's input.sessionID when the tool call failed, so a rejected continuation doesn't spin, hide its error, or open an unrelated session. I re-ran the opencode-drive check with the simulated model, and a continued background subagent still spins while its child runs. The failed-call case I only checked by reading the code. Public API: unchanged. No new concerns.



Problem
When the agent continues an existing subagent, its row shows a static
↳icon even while the subagent is still working. Nothing tells you it is busy. A fresh subagent row already shows a spinner in the same situation.Change
A continued subagent row now spins while the subagent is running, the same way a fresh one does, and goes back to
↳once it stops.Whether the subagent is running is read from the child session's status. For continuations the child session ID falls back to
input.sessionIDwhen the tool metadata doesn't have one yet. That keeps background continuations spinning after the tool call itself returns, and makes the row clickable earlier. The fallback is skipped when the call failed: a bad continuation can name an unrelated session (like the parent itself, which is always running during the turn), and following it would make the errored row spin, hide its error, and open the wrong session on click.Visual
Out of scope
This PR only changes the TUI row. It doesn't touch the desktop or web apps.
Verification
bun typecheckinpackages/tui: passes