Repository navigation
fix(layout-owner): a background agent tab keeps its live title when another tab opens (dark, layout-owner build only) - #30131
Conversation
… agent title (dark, layout-owner build only) The frame slice builder reuses restore's row hydration, which resets any agent-activity title because a prior session's agents have exited. A title main reports live for a running pane is not stale, so rows keep it. Co-Authored-By: Claude <[email protected]>
… reset for live titles Moves the live-title keep into the row hydration so the frame builder adds no layout write of its own; restore passes nothing and is unchanged. Co-Authored-By: Claude <[email protected]>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ⬇️ Low Merge Risk: ⚪ Minimal · up to
|
ELI5
In the build where the main process owns the tab layout, opening a new tab made every other agent tab forget its live title. The sidebar then showed a background OpenCode tab as plain "OpenCode" instead of the task it was running. This keeps the live title. Shipped builds are unaffected.
What Changed
Before (layout-owner build only): an agent tab showing a live activity title (for example a spinner title like "use Claude Sonnet") lost that title as soon as another tab opened. The tab's title dropped back to "Terminal 2", and the sidebar agent row lost its task text. It showed only the agent name. This hits any background agent tab with a live activity title, not just OpenCode.
After: the title stays until the agent changes it.
Mechanism: when the layout changes, the window rebuilds its tab rows from the main process's layout frames. That rebuild reuses the restore-from-disk row step, which resets any agent activity title to the default title, because after a restart the old agent is gone. A title the main process reports live for a running pane is not stale. The frame builder now passes the tabs whose title the main process reports live into the row step, and the row step skips the reset for those rows.
workspace-layout-frame-slices.ts: works out the live titles once and uses them for both the saved title and the rows.workspace-terminal-row-plan.ts/terminal-session-row-hydration.ts: a new optional set of tab ids whose title is live. Restore from disk passes nothing, so it behaves as before.Why
The main process already published the right title in every frame. The window threw it away by applying a restart-only rule to live data, so the fix belongs where the window builds rows from frames. Alternatives considered:
Linked Issue
N/A (maintainer; layout-owner gate sweep finding)
Visual Proof
N/A: switch-off (shipped) builds are unchanged. The layout-owner build's change is shown by the end-to-end spec below, which reads the rendered sidebar row.
Testing
Failing first: the new unit test
keeps a live agent title a frame reports instead of resetting it as restore does(startup-window-frame-parity.test.ts) failed on the base withexpected 'Terminal 1' to be '⠋ use Claude Sonnet'.tests/e2e/sidebar-agent-row-identity.spec.ts:151, layout-owner build, hidden windows: base 0/3 pass, head 3/3. Switch-off build at head: 3/3.Save-divergence detector, layout-owner build, base vs head:
cli-file-open-position: 1 vs 1 (same report kinds), so the empty logs are realGates:
pnpm tcpassescheck:code-quality:changedpassescheck:layout-writer-ratchetsOK (renderer 651, main 211)check:focus-read-ratchetOKaudit:anti-sloppassesapp-shell,store,runtime,sidebar,dashboardandhooks/ipc-events: 1174 files and 10319 tests passSwitch-off bundle diff: unminified, base vs head, chunk hashes normalised. Every change:
client.jshydrateWorkspaceTerminalRows/restoreCanonicalMetadata/buildWorkspaceTerminalRowPlan: the new optional live-title parameter. Restore passes nothing, sotitleIsLiveis false and the added spread is empty.main/index.jsandorchestration-setup-state.js: the build's source commit string only.mdx.js/typescript.js: identical once chunk-hash references are normalised.I manually tested these changes locally
Automated tests added/updated, or explained why not below
AI Disclosure
Review
Agent skill upstream boundary
Notes
Ensure no issues in: Security, Cross-platoform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance
No platform-specific code. A paired server's workspaces are not drawn from local frames, so they are untouched. Folder workspaces and git worktrees take the same path. Performance: one set lookup per terminal row per frame rebuild.
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)