Repository navigation
fix(agents): surface Cline panes in worktree agent rows via a declared identity frame (STA-3906) - #14634
fix(agents): surface Cline panes in worktree agent rows via a declared identity frame (STA-3906)#14634brennanb2025 wants to merge 1 commit into
Conversation
…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.
|
Warning Review limit reached
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 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 configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (7)
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. Comment |
|
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. Status is what is actually missing, and a title cannot supply it here. As this PR itself establishes, cline 3.0.55 emits 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: 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 |
ELI5
Run
clinein 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).claudemoves onto it (itsCLAUDE_IDENTITY_FRAME_REwas already exactly this shape — deleted, behavior pinned by test).clineis declared on it. That is the whole Cline change.Wired through the four consumers that decide whether a pane is an agent:
agent-title-status.tsdetectAgentStatusFromTitleaccepts a declared identity frame as evidence, alongside the existing name-token matchersagent-title-identity.ts/terminal-title-agent-type.tsgetAgentLabelreturns the declared agent's display name;isClaudeAgent's spinner branch excludes other agents' framesworktree-title-derived-agent-rows.tsAgentTypefalls back to canonical display names, so a declared agent needs no third tableNet
+121/−22across 5 files, 2 new.Why
cline3.0.55 emitsOSC 0 ; Cline BELand nothing else — no hooks, no status transitions. I verified this by installing the real CLI and capturing its raw PTY stream:With no hook row, the pane falls to
buildTitleDerivedAgentRows, which needs both a status and a label. Pre-fix,Clineproduced neither:clineis deliberately absent fromAGENT_NAMES(that list is token-matched, and its own comment explains why it is "intentionally narrower than the full set of launchable agents"). SodetectAgentStatusFromTitle('Cline') === null,getAgentLabel('Cline') === null, andbuildTitleDerivedAgentRowreturnednull— the pane is invisible.Note what this proves about the framing in STA-2144:
clinewas already in theTuiAgentunion and inTUI_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 toTuiAgentdoes 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 inpi-compatible-synthetic-title.ts, Cursor's literal set inagent-title-core.ts, and the genericisIdentityStatusTitleinagent-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:
AgentType = WellKnownAgentType | (string & {})(agent-status-types.ts:43). An arbitrary agent id already renders.agent-status-osc.tsparsesESC ] 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.AGENT_NAMES' own comment: short names likeampwould classify"timestamp ready"as agent activity. A blanket reverse index over all 35TUI_AGENT_DISPLAY_NAMESentries would letamp,pi,cn,crush,gooseclaim ordinary shell and cwd titles. The registry in this PR is therefore observed-only by design, andagent-identity-frame.test.tspins that (AGENT_IDENTITY_FRAMES.ampmust stay undefined).aidersits inWellKnownAgentTypewith no hook endpoint, no normalizer, and no hook service — an entry that does nothing.clinesat inTuiAgentwhile 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:
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.OSC 9999as 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.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 titleCline) — 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
cline3.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:After —
Cline - Idlewith the Cline glyph and a live timestamp:Testing
Automated, and proven non-vacuous by running the new tests against pre-fix code (fix stashed):
With the fix: 9/9 pass. New coverage:
src/shared/agent-identity-frame.test.ts— frame acceptsCline/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); assertsampstays undeclared; pinsisClaudeIdentityFrameTitlebehavior across the shared-builder move.worktree-title-derived-agent-rows.test.ts— the actual ticket surface: a live pane titledClineproduces exactly one['cline', 'idle', 'Idle']row on the right pane key; Claude task text mentioning cline yields no row unowned and aclauderow when owned; a~/orca/workspaces/cline-scratchshell title yields no row.Suites run:
src/shared4682 passed / 19 skipped ·src/renderer23167 passed / 4 skipped ·src/main21499 passed, with 10 pre-existing failures insrc/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. Fullpnpm typecheckdeliberately 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/.ps1because Windows titles can surface the launcher name, andclineships as a.cmdshim 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.Review
DISPLAY_NAME_TO_AGENTis a fallback behind the existing label tables and is inert for every labelgetAgentLabelreturns today. Claude's frame regex was replaced by a generated one of identical shape, pinned by test.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)Author