Skip to content

fix(agents): surface Cline panes in worktree agent rows via a declared identity frame (STA-3906) - #14634

Closed
brennanb2025 wants to merge 1 commit into
mainfrom
brennanb2025/runtime-visibility-cline-13823
Closed

brennanb2025 wants to merge 1 commit into
mainfrom
brennanb2025/runtime-visibility-cline-13823

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Aug 14, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

Run cline in an Orca terminal and the worktree sidebar shows nothing — no agent row, no state dot, as if the pane were an empty shell. Cline does write a title saying who it is; Orca just had no rule that recognised it. This adds that rule, and puts it in one shared place so the next runtime is one line of data instead of a new regex threaded through five files.

What Changed

New: src/shared/agent-identity-frame.ts — one registry + one matcher for "this title PRESENTS agent X" (the agent's own name, optionally decorated with a spinner, optionally wrapped by a multiplexer, plus at most one status word or - action required).

  • claude moves onto it (its CLAUDE_IDENTITY_FRAME_RE was already exactly this shape — deleted, behavior pinned by test).
  • cline is declared on it. That is the whole Cline change.

Wired through the four consumers that decide whether a pane is an agent:

File Change
agent-title-status.ts detectAgentStatusFromTitle accepts a declared identity frame as evidence, alongside the existing name-token matchers
agent-title-identity.ts / terminal-title-agent-type.ts getAgentLabel returns the declared agent's display name; isClaudeAgent's spinner branch excludes other agents' frames
worktree-title-derived-agent-rows.ts label → AgentType falls back to canonical display names, so a declared agent needs no third table

Net +121/−22 across 5 files, 2 new.

Why

cline 3.0.55 emits OSC 0 ; Cline BEL and nothing else — no hooks, no status transitions. I verified this by installing the real CLI and capturing its raw PTY stream:

--- OSC sequences (8) ---
OSC 10 => "?"          OSC 11 => "?"        OSC 99 => "i=…:p=?;"
OSC 1337 => "Capabilities"                  OSC 66 => "w=1; "
OSC 66 => "s=2; "      OSC 4 => "0;?"       OSC 0 => "Cline"

With no hook row, the pane falls to buildTitleDerivedAgentRows, which needs both a status and a label. Pre-fix, Cline produced neither: cline is deliberately absent from AGENT_NAMES (that list is token-matched, and its own comment explains why it is "intentionally narrower than the full set of launchable agents"). So detectAgentStatusFromTitle('Cline') === null, getAgentLabel('Cline') === null, and buildTitleDerivedAgentRow returned null — the pane is invisible.

Note what this proves about the framing in STA-2144: cline was already in the TuiAgent union and in TUI_AGENT_CONFIG, and was still invisible. The closed set that hides a runtime is not the launch allowlist — it is the title-detection vocabulary: AGENT_NAMES, plus one bespoke predicate per agent, plus two label→type tables. Adding a runtime to TuiAgent does nothing for visibility.

Why a registry rather than a sixth predicate: the identity-frame shape was already hand-copied four times — Claude's CLAUDE_IDENTITY_FRAME_RE, the Pi/OMP regex in pi-compatible-synthetic-title.ts, Cursor's literal set in agent-title-core.ts, and the generic isIdentityStatusTitle in agent-row-conversation-name.ts. Each copy meant a new regex plus edits at every call site. This collapses the shape to one place; Pi/OMP and Cursor can migrate later (they carry extra synthetic-spinner behavior, so they are deliberately not in this PR).

Is the long-term fix (a) more allowlist entries, or (b) generic discovery?

(b) — but only for declared identity, never for inferred identity. Title inference cannot be made generic, and the code says so.

Justification from the code:

  1. The type system is already open. AgentType = WellKnownAgentType | (string & {}) (agent-status-types.ts:43). An arbitrary agent id already renders.
  2. A generic in-band path already exists and is not agent-gated. agent-status-osc.ts parses ESC ] 9999 ; on every PTY before xterm, for any process. Any agent that emits it surfaces today with zero code change. That is the (b) mechanism, already shipped — what is missing is that no third-party CLI knows to emit it.
  3. Title inference cannot be opened up. AGENT_NAMES' own comment: short names like amp would classify "timestamp ready" as agent activity. A blanket reverse index over all 35 TUI_AGENT_DISPLAY_NAMES entries would let amp, pi, cn, crush, goose claim ordinary shell and cwd titles. The registry in this PR is therefore observed-only by design, and agent-identity-frame.test.ts pins that (AGENT_IDENTITY_FRAMES.amp must stay undefined).
  4. The allowlist demonstrably rots. aider sits in WellKnownAgentType with no hook endpoint, no normalizer, and no hook service — an entry that does nothing. cline sat in TuiAgent while its panes stayed invisible.

So the shape that actually closes the class is: identity must be a declared fact, not a parse. Three declaration channels, in descending order of how much they solve:

  • User-declared agent definitions. A settings-level "custom agent" record (id, display name, launch command, identity title) that flows into the same registry this PR introduces. Adding a runtime becomes a user action, not a release. This is the real fix for [Bug]: Agents running inside a user's tmux session are not detected/shown as running #7797 too, since a user who declares the agent no longer depends on Orca guessing through a multiplexer's title. Rough cost: a settings schema + store slice + migration, the registry merge (already the seam this PR creates), and settings UI — a few hundred lines, one focused PR.
  • Agent-declared status. Publish OSC 9999 as a documented contract so a CLI opts into full status without Orca knowing it exists. Zero Orca code per runtime; cost is advocacy, not engineering.
  • This PR's registry. The bridge for CLIs that do neither: one declarative row per observed runtime, instead of a regex spread over five modules.

Continuing with (a) is defensible only as the residue after those exist. I did not attempt the user-declared definition here — it is not small, and bundling it would bury a P0.

Scope this PR does not cover, deliberately: #13840 (Cline in the Agents / AI Vault panel) is a different layer. AI Vault sources are transcript-file walkers (remote-session-scanner-sources.ts), and cline stores sessions in SQLite (~/.cline/data/db/sessions.db), not JSONL — so it needs a new source kind that also works over SSH, where Orca reads files rather than opening databases. That is its own PR.

Linked Issue

Fixes #13823

Supersedes #13959 (@OrcaWin) — same root cause, same verified premise, and its tests informed these. Superseded rather than merged because it adds a fifth hand-copied identity regex instead of removing the duplication, and its status vocabulary (Cline ready/working/- action required) was asserted without the CLI being observed. This PR keeps that vocabulary — it is the repo-wide synthetic-title convention (synthetic-agent-title.ts), so it is right for forward-compat — but says plainly in code that cline's live title is static.

Related, not fixed here: #13840 (AI Vault, see above), STA-2144 (the class), #7797 (multiplexers).

Visual Proof

Same worktree, same live PTY, same store input (runtimePaneTitlesByTabId = { <tab>: { 1: "Cline" } }, tab title Cline) — captured on two separate launches of an isolated dev instance from this worktree, one on the parent commit and one on this commit. Not an HMR flip.

The title was produced by a real PTY emitting the exact bytes captured from cline 3.0.55: 1b 5d 30 3b 43 6c 69 6e 65 07 (ESC ] 0 ; C l i n e BEL).

Before — the pane is live and the tab is labelled Cline, but the worktree card has no agent row at all:

before-sidebar.png

After — Cline - Idle with the Cline glyph and a live timestamp:

after-sidebar.png

Testing

Automated, and proven non-vacuous by running the new tests against pre-fix code (fix stashed):

FAIL  Cline title visibility (STA-3906 / #13823) > resolves the live Cline title …
  expect(getAgentLabel('Cline')).toBe('Cline')   →  expected null to be 'Cline'
FAIL  Cline title visibility (STA-3906 / #13823) > maps decorated Cline frames …
  expect(detectAgentStatusFromTitle('Cline ready')).toBe('idle')  →  expected null to be 'idle'
Tests  2 failed | 7 passed (9)

With the fix: 9/9 pass. New coverage:

  • src/shared/agent-identity-frame.test.ts — frame accepts Cline / cline.cmd / ⠋ Cline / zsh | Cline; rejects ⠋ use cline for the sidebar fix, ~/cline-scratch, cline-rules, src/cline/index.ts, clinent; rejects free-form trailing text (Cline working on the parser); asserts amp stays undeclared; pins isClaudeIdentityFrameTitle behavior across the shared-builder move.
  • worktree-title-derived-agent-rows.test.ts — the actual ticket surface: a live pane titled Cline produces exactly one ['cline', 'idle', 'Idle'] row on the right pane key; Claude task text mentioning cline yields no row unowned and a claude row when owned; a ~/orca/workspaces/cline-scratch shell title yields no row.

Suites run: src/shared 4682 passed / 19 skipped · src/renderer 23167 passed / 4 skipped · src/main 21499 passed, with 10 pre-existing failures in src/main/ipc/pty.test.ts (ZDOTDIR/shell-ready) that reproduce identically on a clean checkout of this branch's base — unrelated to this change.

Also clean: oxfmt, oxlint, oxlint --config config/oxlint-code-quality-native-plugins.json (--deny-warnings), oxlint --type-aware --config config/oxlint-code-quality-type-aware.json (--deny-warnings), react-doctor changed-lines. Full pnpm typecheck deliberately not run locally (OOM risk on this machine); the changed shared modules typecheck standalone under --strict, and CI covers the rest.

Platforms: logic is platform-independent and lives in src/shared. The frame accepts .exe/.cmd/.bat/.ps1 because Windows titles can surface the launcher name, and cline ships as a .cmd shim there. Not exercised on a Windows host. Remote/SSH is unaffected — this path consumes the OSC title Orca already forwards, and adds no RPC field, stream opcode, or host-published content.

  • I manually tested these changes locally
  • Automated tests added/updated, or explained why not below

Review

  • Security — no new I/O, no process spawn, no network. Regex is anchored, bounded, and built from a compile-time constant list.
  • Cross-platform — shared module, no path or platform assumptions; Windows launcher suffixes handled.
  • Remote SSH — no wire change. Titles already cross the relay; this only reinterprets one locally.
  • Mobile — the same shared detection feeds mobile agent labels, so a Cline pane now labels correctly there too. No payload change.
  • Backwards compatibility — DISPLAY_NAME_TO_AGENT is a fallback behind the existing label tables and is inert for every label getAgentLabel returns today. Claude's frame regex was replaced by a generated one of identical shape, pinned by test.
  • Performance — two anchored regex tests per title update, on strings capped at 200 chars.

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)

Author

  • X / Twitter: @BrennanKB5

…d identity frame (STA-3906)

cline writes OSC 0 `Cline` and posts no hooks, so the pane fell out of the
sidebar entirely: `cline` is absent from AGENT_NAMES (deliberately — those names
are token-matched and too common), so getAgentLabel and detectAgentStatusFromTitle
both returned null and buildTitleDerivedAgentRow dropped the row.

Rather than add a fifth hand-copied identity regex, move the shape Claude already
used into a shared registry and declare Cline in it.
@coderabbitai

coderabbitai Bot commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@brennanb2025, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 1 minute

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 879f3f48-06db-4e0b-a119-544b9914efdd

📥 Commits

Reviewing files that changed from the base of the PR and between 500b72d and 7bddc11.

📒 Files selected for processing (7)
  • src/renderer/src/components/sidebar/worktree-title-derived-agent-rows.test.ts
  • src/renderer/src/components/sidebar/worktree-title-derived-agent-rows.ts
  • src/shared/agent-identity-frame.test.ts
  • src/shared/agent-identity-frame.ts
  • src/shared/agent-title-identity.ts
  • src/shared/agent-title-status.ts
  • src/shared/terminal-title-agent-type.ts

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.

@brennanb2025

Copy link
Copy Markdown
Contributor Author

Closing as not planned.

This surfaces the agent by parsing its terminal title. That is the wrong signal for this runtime, for two reasons.

Identity is already available, from a stronger source. recognizeAgentProcess (src/shared/agent-process-recognition.ts) resolves the agent from the PTY's foreground process name, and Cline is already in that table (expectedProcess: 'cline'). A process name is what is actually executing; a title is a string the agent chose to print, and any other program can print the same string. Trading the former for the latter is a downgrade.

Status is what is actually missing, and a title cannot supply it here. As this PR itself establishes, cline 3.0.55 emits OSC 0 Cline and never varies it — so there are no status transitions to read. The title yields identity only, which we already have. Nothing here closes the real gap.

This PR also moved Claude's identity regex into a new shared registry. Closing it leaves Claude's existing detection completely untouched, which is the safer outcome.

The remaining problem is genuinely a plumbing one: pty.foregroundAgent is computed but consumed only by the mobile session snapshot path (orca-runtime.ts:7614), so it never reaches the sidebar row builder. That is the fix worth making, and it is tracked in #15055.

Revisit when Cline supports hooks — that is the only source that can report turn state truthfully.

The empirical work here was still worth doing: installing cline 3.0.55 and capturing its raw PTY stream is what established that it emits OSC 0 only, and that finding is what makes the case for closing this.

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.

Cline terminals don't appear in sidebar agent rows

1 participant