Repository navigation
Fix stale working spinners on remote terminal tabs - #25205
thefrikidude wants to merge 4 commits into
Conversation
|
No actionable comments were generated in the recent review.
|
There was a problem hiding this comment.
Important
One existing test regresses: the new layout-leaf guard in worktree-status.ts drops live pane titles, not just removed ones.
Reviewed changes
- Reconcile mirrored runtime pane titles — new
runtime-pane-title-patch.tsrefreshes/deletesruntimePaneTitlesByTabIdfrom accepted host surface titles, skipped forterminalPtyMode === 'local'. - Host status over expired client rows — an existing mirrored
agentStatusByPaneKeyrow no longer blocks a host entry on timestamp alone once it is no longer fresh. - Worktree dot ignores layout-orphan pane titles —
tabHasStatusfilters pane titles bycollectRuntimePaneLeafIds(layout.root)and falls through to the tab title when none survive. - State plumbing + tests —
runtimePaneTitlesByTabIdadded to sync state/batch keys, plus stale-spinner and completion-on-reveal coverage.
deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏
| : freshPaneIds | ||
| const leafId = resolveRuntimePaneTitleLeafIdFromRoot(tabLayoutRoot, runtimePaneId) | ||
| // A removed pane's last title is no longer evidence for this tab. | ||
| if (layoutLeafIds && (leafId === null || !layoutLeafIds.has(leafId))) { |
There was a problem hiding this comment.
This guard drops every runtime pane title whose id does not resolve to a current leaf, but resolveRuntimePaneTitleLeafIdFromRoot returns null for ids it simply cannot place — not only for removed panes. It has no single-leaf special case and no sparse-slot recovery, so a live pane title is discarded. The row builder resolves those same ids via resolveLeafIdForTitleFallback (leafIds.length === 1 → leafIds[0], otherwise resolveRuntimePaneTitleLeafIdFromSparseSlots), so the worktree dot now disagrees with the sidebar rows.
Technical details
# Live pane titles dropped as layout orphans
## Affected sites
- `src/renderer/src/lib/worktree-status.ts:102` — skips any entry with `leafId === null || !layoutLeafIds.has(leafId)`. `leafId === null` also covers ids that cannot be resolved (single-leaf layouts, gapped PaneManager ids, the `-(leafIndex+1)` parked slots), not just leaves removed from the layout.
- `src/renderer/src/runtime/web-session-tabs-sync/runtime-pane-title-patch.ts:54` — same resolver, so a mirrored tab with a single leaf and a sparse/gapped runtime slot (`leafId === null`) has no `hostSurface` and gets its title deleted rather than refreshed.
## Evidence
- `pnpm test src/renderer/src/lib/worktree-status-spinner-launch-agent.test.ts` fails at line 121: `expected 'active' to be 'working'`. The fixture (`worktree-status-spinner-launch-agent.test.ts:112`) uses a single-leaf layout with pane id `0` and a spinner pane title; base returned `working`, the PR returns `active`.
- The row builder's `resolveLeafIdForTitleFallback` (`components/sidebar/worktree-title-derived-agent-rows.ts:301-351`) deliberately handles both cases: `if (args.leafIds.length === 1) return args.leafIds[0]` and sparse-slot PTY recovery. `PaneManager.nextPaneId = FIRST_PANE_ID` and ids are never reused (`nextPaneId` only increments), so a current pane's id is commonly non-contiguous after any in-session close.
## Required outcome
- A pane title whose id is a live pane in a single-leaf tab, or is recoverable through the durable PTY→leaf bindings, must still count as current evidence.
- Orphan detection should only fire when the id resolves to a leaf that is provably absent from the current layout.
## Suggested approach (optional)
- Skip only on `leafId !== null && !layoutLeafIds.has(leafId)`; let `leafId === null` fall through to the existing title/single-unmapped handling.
- Or reuse `resolveLeafIdForTitleFallback` here so the dot and row builder share one resolution rule.
- If the intended scope really is "any unresolvable id is an orphan", update `worktree-status-spinner-launch-agent.test.ts:112` and explain the dot/row divergence in the test.Only titles whose pane is provably gone (a leaf id missing from the layout, or an out-of-range numeric slot) are dropped; legacy and parked ids below FIRST_PANE_ID stay live, so the worktree dot agrees with the sidebar rows again. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013M6h74D6AvPqqNHRAddayF
|
Fixed the regression the review flagged. A pane title is now dropped only when its pane is provably gone: a leaf id missing from the layout, or an out-of-range numeric slot. Ids below |
|
Thanks for working on this. I had opened #34129 for a related completion symptom; comparing it with your change and the host fix in #29538 uncovered a regression in my approach. I'm withdrawing that competing implementation and sharing the regression case here instead.
The earlier state-start time on the final I replayed those two projected rows through the real renderer snapshot/store harness in
This is a focused comparison of the merge conditions, not validation of either complete PR, and not a live paired-app test. It confirms that your condition preserves this existing host-side fix; it does not distinguish the two proposals or establish that either resolves every case in #25136. If useful, this test can be added inside the existing remote status/title suite (reusing its helpers). The values above come from the host regression fixture based on #28102, rather than an assumed ordering of state-start times: it('accepts the host completion after a trailing Muse spinner', () => {
const store = seedPairedClientStore()
const rows = [
{
state: 'working',
updatedAt: T0 + 4_534,
stateStartedAt: T0 + 4_534
},
{
state: 'done',
updatedAt: T0 + 4_800,
stateStartedAt: T0,
evidenceObservedAt: T0
}
] as const
for (const [index, row] of rows.entries()) {
applyHostSnapshot(
store,
makeHostSnapshot({
snapshotVersion: index + 1,
hostNow: row.updatedAt,
includeAgentStatus: true,
agentStatusOverrides: row
}),
row.updatedAt
)
expect(store.getState().agentStatusByPaneKey[MIRROR_PANE_KEY]?.state).toBe(row.state)
}
})Shared with the author's authorization; investigation and test execution assisted by OpenAI Codex. Thank you for the existing implementation and reproduction work. |
main moved tab-has-live-pty and runtime-pane-title-leaf-id into shared/ and regrouped the remote runtime client modules. Use the shared import paths in worktree-status and runtime-pane-title-patch, and point the two new tests at the modules' new homes (snapshot-api, state, terminal-surface-id, use-web-session-tabs-sync, the frame-ordering test harness and web-runtime-terminal-creation). Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Adapt the remote completion repair from #25205 while preserving sparse runtime pane slots through existing PTY bindings. Co-authored-by: Manan Chataut <[email protected]>
* fix(remote): reconcile stale paired agent status and pane titles Adapt the remote completion repair from #25205 while preserving sparse runtime pane slots through existing PTY bindings. Co-authored-by: Manan Chataut <[email protected]> * fix(remote): preserve pane identity when reconciling moved titles Use mounted manager identities and retained PTY bindings ahead of replay order; keep fresh byte-stream ownership on the correct moved pane. * fix(remote): release byte status fence after host approval * fix(remote): tighten paired title removal and test the timing fence - Share the byte-write timing decision (resolveRendererOwnedAgentStatusTiming) between pty-connection and the flap test so reverting it fails a test. - Only delete a saved pane title when its durable leaf is absent from both the host layout and local panes; unresolved or surface-less slots are kept. - Share the client-fence predicate (clientAgentStatusFencesHost) between status and title reconciliation. - Cover removed-leaf spinner fallback in worktree status and a client split absent from a pre-split host snapshot. * fix(remote): correct fence predicate and title test types --------- Co-authored-by: Manan Chataut <[email protected]>

ELI5
A remote client can keep showing a working spinner after an agent has finished. This change refreshes stale terminal titles and status from the host so completed agents stop looking busy.
What Changed
Why
Saved spinner titles could outlive the activity that produced them. Updating the tab title alone left those pane titles behind.
This uses the existing remote snapshot flow. Valid numeric runtime pane IDs are refreshed rather than removed globally, because local terminal replay still uses them. The existing fresh byte-stream ownership protection is preserved.
Linked Issue
Fixes #25136
Visual Proof
After: normal completion tested with two source-built Orca instances on one Mac.
Screen.Recording.2026-10-04.at.2.05.26.PM.mov
Testing
Manual testing: connected two Orca instances on macOS, ran an agent task on the host, and confirmed the loader cleared on both instances after completion.
Automated validation:
Full validation:
pnpm lintpassed.pnpm typecheckpassed after correcting regression-test typings.document is not defined.pnpm buildfailed during the mobile web step because dependencies includingreact-native-webandexpo-routerwere missing. Desktop bundles and the web client built successfully.AI Disclosure
Developed with assistance from OpenAI Codex (GPT-6), including implementation, regression tests, and code review.
Review
Agent skill upstream boundary
Notes
Linux, Windows, SSH, and mobile manual verification remain pending. Existing visibility-resume subscriptions are retained; this does not keep hidden windows continuously synchronized.
Author X handle: @thefrikidude
Checklist