Skip to content

fix(layout-owner): a background agent tab keeps its live title when another tab opens (dark, layout-owner build only) - #30131

Merged
Jinwoo-H merged 2 commits into
mainfrom
e2pre/sidebar-agent-row-identity
Oct 17, 2026
Merged

Jinwoo-H merged 2 commits into
mainfrom
e2pre/sidebar-agent-row-identity

Conversation

@Jinwoo-H

@Jinwoo-H Jinwoo-H commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​13 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​13
Prod 3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​35 $\color{#cf222e}{\Huge{\mathbf{−}}}$​12 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​23

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:

  • Keep every title the frame saves. Rejected: that title comes from the tab-bar label, which after a restart still holds an exited agent's title. Four startup parity tests caught it.
  • Overlay the titles after the rows are built, in the frame builder. This adds a new layout write the layout-writer ratchet rejects, so the keep moved into the row step instead.
  • Change the restore reset itself. Rejected: that would change shipped restore behaviour.

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 with expected '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:

    • sidebar spec: 0 vs 0 reports
    • workspace layout oracle and e1c evidence (21 tests): 0 vs 0
    • positive control cli-file-open-position: 1 vs 1 (same report kinds), so the empty logs are real
  • Gates:

    • pnpm tc passes
    • check:code-quality:changed passes
    • check:layout-writer-ratchets OK (renderer 651, main 211)
    • check:focus-read-ratchet OK
    • audit:anti-slop passes
    • vitest (4 workers) over app-shell, store, runtime, sidebar, dashboard and hooks/ipc-events: 1174 files and 10319 tests pass
  • Switch-off bundle diff: unminified, base vs head, chunk hashes normalised. Every change:

    • client.js hydrateWorkspaceTerminalRows / restoreCanonicalMetadata / buildWorkspaceTerminalRowPlan: the new optional live-title parameter. Restore passes nothing, so titleIsLive is false and the added spread is empty.
    • main/index.js and orchestration-setup-state.js: the build's source commit string only.
    • mdx.js / typescript.js: identical once chunk-hash references are normalised.
    • The frame builder itself is not in the switch-off bundle.
  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

AI Disclosure

Review

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

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

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

Jinwoo-H and others added 2 commits October 17, 2026 19:06
… 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]>
@coderabbitai

coderabbitai Bot commented Oct 17, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 17f73e64-55ce-48a8-be26-55f42b7afcaa
📥 Commits

Reviewing files that changed from the base of the PR and between 27cfee6 and 89a389e.

📒 Files selected for processing: 4
  • src/renderer/src/app-shell/startup-window-frame-parity.test.ts
  • src/renderer/src/store/slices/terminal-session-row-hydration.ts
  • src/renderer/src/store/terminals/workspace-terminal-row-plan.ts
  • src/renderer/src/store/workspace-layout-frame-slices.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 5 remain after this review.

📝 Walkthrough

The workspace layout flow collects live terminal titles from published tabs and passes their terminal IDs to the row planner. Row hydration preserves a title only when the row ID is in the supplied live-title set. A test verifies that a generated tab-shell row retains its live title.

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to 89a38

The change preserves live titles for background terminal tabs while leaving restore behavior unchanged; no concrete merge-blocking risk was identified.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 28.57% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 7 functions across 4 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly identifies the main fix: preserving a background agent tab's live title when another tab opens in layout-owner builds.
Description check Passed The description is detailed and covers the user impact, implementation, rationale, testing, scope, visual proof, and compatibility considerations. It leaves manual testing and several standard command…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description is detailed and covers the user impact, implementation, rationale, testing, scope, visual proof, and compatibility considerations. It leaves manual testing and several standard command checks unchecked, but it is mostly complete.

  • Fix all pre-merge checks with AI
✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Jinwoo-H
Jinwoo-H merged commit 0904ba0 into main Oct 17, 2026
64 of 66 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant