Skip to content

fix(sidebar): keep owned agent panes visible when their title carries no agent frame (#14464) - #14650

Open
OrcaWin wants to merge 1 commit into
mainfrom
OrcaWin/win-agent-status-14464
Open

OrcaWin wants to merge 1 commit into
mainfrom
OrcaWin/win-agent-status-14464

Conversation

@OrcaWin

@OrcaWin OrcaWin commented Aug 15, 2026

Copy link
Copy Markdown
Collaborator

ELI5

Orca decides "is this terminal an agent?" mostly by reading the terminal's title. Codex doesn't put its name in the title on Windows — it names the pane after the worktree (gh-13695), so Orca didn't recognise it. As soon as there was no live hook status to fall back on (right after a restart or an update), those Codex tabs simply disappeared from the sidebar and the Agent Dashboard, even though the process was still running fine. This makes Orca also trust what it already knows: which agent was launched in that pane.

What Changed

buildTitleDerivedAgentRow gains an owner fallback. When the pane's title yields no agent activity, but the pane has a known owner (launchAgent) and a live PTY, the row is emitted as an idle row for that owner instead of being dropped.

Guards kept deliberately tight — all covered by tests:

  • Shell titles still win. A title that is a shell process is positive evidence the agent exited and left its shell behind, so it must not resurrect a row. Uses the existing shared isShellProcess, which already handles Windows full-path titles (C:\...\pwsh.exe) and blank titles.
  • Unowned panes are unchanged — no launchAgent, no row. This path still never manufactures a row from a plain shell.
  • Dead PTYs are unchanged — the pre-existing tabHasLivePty gate is untouched.
  • Splits are unchanged. launchAgent is tab-scoped, so resolveTitleDerivedPaneOwner only returns an owner for a single-leaf layout; a split pane cannot brand its sibling.
  • The owner is a fallback, never an override. A title that names a live agent still decides identity and activity.

No platform branching: this is a correctness fix in shared agent-identity logic, and the guards above mean macOS/Linux behaviour only changes in the same case that was broken there too.

Why

A live agent pane with no hook status has exactly one row source: its terminal title. The gate was:

const status = classifyTitleActivity(title) ?? (isCursorAgentTitle(title) ? 'idle' : null)
const label  = resolveTitleActivityLabel(title)
if (!status || !label) return null   // <- pane dropped

ownerAgentType was already computed and passed into this function, but sat behind that gate and was unreachable. So a pane whose owner Orca knew for certain was still discarded.

That matters because Codex's pane title on Windows carries neither an agent name nor a status glyph. Captured live on this box with orca terminal list --json, then cross-referenced to each tab's persisted launchAgent: all 12 live Codex panes had titles like gh-13695, issue-13626-complete, pr-13977-best-review, or the neutral Terminal 1 — every one failing the gate. Grok and Claude panes on the same box carried agent-identifying titles (... - grok, claude) and were unaffected. That 1:1 correlation is what the new tests pin.

Consequence: whenever hook status is absent for a Codex pane — precisely the state after an app restart or update, before the next hook ping — the pane has no row source at all and drops out of buildWorktreeAgentRows, which feeds both the sidebar (useWorktreeAgentRows) and the Agent Dashboard (build-dashboard-snapshot). The PTY stays connected and writable the whole time, which is the reported symptom.

This is the same concession already made for Cursor's deliberately status-less native title (#10258, isCursorAgentTitle(title) ? 'idle' : null) — "it still identifies a live pane, so the row reads idle instead of vanishing". This widens it from one hard-coded literal to any known owner.

Linked Issue

Fixes #14464

Also expected to address STA-4054 (Codex agents not recognized as agents in Orca or the Agent Dashboard on Windows), which is the same root cause observed without a restart.

Visual Proof

N/A — could not capture. The Orca build on this Windows host is the packaged release with no --remote-debugging-port, so CDP inspection was unavailable, and relaunching it to attach a debugger would have destroyed 33 live PTYs belonging to other in-flight sessions on this box. The behaviour is instead pinned by unit tests asserting the exact row output (agentType, state, prompt, paneKey) for the real captured titles.

Testing

Windows 11 Pro (10.0.26200), win32 x64, platform confirmed at runtime.

Evidence gathering:

  1. orca terminal list --json on the live host to capture real pane titles.
  2. Cross-referenced each tabId against %APPDATA%\orca\profiles\local-default\orca-data.json to read its persisted launchAgent.
  3. Confirmed every worktree-name-titled live pane was launchAgent: "codex", and that Grok/Claude panes carried agent-identifying titles.

Automated:

  • 10 new tests in worktree-title-derived-agent-rows.test.ts — 5 positive (real captured Codex titles) and 5 negative guards (shell titles, unowned pane, dead PTY, split layout, agent-naming title wins).
  • Verified the new tests fail without the fix: stashing only the source change gives 5 failed | 25 passed; the 5 negative guards pass either way, as they should.
  • src/renderer/src/components/sidebar + src/renderer/src/components/dashboard: 294 files, 2646 tests passed.
  • Agent-status consumers (src/renderer/src/runtime, use-tab-agent*, worktree-status-spinner-launch-agent, agent-row-primary-text): 81 files, 857 tests passed.
  • oxlint on both changed files: clean.

Not run / known-failing for unrelated reasons:

  • Full pnpm typecheck was deliberately not run (OOM risk on this host, per task constraint). Types touched are narrow: formatAgentTypeLabel(AgentType | null | undefined) and isShellProcess(string).

  • oxfmt --check flags the changed files, but flags untouched files in the same directory identically — the known Windows CRLF false positive, not introduced here. No formatting was rewritten, to avoid polluting the diff with line-ending churn.

  • check:code-quality:changed fails with EINVAL spawnSync pnpm.cmd on Windows — a pre-existing harness issue; ran oxlint directly instead.

  • I manually tested these changes locally

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

Review

Ensure no issues in: Security, Cross-platoform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance

  • Cross-platform: no platform branching added. isShellProcess already normalises Windows full-path/.exe titles and POSIX basenames.
  • Remote SSH: unchanged. This function is title/owner-only and does no probing; the remote-specific handling lives in the callers.
  • Performance: one extra isShellProcess string check per title-derived pane, only on the path that previously returned null.
  • Backwards compatibility: purely additive to row construction — no persisted state, no wire format, no schema touched.

AI Disclosure

Claude Opus 4.5 (Claude Code), on a Windows host.

Checklist

  • This PR is small and focused
  • I explained what changed and why (including ELI5)
  • 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) — scoped equivalents run locally and green; full typecheck left to CI per the OOM constraint above

Author

  • X / Twitter: @BrennanKB5

… no agent frame

A live agent pane with no hook status has exactly one row source: its terminal
title. buildTitleDerivedAgentRow required that title to classify as agent
ACTIVITY, so a pane whose owner is known but whose title carries no agent frame
produced no row at all -- ownerAgentType was computed and passed in but sat
behind the `!status || !label` gate and was unreachable.

Codex titles its panes with the worktree name, so on Windows every live Codex
pane reads as e.g. "gh-13695" or the neutral "Terminal 1". Those panes are
therefore absent from the sidebar and the Agent Dashboard whenever hook status
is missing -- which is exactly the state after an app restart or update, so a
restored Codex tab vanishes while its PTY stays connected and writable.

Fall back to the pane's known owner for both status (idle) and label, the same
concession already made for Cursor's status-less native title (#10258), widened
from one literal to any known owner. A shell title still wins: it is positive
evidence the agent exited and left its shell, so it must not resurrect a row.
Ownership stays single-leaf-scoped, so a split cannot brand a sibling pane.
@coderabbitai

coderabbitai Bot commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The change adds owner-based fallback behavior for title-derived Codex rows. Owned panes with non-agent titles now produce idle rows with formatted agent labels. Shell titles, unowned panes, PTY-less panes, and panes owned by other split panes remain excluded. Explicit agent names retain precedence over launch metadata. Regression tests cover these cases.

Merge Risk: ⚪ Minimal · up to 6c597

The change keeps live owned agent panes visible without overriding agent identity derived from an informative title. No actionable merge-blocking risk remains; a minor follow-up could strengthen the precedence test by using a different launch owner.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning The PR addresses visibility in [#14464] but does not implement or test persisted tab migration, rehydration, or original PTY/thread attachment. Add migration and rehydration coverage and code that preserves tab metadata and restores the existing PTY and thread without creating a second writer.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the primary change: keeping owned agent panes visible when titles lack agent information.
Description check ✅ Passed The description is complete, explains the change and rationale, documents testing, and addresses visual proof and checklist requirements.
Out of Scope Changes check ✅ Passed The source changes and regression tests remain focused on title-derived agent-row visibility and its required ownership and shell guards.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: f8a7854f-9059-4ee4-90d1-86f6d00b1c8e

📥 Commits

Reviewing files that changed from the base of the PR and between 9cb04b5 and 6c59799.

📒 Files selected for processing (2)
  • src/renderer/src/components/sidebar/worktree-title-derived-agent-rows.test.ts
  • src/renderer/src/components/sidebar/worktree-title-derived-agent-rows.ts

Comment on lines +216 to +226
it('lets an agent-naming title win over the launch owner', () => {
const rows = buildWorktreeAgentRows({
tabs: [makeTab('tab-1', { title: '\u280b Codex', launchAgent: 'codex' })],
entries: [],
retained: [],
ptyIdsByTabId: { 'tab-1': ['pty-codex'] },
terminalLayoutsByTabId: { 'tab-1': makeSingleLayout(LEAF_ID_1) },
now: 2000
})

expect(rows.map((row) => [row.agentType, row.state])).toEqual([['codex', 'working']])

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Test title precedence against a different owner.

Both the title and launchAgent are codex. An owner-first implementation still passes this test. Set launchAgent to a different agent type and retain the expected Codex row.

Proposed test change
-        tabs: [makeTab('tab-1', { title: '\u280b Codex', launchAgent: 'codex' })],
+        tabs: [makeTab('tab-1', { title: '\u280b Codex', launchAgent: 'claude' })],
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
it('lets an agent-naming title win over the launch owner', () => {
const rows = buildWorktreeAgentRows({
tabs: [makeTab('tab-1', { title: '\u280b Codex', launchAgent: 'codex' })],
entries: [],
retained: [],
ptyIdsByTabId: { 'tab-1': ['pty-codex'] },
terminalLayoutsByTabId: { 'tab-1': makeSingleLayout(LEAF_ID_1) },
now: 2000
})
expect(rows.map((row) => [row.agentType, row.state])).toEqual([['codex', 'working']])
it('lets an agent-naming title win over the launch owner', () => {
const rows = buildWorktreeAgentRows({
tabs: [makeTab('tab-1', { title: '\u280b Codex', launchAgent: 'claude' })],
entries: [],
retained: [],
ptyIdsByTabId: { 'tab-1': ['pty-codex'] },
terminalLayoutsByTabId: { 'tab-1': makeSingleLayout(LEAF_ID_1) },
now: 2000
})
expect(rows.map((row) => [row.agentType, row.state])).toEqual([['codex', 'working']])

This branch has not been deployed

No deployments
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.

[Bug]: Keep running Codex session tabs visible across Orca updates

1 participant