Skip to content

fix(terminal): stop Orca mangling the OMP/Pi title it writes itself - #16381

Merged
nwparker merged 8 commits into
mainfrom
nwparker/omp-title-flap-redesign
Aug 25, 2026
Merged

nwparker merged 8 commits into
mainfrom
nwparker/omp-title-flap-redesign

Conversation

@nwparker

@nwparker nwparker commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 12 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​329 $\color{#cf222e}{\Huge{\mathbf{−}}}$​261 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​68
Prod 6 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​93 $\color{#cf222e}{\Huge{\mathbf{−}}}$​67 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​26

ELI5

An OMP tab title flickered between "OMP" and "Pi" about 12 times a second, rebuilding store state on every flicker.

It turns out OMP sends neither of those strings. Orca was writing the tab title (via its own extension), then mangling its own writing into "Pi", then fighting the result with a third writer of its own that said "OMP". This fixes all three, so the title just says what the session actually is.

The actual root cause

Verified against oh-my-pi/packages/coding-agent/src/utils/title-generator.ts:

:25   DEFAULT_TERMINAL_TITLE = "π"
:530  π ⠋ <label>   working (80ms spinner, :492)
:544  π > <label>   idle
      π ! <label>   attention

OMP only ever writes the π glyph — never "OMP", never "Pi". And on an Orca-hosted pane its native titler doesn't even run: setExtensionTerminalTitle (extension-ui-controller.ts:113) cedes the title to Orca's own injected extension (src/main/pi/titlebar-extension-source.ts:21,44), which writes π - <session> - <cwd> and ⠋ π - <session> - <cwd> every 80ms.

Both flapping strings were manufactured by Orca:

string source
⠋ Pi normalizeTerminalTitle collapsing our own extension's output to a hardcoded literal
⠋ OMP driveSyntheticTitleFromHook injecting over it every 80ms

Measured through Orca's real normalizer before this change:

"π ⠋ fixing the sidebar"  ->  "⠋ Pi"
"π > fixing the sidebar"  ->  "Pi"
"π ! fixing the sidebar"  ->  "Pi"     ← attention collapsed to idle

The discarded <session> - <cwd> is #16093. The π ! collapse meant a blocked OMP agent read as idle. And pi-compatible-synthetic-title.ts:47-49 already documented that bare Pi/OMP labels exist because of this collapse — the codebase was round-tripping its own damage.

What changed

Four shared files, at the source:

  1. normalizeTerminalTitle canonicalizes only the rotating braille frame and keeps brand, separator, session and cwd. Handles both spinner positions — leading (⠋ π - …, Orca's extension) and medial (π ⠋ label, OMP native) — and wrapper prefixes, which fixes the flap under tmux/Zellij ([Bug]: Zellij-wrapped OMP titles cause Orca tab label flicker #8032).
  2. detectAgentStatusFromTitle reads the π state separator: π ! → permission (was idle), π > / π: / π - → idle. A spinner outranks the separator.
  3. normalizeCompatibleAgentTitleForOwner swaps only the brand for the owner's label, so a pane still reads as its launch owner (Fix remote OMP terminal title thrash #6689, Fix OMP worktree title identity flicker #7633, fix(pi): stop OMP tab icon flashing to Pi while working #9077) without discarding the session text ([Bug]: OMP/pi 语义会话标题被 synthetic title 覆盖,tab 永远显示 OMP - Running #16093). π - tmp + owner omp → OMP - tmp, not OMP ready.
  4. pi/omp → synthesizeWorkingTitle: false — the agent animates its own working title. Terminal states still synthesize, because they carry the pane's agent identity downstream.

Plus a revert of #16373's ingest rewrite, whose normalization of runtimePaneTitlesByTabId also changed Windows Shift+Enter bytes (repaired in #16376, which stays).

18 files, +353/-328.

Design decisions worth reviewing

Why not synthesizeTerminalTitle: false (the OpenCode precedent, and the stronger form of #16234)? I tried it first; it broke 9 identity tests. Orca uses the synthetic title as an identity carrier, not just display text. Narrowing to working-only keeps that carrier and still removes the competing writer during the 12/sec window.

Why brand-swap instead of pass-through? Passing the π title straight through preserved the session label but reversed the deliberate owner-identity pinning from #6689/#7633/#9077. Swapping the brand in place satisfies both constraints.

Case-sensitivity on the separator. PI_COMPATIBLE_SEPARATOR_RE matches only π, Pi, OMP in exact profile casing, because the owner rewrite only ever emits ownerProfile.workingLabel. Case-insensitive matching classified omp - deploy notes and pi - refactor the parser as idle agents. Regression-tested.

Proof

Status round-trip holds — a normalized or owner-rewritten title re-classifies exactly as its source did (the invariant the old collapse existed to guarantee), including the π - gemini cwd case from #7447:

title status normalized status
⠋ π - fixing the sidebar - orca working ⠋ π - fixing the sidebar - orca working
π - fixing the sidebar - orca idle (unchanged) idle
π ! fixing the sidebar permission (unchanged) permission
zsh | ⠙ π - a - b working zsh | ⠋ π - a - b working

Owner rewrite: ⠋ π - fix - orca + omp → ⠋ OMP - fix - orca (working → working); π ! label → OMP ! label (permission → permission).

No false positives: omp-harness ready, pi-scratch ready, pipeline - build, pip - install, npm - run build, pi - refactor the parser, omp - deploy notes all classify as no agent.

Testing

  • I manually tested these changes locally (no OMP install in this environment)

  • Automated tests added/updated

  • New src/shared/omp-pi-semantic-title-preservation.test.ts — frame collapse in both spinner positions, multiplexer prefix, distinct sessions staying distinct, separator classification, owner brand-swap, status round-trip, false-positive guards.

  • ~35 assertions updated across 10 files that pinned the old collapsed literals. Each updated to the new contract; identity expectations left untouched.

  • Post-rebase: 23,739 passed / 76 skipped across shared, lib, sidebar, terminal-pane, store, main/runtime. Full suite: 58,547 passed, with the only failures pre-existing environment ones (macOS @parcel/watcher, native-chat transcript watch, electron-vite dev, a DOM repack test) — confirmed failing on a clean tree with zero changes.

  • npm run typecheck exit 0, pnpm lint exit 0. CI green (47 passed / 1 skipped).

Review

  • Security: none — string parsing only.
  • Cross-platform: no platform-dependent behavior. Removes the Windows keyboard hazard by not rewriting stored pane titles. Note OMP itself uses π : label (not a spinner) on Windows/ConPTY — that classifies idle via the separator, same as before.
  • SSH/remote: no schema or opcode change. Hosts publish the preserved form to paired clients; isLegacyPiCompatibleTitle shipped 2026-07-05 (Prevent OMP terminals from being mislabeled as Gemini #7447), before the collapse it replaces (Fix Grok and Pi terminal title normalization and status detection #7880, 2026-07-08), so every client new enough to contain today's behavior classifies the new form correctly. Clients older than 2026-07-05 would not — a ~7-week floor, flagged as a product call.
  • Mobile: imports the same shared modules; preserved forms resolve to pi with leading decoration stripped. Same floor.
  • Agent compatibility: scoped to pi/omp. Claude, Codex, OpenCode, Droid verified unchanged.
  • Backcompat: persisted pre-upgrade "Pi" / "⠋ Pi" values still classify — PI_COMPATIBLE_SYNTHETIC_TITLE_RE is a separate matcher and is retained deliberately.
  • Performance: strictly reduces work — the churn it removes was ~12 committed store patches/sec per working OMP tab, each dragging a runtime-graph sync.

Staff review

Two independent senior-staff reviews: nothing blocking, root cause genuinely fixed, merge-ready. Both verified empirically against the real functions rather than by reading:

  • Round-trip and idempotency confirmed for every shape — leading, medial, wrapper-prefixed, and no-spinner forms. normalizeTerminalTitle is structurally idempotent (every braille codepoint maps to ⠋, which maps to itself).
  • Churn dies at the store, not just in unit tests: canonical frames make consecutive ticks string-identical, so applyTrackedPtyTitle records no change per frame and mobile fanout stays quiet.
  • Mixed-version wire compat verified both directions. Synthetic titles never entered the PTY byte stream (they were injected renderer-side), so an old host's alternation reaches a new client only through snapshot surfaces, which still pin stable through normalizeCompatibleAgentTitleForOwner. New host + old client: the old client's fix(terminal): stop OMP tab title flapping between OMP and Pi #16373 ingest relabel becomes a harmless no-op.
  • synthesizeWorkingTitle: false challenged hard. The flag has exactly two consumers in the tree. Attention, unread, notifications and smart sort all key on status detected from the raw title, never on a synthetic string — and ⠋ π - … detects working via the spinner glyph. There are zero non-test '⠋ Pi' / '⠋ OMP' literals in src/.

Three non-blocking findings were raised and all three are fixed in this PR:

  1. getPiCompatibleTitleSeparatorStatus('OMP - action required') returned idle — - is both a state separator and the permission label's delimiter. It resolved correctly only because callers happen to check the synthetic label first, and the function is exported. The guard now lives inside the function, with a pinning test.
  2. The owner rewrite's fixed-point property is load-bearing on getAgentLabel not tokenizing omp/pi. Pinned with a test so a future tokenizer addition fails loudly instead of silently collapsing titles.
  3. A comment overstated how tightly the brand swap is scoped (a wrapper prefix that itself parses as a π title takes the whole string). Corrected.

Known limitation

Bare π — OMP's default title when it has no label — classifies as no agent. Pre-existing and unchanged here, but now adjacent to code that cites the constant.

canonicalizeBrailleSpinnerFrame rewrites every braille codepoint in the title, so a session name containing braille would have those glyphs canonicalized too. Contrived and cosmetic.

Wrapped idle titles under a multiplexer (zsh | π - a - b) still aren't classified, because detectAgentStatusFromTitle is anchored for the non-spinner path. Pre-existing; not widened here. Wrapped working frames — the actual churn — are covered.

Credit

Co-authored with @psh4607 (Seongho.Bak). Their #16234 investigation established that OMP owns its own OSC title and that Orca's synthetic writer was overwriting it — the thread that led to this diagnosis. synthesizeWorkingTitle: false here is their fix; this PR adds the label preservation that makes it fully effective.

Supersedes the approach in #16373 (reverted here). #16376 stays.

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
  • pnpm lint, pnpm typecheck pass

@coderabbitai

coderabbitai Bot commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The change preserves OMP and Pi session and working-directory text during title normalization. Braille spinner frames are canonicalized, and separator states receive explicit status classification. Ownership conversion replaces only the compatible agent brand. OMP and Pi working-title synthesis is disabled while terminal-state synthesis remains active. Runtime title updates now process supplied titles directly. Regression tests cover normalization, ownership, PTY flows, runtime propagation, sidebar titles, and published tab titles.

Merge Risk: 🟡 Moderate · up to 60fd8

The change stops title flicker and preserves session identity, but multiplexer-wrapped permission or idle titles may still be shown without the correct agent state, which can mislead users about whether an agent needs attention. Merge should wait for this bounded classification issue to be addressed or explicitly accepted.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 36.36% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 11 functions across 18 files. (1 skipped:… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the primary change: preventing Orca from mangling OMP/Pi terminal titles.
Description check ✅ Passed The description is detailed and on-topic. It explains the root cause, implementation, design decisions, testing, compatibility impact, known limitations, and review status. Some template headings are …
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 on-topic. It explains the root cause, implementation, design decisions, testing, compatibility impact, known limitations, and review status. Some template headings are not reproduced explicitly, including Linked Issue and Visual Proof, but the core change and validation information are complete.

Full details: Docstring Coverage

Explanation

Docstring coverage is 36.36% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 11 functions across 18 files. (1 skipped: 1 too large.)

✨ Finishing Touches 💡 1
📝 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.

@nwparker

Copy link
Copy Markdown
Contributor Author

Scope correction pushed

Post-review found a real bug in the first version of this PR, now fixed in cc03284caff.

collapseCompatibleAgentTitleIdentity used getProfileForTitle, which also matches a legacy π - <session> - <cwd> title via isLegacyPiCompatibleTitle (src/shared/pi-compatible-synthetic-title.ts:7). So two genuinely different session titles collapsed to the same token and compared equal:

collapse("π - fixing the sidebar - orca") = "pi-compatible"
collapse("π - writing tests - orca")      = "pi-compatible"
suppressed = true   <-- session title change never committed

That is #16093's complaint reintroduced through the signature — the exact thing this PR's predecessor was careful to avoid. My original test suite missed it because it only asserted that a single semantic title passes through storage unmodified, never that a change between two still commits.

Fix: fold only exact bare identity frames, matched per wrapper segment via getPiCompatibleSyntheticAgentLabel (anchored ^…$, so it cannot match a title carrying session text). Wrapper coverage is preserved by testing each segment rather than by broadening the matcher.

Full matrix, measured through the real suppressor:

prev → next suppressed
⠋ OMP → ⠙ Pi true the flap
OMP ready → Pi true idle-side flap
zsh | ⠋ Pi → zsh | ⠙ OMP true #8032
⠋ OMP → OMP ready false real status change
⠋ OMP → ⠙ Codex false cross-group identity
⠋ Claude → ⠋ Codex false unrelated agents
π - fixing sidebar - orca → π - writing tests - orca false the regression above
π - a - orca → ⠋ Pi false semantic → bare
⠋ Claude → ⠙ Claude true pre-existing spinner collapse

Regression test added for the semantic-change case. Suite is now 8 tests.

Re-verified: 19,785 passed / 67 skipped across src/shared/, store, terminal-pane, sidebar, lib, runtime (no flake this run). npm run typecheck exit 0, pnpm lint exit 0.

Deliberately not in this PR

Render-time owner relabel. Without it, a tab whose first committed frame was ⠋ Pi can display Pi for an OMP-launched session — the stable-but-possibly-wrong-label case (#12870), distinct from the flap this PR fixes. Adding it means threading launchAgent into resolveTerminalTabTitle and touching every call site, and it must normalize only the live-title candidate so custom / quick-command / generated / AI-Vault labels in the precedence chain are never re-owned (src/shared/tab-title-resolution.ts:13-21). That belongs in its own PR.

Known limitation

A genuine same-group handoff in one pane (quit OMP, run pi) at unchanged status is observationally identical to wrapper alternation, so the previous label persists until the next status transition, semantic frame, or cross-group frame commits. Self-healing and bounded to one turn. This is inherent to treating pi-compatible as one pane identity — which is what the group already means everywhere else in the codebase.

@nwparker nwparker changed the title fix(terminal): collapse identity group in the title churn signature fix(terminal): stop the OMP/Pi title churn, and revert the ingest rewrite Aug 25, 2026
@nwparker
nwparker force-pushed the nwparker/omp-title-flap-redesign branch from 02d4179 to 52eab18 Compare August 25, 2026 07:39
@nwparker nwparker changed the title fix(terminal): stop the OMP/Pi title churn, and revert the ingest rewrite fix(terminal): stop Orca mangling the OMP/Pi title it writes itself Aug 25, 2026
nwparker and others added 6 commits August 25, 2026 01:02
Replaces the ingest-time title rewrite from #16373 with a non-destructive
fix at the actual cause.

The churn suppressor `isDecorativeAgentTitleFrameChange` keyed on the
literal label, so `working:OMP` and `working:Pi` compared unequal and every
alternating frame from a wrapped harness committed a store patch. #16373
made the labels agree by rewriting the stored title to the tab's launch
owner — but `runtimePaneTitlesByTabId` is also the Windows Shift+Enter
byte-encoding input, so normalizing at ingest destroyed evidence other
consumers read (fixed separately in #16376).

Collapse the identity group inside the signature instead. Which member of
a group a frame names is decoration, exactly like the spinner glyph the
signature already strips, so frames compare equal without touching what is
stored. Suppression now changes only WHETHER a frame commits, never WHAT
it says.

Also fixes the flap under a multiplexer (#8032): the collapse runs over
wrapper segments, so "zsh | ⠋ Pi" and "zsh | ⠙ OMP" compare equal, which
the anchored owner-relabel in #16373 never matched.

Reverts the store changes from #16373 and drops the helper it added.

Co-authored-by: Seongho.Bak <49228032+psh4607@users.noreply.github.com>
A legacy "π - <session> - <cwd>" title is Pi-compatible too, so folding
every profile match collapsed two different sessions to the same signature
and suppressed the change outright — reintroducing #16093 through the
churn signature.

Fold only exact bare identity frames, matched per wrapper segment, so
semantic session titles keep comparing on their own text.

Co-authored-by: Seongho.Bak <49228032+psh4607@users.noreply.github.com>
Verified against the OMP source: it emits only π-glyph frames
(`DEFAULT_TERMINAL_TITLE = "π"`, title-generator.ts:25), and on an
Orca-hosted pane its native titler cedes to Orca's own injected extension,
which writes `⠋ π - <session> - <cwd>`.

So OMP emits neither "OMP" nor "Pi". Both flap sides are Orca's:
"OMP" from driveSyntheticTitleFromHook, "Pi" from normalizeTerminalTitle
collapsing our own extension's output to a hardcoded literal.

The prior header credited the wrapped harness for frames it never sends,
which is the same wrong narrative that produced eight fixes at eight
layers. No behavior change.
Verified against the OMP source: it emits only π-branded frames
(`DEFAULT_TERMINAL_TITLE = "π"`, title-generator.ts:25), and on an
Orca-hosted pane its native titler cedes to Orca's OWN injected extension,
which writes `π - <session> - <cwd>` / `⠋ π - <session> - <cwd>` at 80ms.

So neither flapping string came from OMP. Orca made both:
  "Pi"  — normalizeTerminalTitle collapsing our extension's output to a
          hardcoded literal, discarding the session name and cwd (#16093)
  "OMP" — driveSyntheticTitleFromHook injecting over it every 80ms

Fixed at the source:
- normalizeTerminalTitle canonicalizes only the rotating braille frame and
  keeps the rest, in both spinner positions and through a multiplexer
  prefix (#8032). Status still round-trips through normalization.
- detectAgentStatusFromTitle reads the π state separator, so `π ! <label>`
  is permission instead of the blanket idle that hid a blocked agent.
- normalizeCompatibleAgentTitleForOwner swaps only the brand for the
  owner's label, so a pane still reads as its launch owner (#6689, #7633,
  #9077) without losing the session text.
- pi/omp set synthesizeWorkingTitle: false — the agent animates its own
  working title. Terminal states still synthesize; they carry the pane's
  agent identity downstream.

Reverts the ingest-time title rewrite from #16373, whose normalization of
runtimePaneTitlesByTabId also changed Windows Shift+Enter bytes (#16376).

Co-authored-by: Seongho.Bak <49228032+psh4607@users.noreply.github.com>
The separator check runs on every title, so `omp - deploy notes` and
`pi - refactor the parser` read as an idle agent. The owner rewrite only
ever emits the exact profile labels, so dropping case-insensitivity keeps
`OMP - tmp` classifying while ordinary prose stops matching.

Co-authored-by: Seongho.Bak <49228032+psh4607@users.noreply.github.com>
Drives 30 working frames as Orca's injected extension emits them plus the
idle transition, and asserts what survives the churn gate. Before the fix
every frame alternated "⠋ Pi"/"⠋ OMP" and each one committed — ~12 store
patches per second on a working tab.

Co-authored-by: Seongho.Bak <49228032+psh4607@users.noreply.github.com>
@nwparker
nwparker force-pushed the nwparker/omp-title-flap-redesign branch from ba7868a to 2f50a80 Compare August 25, 2026 08:02
nwparker and others added 2 commits August 25, 2026 01:16
`-` is both a π state separator and the delimiter in the synthetic
permission label, so `OMP - action required` read as idle. It resolved
correctly only because detectAgentStatusFromTitle happens to check the
synthetic label first — and the separator fn is exported, so a direct
caller inherited the bug.

Also pins the owner rewrite's fixed-point property, which holds only
because getAgentLabel does not tokenize omp/pi, and corrects a comment
that overstated how tightly the brand swap is scoped.

Co-authored-by: Seongho.Bak <49228032+psh4607@users.noreply.github.com>
The suite header cited `synthesizeTerminalTitle: false`; the profiles set
`synthesizeWorkingTitle: false`. The distinction is the whole reason the
narrower flag was chosen — terminal-state frames still carry the pane's
agent identity downstream — so the wrong name buried the rationale.

Co-authored-by: Seongho.Bak <49228032+psh4607@users.noreply.github.com>
@coderabbitai

coderabbitai Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

1 similar comment
@coderabbitai

coderabbitai Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@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: f3750b37-9a83-4dfe-a313-720a76718bf3

📥 Commits

Reviewing files that changed from the base of the PR and between 8217e68 and 60fd8e8.

📒 Files selected for processing (18)
  • src/main/runtime/orca-runtime.test.ts
  • src/renderer/src/components/sidebar/worktree-title-derived-agent-rows.test.ts
  • src/renderer/src/components/terminal-pane/pty-connection-task-complete-dispatch.test.ts
  • src/renderer/src/components/terminal-pane/pty-dispatcher-pi-routing.test.ts
  • src/renderer/src/components/terminal-pane/pty-transport-pi-coalesce.test.ts
  • src/renderer/src/components/terminal-pane/pty-transport-pi-spinner.test.ts
  • src/renderer/src/lib/agent-status.test.ts
  • src/renderer/src/store/slices/repro-omp-pi-alternating-title-frame-churn.test.ts
  • src/renderer/src/store/slices/terminal-tab-title-batch.ts
  • src/renderer/src/store/terminals/terminal-tab-presentation.ts
  • src/shared/agent-detection.test.ts
  • src/shared/agent-title-owner.ts
  • src/shared/agent-title-status.ts
  • src/shared/omp-pi-semantic-title-preservation.test.ts
  • src/shared/pi-compatible-synthetic-title.ts
  • src/shared/synthetic-agent-title.test.ts
  • src/shared/synthetic-agent-title.ts
  • tests/e2e/session-tabs-decorative-title-fanout.unit.test.ts
💤 Files with no reviewable changes (1)
  • src/renderer/src/store/slices/repro-omp-pi-alternating-title-frame-churn.test.ts
🚧 Files skipped from review as they are similar to previous changes (15)
  • src/renderer/src/components/sidebar/worktree-title-derived-agent-rows.test.ts
  • src/renderer/src/components/terminal-pane/pty-connection-task-complete-dispatch.test.ts
  • src/renderer/src/lib/agent-status.test.ts
  • src/renderer/src/components/terminal-pane/pty-transport-pi-spinner.test.ts
  • src/shared/synthetic-agent-title.test.ts
  • src/renderer/src/store/slices/terminal-tab-title-batch.ts
  • src/renderer/src/store/terminals/terminal-tab-presentation.ts
  • src/shared/synthetic-agent-title.ts
  • src/main/runtime/orca-runtime.test.ts
  • src/renderer/src/components/terminal-pane/pty-dispatcher-pi-routing.test.ts
  • tests/e2e/session-tabs-decorative-title-fanout.unit.test.ts
  • src/shared/agent-detection.test.ts
  • src/shared/agent-title-status.ts
  • src/renderer/src/components/terminal-pane/pty-transport-pi-coalesce.test.ts
  • src/shared/omp-pi-semantic-title-preservation.test.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 3 remain after this review.

// may already have been swapped for the owner's label, so accept those too — but only in their
// exact profile casing, since a lowercase `pi - refactor…` is ordinary prose, not a Pi title.
// The separator must be delimited (`:` attached, or spaced) or `omp-harness` reads as a state.
const PI_COMPATIBLE_SEPARATOR_RE = /^\s*(?:π|Pi|OMP)(?::|\s+([!>-]))(?=\s|$)/u

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 | 🟠 Major | ⚡ Quick win

🔎 Supported by static analysis

🏁 Script executed:

#!/bin/bash
set -eu
printf '%s\n' '--- src/shared/pi-compatible-synthetic-title.ts ---'
cat -n src/shared/pi-compatible-synthetic-title.ts
printf '%s\n' '--- detectAgentStatusFromTitle and direct dependencies ---'
sed -n '130,270p' src/shared/agent-title-status.ts
printf '%s\n' '--- wrapper title definitions and uses ---'
rg -n -A8 -B8 'getWrapperTitleSegments|normalizeTerminalTitle|detectAgentStatusFromTitle' src/shared

Repository: stablyai/orca

Length of output: 50369


🏁 Script executed:

#!/bin/bash
set -eu
printf '%s\n' '--- imports and title checks in src/shared/agent-title-status.ts ---'
sed -n '1,125p' src/shared/agent-title-status.ts
printf '%s\n' '--- Pi title predicate ---'
rg -n -A18 -B8 'function isPiTerminalTitle|const isPiTerminalTitle|isPiTerminalTitle' src/shared
printf '%s\n' '--- complete wrapper segmentation contract ---'
cat -n src/shared/terminal-title-wrapper-segments.ts

Repository: stablyai/orca

Length of output: 12611


🏁 Script executed:

#!/bin/bash
set -eu
printf '%s\n' '--- containsLegacyAgentName binding and implementation ---'
rg -n -A24 -B12 'containsLegacyAgentName|titleHasAnyLegacyAgentName|AGENT_NAMES' src/shared/agent-title-core.ts src/shared/agent-name-token-match.ts
printf '%s\n' '--- wrapped-title status tests and exact fallback behavior ---'
rg -n -A10 -B10 'zsh \|.*π|multiplexer|wrapped.*status|status.*wrapped' src/shared

Repository: stablyai/orca

Length of output: 23114


Handle multiplexer-wrapped titles.

getPiCompatibleTitleSeparatorStatus checks the full title, so zsh | π ! session and zsh | π > session bypass the separator check and return no status from detectAgentStatusFromTitle. Check getWrapperTitleSegments(title) before evaluating the ! and > states.

@nwparker

Copy link
Copy Markdown
Contributor Author

Verified against a live OMP install

Captured the raw OSC title stream from a real omp session (v18.0.4) through a PTY, with ORCA_PANE_KEY unset so OMP's native titler runs.

What OMP actually emits — exactly the source-derived format, confirmed on the wire:

'π >'                          idle, no label
'π > omp-title-probe'          idle, cwd basename
'π ⠋ omp-title-probe'          working, medial spinner
'π ⠙ omp-title-probe'          … 10 frames rotating at 80ms
'π ⠼ Reply with exactly pong'  working, generated SESSION NAME
'π > Reply with exactly pong'  turn complete

OMP emits neither "OMP" nor "Pi" — every frame is π-branded, the spinner is medial, and the session name appears in the title. One short turn produced 61 OSC title frames, all 61 distinct-consecutive — every frame a change.

Replaying those exact captured frames through Orca

On main (single-writer, no synthetic injection):

41 frames -> 3 commits
  "Pi"     display "OMP ready"
  "⠋ Pi"   display "⠋ OMP"
  "Pi"     display "OMP ready"

The session name Reply with exactly pong and the cwd omp-title-probe are destroyed outright — that is #16093, reproduced on live data.

With this PR:

41 frames -> 5 commits
  "π >"                          idle       display "OMP >"
  "π > omp-title-probe"          idle       display "OMP > omp-title-probe"
  "π ⠋ omp-title-probe"          working    display "OMP ⠋ omp-title-probe"
  "π ⠋ Reply with exactly pong"  working    display "OMP ⠋ Reply with exactly pong"
  "π > Reply with exactly pong"  idle       display "OMP > Reply with exactly pong"

Five commits, each a genuine state change, and the display carries both the OMP owner identity (#6689/#7633/#9077) and the session name (#16093).

The reported symptom, reproduced and eliminated

Interleaving the live frames with the synthetic writer as driveSyntheticTitleFromHook injects it:

stream frames committed patches distinct labels
main 75 70 Pi, ⠋ Pi, ⠋ OMP, ⠙ OMP, ⠹ OMP, … (12)
this PR 41 5 5 meaningful states

That alternation between Pi and OMP is the original report verbatim. 70 → 5 committed patches on frames captured from a real OMP session.

Closes the one gap called out in the PR description: everything else was verified from source and by executing Orca's functions; this is the live wire capture.

@nwparker
nwparker merged commit fcf55f2 into main Aug 25, 2026
48 checks passed
paidaxingyo666 pushed a commit to paidaxingyo666/Manta that referenced this pull request Aug 25, 2026
…tablyai#16381)

* fix(terminal): collapse identity group in the title churn signature

Replaces the ingest-time title rewrite from stablyai#16373 with a non-destructive
fix at the actual cause.

The churn suppressor `isDecorativeAgentTitleFrameChange` keyed on the
literal label, so `working:OMP` and `working:Pi` compared unequal and every
alternating frame from a wrapped harness committed a store patch. stablyai#16373
made the labels agree by rewriting the stored title to the tab's launch
owner — but `runtimePaneTitlesByTabId` is also the Windows Shift+Enter
byte-encoding input, so normalizing at ingest destroyed evidence other
consumers read (fixed separately in stablyai#16376).

Collapse the identity group inside the signature instead. Which member of
a group a frame names is decoration, exactly like the spinner glyph the
signature already strips, so frames compare equal without touching what is
stored. Suppression now changes only WHETHER a frame commits, never WHAT
it says.

Also fixes the flap under a multiplexer (stablyai#8032): the collapse runs over
wrapper segments, so "zsh | ⠋ Pi" and "zsh | ⠙ OMP" compare equal, which
the anchored owner-relabel in stablyai#16373 never matched.

Reverts the store changes from stablyai#16373 and drops the helper it added.

Co-authored-by: Seongho.Bak <49228032+psh4607@users.noreply.github.com>

* fix(terminal): fold only bare identity frames into the group token

A legacy "π - <session> - <cwd>" title is Pi-compatible too, so folding
every profile match collapsed two different sessions to the same signature
and suppressed the change outright — reintroducing stablyai#16093 through the
churn signature.

Fold only exact bare identity frames, matched per wrapper segment, so
semantic session titles keep comparing on their own text.

Co-authored-by: Seongho.Bak <49228032+psh4607@users.noreply.github.com>

* docs(terminal): correct the flap diagnosis in the repro header

Verified against the OMP source: it emits only π-glyph frames
(`DEFAULT_TERMINAL_TITLE = "π"`, title-generator.ts:25), and on an
Orca-hosted pane its native titler cedes to Orca's own injected extension,
which writes `⠋ π - <session> - <cwd>`.

So OMP emits neither "OMP" nor "Pi". Both flap sides are Orca's:
"OMP" from driveSyntheticTitleFromHook, "Pi" from normalizeTerminalTitle
collapsing our own extension's output to a hardcoded literal.

The prior header credited the wrapped harness for frames it never sends,
which is the same wrong narrative that produced eight fixes at eight
layers. No behavior change.

* fix(terminal): stop Orca mangling the OMP/Pi title it writes itself

Verified against the OMP source: it emits only π-branded frames
(`DEFAULT_TERMINAL_TITLE = "π"`, title-generator.ts:25), and on an
Orca-hosted pane its native titler cedes to Orca's OWN injected extension,
which writes `π - <session> - <cwd>` / `⠋ π - <session> - <cwd>` at 80ms.

So neither flapping string came from OMP. Orca made both:
  "Pi"  — normalizeTerminalTitle collapsing our extension's output to a
          hardcoded literal, discarding the session name and cwd (stablyai#16093)
  "OMP" — driveSyntheticTitleFromHook injecting over it every 80ms

Fixed at the source:
- normalizeTerminalTitle canonicalizes only the rotating braille frame and
  keeps the rest, in both spinner positions and through a multiplexer
  prefix (stablyai#8032). Status still round-trips through normalization.
- detectAgentStatusFromTitle reads the π state separator, so `π ! <label>`
  is permission instead of the blanket idle that hid a blocked agent.
- normalizeCompatibleAgentTitleForOwner swaps only the brand for the
  owner's label, so a pane still reads as its launch owner (stablyai#6689, stablyai#7633,
  stablyai#9077) without losing the session text.
- pi/omp set synthesizeWorkingTitle: false — the agent animates its own
  working title. Terminal states still synthesize; they carry the pane's
  agent identity downstream.

Reverts the ingest-time title rewrite from stablyai#16373, whose normalization of
runtimePaneTitlesByTabId also changed Windows Shift+Enter bytes (stablyai#16376).

Co-authored-by: Seongho.Bak <49228032+psh4607@users.noreply.github.com>

* fix(terminal): match the state separator only in exact profile casing

The separator check runs on every title, so `omp - deploy notes` and
`pi - refactor the parser` read as an idle agent. The owner rewrite only
ever emits the exact profile labels, so dropping case-insensitivity keeps
`OMP - tmp` classifying while ordinary prose stops matching.

Co-authored-by: Seongho.Bak <49228032+psh4607@users.noreply.github.com>

* test(terminal): pin one real OMP turn to two committed patches

Drives 30 working frames as Orca's injected extension emits them plus the
idle transition, and asserts what survives the churn gate. Before the fix
every frame alternated "⠋ Pi"/"⠋ OMP" and each one committed — ~12 store
patches per second on a working tab.

Co-authored-by: Seongho.Bak <49228032+psh4607@users.noreply.github.com>

* fix(terminal): carry the permission guard inside the separator reader

`-` is both a π state separator and the delimiter in the synthetic
permission label, so `OMP - action required` read as idle. It resolved
correctly only because detectAgentStatusFromTitle happens to check the
synthetic label first — and the separator fn is exported, so a direct
caller inherited the bug.

Also pins the owner rewrite's fixed-point property, which holds only
because getAgentLabel does not tokenize omp/pi, and corrects a comment
that overstated how tightly the brand swap is scoped.

Co-authored-by: Seongho.Bak <49228032+psh4607@users.noreply.github.com>

* docs(terminal): name the flag the code actually sets

The suite header cited `synthesizeTerminalTitle: false`; the profiles set
`synthesizeWorkingTitle: false`. The distinction is the whole reason the
narrower flag was chosen — terminal-state frames still carry the pane's
agent identity downstream — so the wrong name buried the rationale.

Co-authored-by: Seongho.Bak <49228032+psh4607@users.noreply.github.com>

---------

Co-authored-by: Seongho.Bak <49228032+psh4607@users.noreply.github.com>
(cherry picked from commit fcf55f2)
dallascrilley pushed a commit to dallascrilley/orca that referenced this pull request Aug 27, 2026
…tablyai#16381)

* fix(terminal): collapse identity group in the title churn signature

Replaces the ingest-time title rewrite from stablyai#16373 with a non-destructive
fix at the actual cause.

The churn suppressor `isDecorativeAgentTitleFrameChange` keyed on the
literal label, so `working:OMP` and `working:Pi` compared unequal and every
alternating frame from a wrapped harness committed a store patch. stablyai#16373
made the labels agree by rewriting the stored title to the tab's launch
owner — but `runtimePaneTitlesByTabId` is also the Windows Shift+Enter
byte-encoding input, so normalizing at ingest destroyed evidence other
consumers read (fixed separately in stablyai#16376).

Collapse the identity group inside the signature instead. Which member of
a group a frame names is decoration, exactly like the spinner glyph the
signature already strips, so frames compare equal without touching what is
stored. Suppression now changes only WHETHER a frame commits, never WHAT
it says.

Also fixes the flap under a multiplexer (stablyai#8032): the collapse runs over
wrapper segments, so "zsh | ⠋ Pi" and "zsh | ⠙ OMP" compare equal, which
the anchored owner-relabel in stablyai#16373 never matched.

Reverts the store changes from stablyai#16373 and drops the helper it added.

Co-authored-by: Seongho.Bak <49228032+psh4607@users.noreply.github.com>

* fix(terminal): fold only bare identity frames into the group token

A legacy "π - <session> - <cwd>" title is Pi-compatible too, so folding
every profile match collapsed two different sessions to the same signature
and suppressed the change outright — reintroducing stablyai#16093 through the
churn signature.

Fold only exact bare identity frames, matched per wrapper segment, so
semantic session titles keep comparing on their own text.

Co-authored-by: Seongho.Bak <49228032+psh4607@users.noreply.github.com>

* docs(terminal): correct the flap diagnosis in the repro header

Verified against the OMP source: it emits only π-glyph frames
(`DEFAULT_TERMINAL_TITLE = "π"`, title-generator.ts:25), and on an
Orca-hosted pane its native titler cedes to Orca's own injected extension,
which writes `⠋ π - <session> - <cwd>`.

So OMP emits neither "OMP" nor "Pi". Both flap sides are Orca's:
"OMP" from driveSyntheticTitleFromHook, "Pi" from normalizeTerminalTitle
collapsing our own extension's output to a hardcoded literal.

The prior header credited the wrapped harness for frames it never sends,
which is the same wrong narrative that produced eight fixes at eight
layers. No behavior change.

* fix(terminal): stop Orca mangling the OMP/Pi title it writes itself

Verified against the OMP source: it emits only π-branded frames
(`DEFAULT_TERMINAL_TITLE = "π"`, title-generator.ts:25), and on an
Orca-hosted pane its native titler cedes to Orca's OWN injected extension,
which writes `π - <session> - <cwd>` / `⠋ π - <session> - <cwd>` at 80ms.

So neither flapping string came from OMP. Orca made both:
  "Pi"  — normalizeTerminalTitle collapsing our extension's output to a
          hardcoded literal, discarding the session name and cwd (stablyai#16093)
  "OMP" — driveSyntheticTitleFromHook injecting over it every 80ms

Fixed at the source:
- normalizeTerminalTitle canonicalizes only the rotating braille frame and
  keeps the rest, in both spinner positions and through a multiplexer
  prefix (stablyai#8032). Status still round-trips through normalization.
- detectAgentStatusFromTitle reads the π state separator, so `π ! <label>`
  is permission instead of the blanket idle that hid a blocked agent.
- normalizeCompatibleAgentTitleForOwner swaps only the brand for the
  owner's label, so a pane still reads as its launch owner (stablyai#6689, stablyai#7633,
  stablyai#9077) without losing the session text.
- pi/omp set synthesizeWorkingTitle: false — the agent animates its own
  working title. Terminal states still synthesize; they carry the pane's
  agent identity downstream.

Reverts the ingest-time title rewrite from stablyai#16373, whose normalization of
runtimePaneTitlesByTabId also changed Windows Shift+Enter bytes (stablyai#16376).

Co-authored-by: Seongho.Bak <49228032+psh4607@users.noreply.github.com>

* fix(terminal): match the state separator only in exact profile casing

The separator check runs on every title, so `omp - deploy notes` and
`pi - refactor the parser` read as an idle agent. The owner rewrite only
ever emits the exact profile labels, so dropping case-insensitivity keeps
`OMP - tmp` classifying while ordinary prose stops matching.

Co-authored-by: Seongho.Bak <49228032+psh4607@users.noreply.github.com>

* test(terminal): pin one real OMP turn to two committed patches

Drives 30 working frames as Orca's injected extension emits them plus the
idle transition, and asserts what survives the churn gate. Before the fix
every frame alternated "⠋ Pi"/"⠋ OMP" and each one committed — ~12 store
patches per second on a working tab.

Co-authored-by: Seongho.Bak <49228032+psh4607@users.noreply.github.com>

* fix(terminal): carry the permission guard inside the separator reader

`-` is both a π state separator and the delimiter in the synthetic
permission label, so `OMP - action required` read as idle. It resolved
correctly only because detectAgentStatusFromTitle happens to check the
synthetic label first — and the separator fn is exported, so a direct
caller inherited the bug.

Also pins the owner rewrite's fixed-point property, which holds only
because getAgentLabel does not tokenize omp/pi, and corrects a comment
that overstated how tightly the brand swap is scoped.

Co-authored-by: Seongho.Bak <49228032+psh4607@users.noreply.github.com>

* docs(terminal): name the flag the code actually sets

The suite header cited `synthesizeTerminalTitle: false`; the profiles set
`synthesizeWorkingTitle: false`. The distinction is the whole reason the
narrower flag was chosen — terminal-state frames still carry the pane's
agent identity downstream — so the wrong name buried the rationale.

Co-authored-by: Seongho.Bak <49228032+psh4607@users.noreply.github.com>

---------

Co-authored-by: Seongho.Bak <49228032+psh4607@users.noreply.github.com>
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
…tablyai#16381)

* fix(terminal): collapse identity group in the title churn signature

Replaces the ingest-time title rewrite from stablyai#16373 with a non-destructive
fix at the actual cause.

The churn suppressor `isDecorativeAgentTitleFrameChange` keyed on the
literal label, so `working:OMP` and `working:Pi` compared unequal and every
alternating frame from a wrapped harness committed a store patch. stablyai#16373
made the labels agree by rewriting the stored title to the tab's launch
owner — but `runtimePaneTitlesByTabId` is also the Windows Shift+Enter
byte-encoding input, so normalizing at ingest destroyed evidence other
consumers read (fixed separately in stablyai#16376).

Collapse the identity group inside the signature instead. Which member of
a group a frame names is decoration, exactly like the spinner glyph the
signature already strips, so frames compare equal without touching what is
stored. Suppression now changes only WHETHER a frame commits, never WHAT
it says.

Also fixes the flap under a multiplexer (stablyai#8032): the collapse runs over
wrapper segments, so "zsh | ⠋ Pi" and "zsh | ⠙ OMP" compare equal, which
the anchored owner-relabel in stablyai#16373 never matched.

Reverts the store changes from stablyai#16373 and drops the helper it added.

Co-authored-by: Seongho.Bak <49228032+psh4607@users.noreply.github.com>

* fix(terminal): fold only bare identity frames into the group token

A legacy "π - <session> - <cwd>" title is Pi-compatible too, so folding
every profile match collapsed two different sessions to the same signature
and suppressed the change outright — reintroducing stablyai#16093 through the
churn signature.

Fold only exact bare identity frames, matched per wrapper segment, so
semantic session titles keep comparing on their own text.

Co-authored-by: Seongho.Bak <49228032+psh4607@users.noreply.github.com>

* docs(terminal): correct the flap diagnosis in the repro header

Verified against the OMP source: it emits only π-glyph frames
(`DEFAULT_TERMINAL_TITLE = "π"`, title-generator.ts:25), and on an
Orca-hosted pane its native titler cedes to Orca's own injected extension,
which writes `⠋ π - <session> - <cwd>`.

So OMP emits neither "OMP" nor "Pi". Both flap sides are Orca's:
"OMP" from driveSyntheticTitleFromHook, "Pi" from normalizeTerminalTitle
collapsing our own extension's output to a hardcoded literal.

The prior header credited the wrapped harness for frames it never sends,
which is the same wrong narrative that produced eight fixes at eight
layers. No behavior change.

* fix(terminal): stop Orca mangling the OMP/Pi title it writes itself

Verified against the OMP source: it emits only π-branded frames
(`DEFAULT_TERMINAL_TITLE = "π"`, title-generator.ts:25), and on an
Orca-hosted pane its native titler cedes to Orca's OWN injected extension,
which writes `π - <session> - <cwd>` / `⠋ π - <session> - <cwd>` at 80ms.

So neither flapping string came from OMP. Orca made both:
  "Pi"  — normalizeTerminalTitle collapsing our extension's output to a
          hardcoded literal, discarding the session name and cwd (stablyai#16093)
  "OMP" — driveSyntheticTitleFromHook injecting over it every 80ms

Fixed at the source:
- normalizeTerminalTitle canonicalizes only the rotating braille frame and
  keeps the rest, in both spinner positions and through a multiplexer
  prefix (stablyai#8032). Status still round-trips through normalization.
- detectAgentStatusFromTitle reads the π state separator, so `π ! <label>`
  is permission instead of the blanket idle that hid a blocked agent.
- normalizeCompatibleAgentTitleForOwner swaps only the brand for the
  owner's label, so a pane still reads as its launch owner (stablyai#6689, stablyai#7633,
  stablyai#9077) without losing the session text.
- pi/omp set synthesizeWorkingTitle: false — the agent animates its own
  working title. Terminal states still synthesize; they carry the pane's
  agent identity downstream.

Reverts the ingest-time title rewrite from stablyai#16373, whose normalization of
runtimePaneTitlesByTabId also changed Windows Shift+Enter bytes (stablyai#16376).

Co-authored-by: Seongho.Bak <49228032+psh4607@users.noreply.github.com>

* fix(terminal): match the state separator only in exact profile casing

The separator check runs on every title, so `omp - deploy notes` and
`pi - refactor the parser` read as an idle agent. The owner rewrite only
ever emits the exact profile labels, so dropping case-insensitivity keeps
`OMP - tmp` classifying while ordinary prose stops matching.

Co-authored-by: Seongho.Bak <49228032+psh4607@users.noreply.github.com>

* test(terminal): pin one real OMP turn to two committed patches

Drives 30 working frames as Orca's injected extension emits them plus the
idle transition, and asserts what survives the churn gate. Before the fix
every frame alternated "⠋ Pi"/"⠋ OMP" and each one committed — ~12 store
patches per second on a working tab.

Co-authored-by: Seongho.Bak <49228032+psh4607@users.noreply.github.com>

* fix(terminal): carry the permission guard inside the separator reader

`-` is both a π state separator and the delimiter in the synthetic
permission label, so `OMP - action required` read as idle. It resolved
correctly only because detectAgentStatusFromTitle happens to check the
synthetic label first — and the separator fn is exported, so a direct
caller inherited the bug.

Also pins the owner rewrite's fixed-point property, which holds only
because getAgentLabel does not tokenize omp/pi, and corrects a comment
that overstated how tightly the brand swap is scoped.

Co-authored-by: Seongho.Bak <49228032+psh4607@users.noreply.github.com>

* docs(terminal): name the flag the code actually sets

The suite header cited `synthesizeTerminalTitle: false`; the profiles set
`synthesizeWorkingTitle: false`. The distinction is the whole reason the
narrower flag was chosen — terminal-state frames still carry the pane's
agent identity downstream — so the wrong name buried the rationale.

Co-authored-by: Seongho.Bak <49228032+psh4607@users.noreply.github.com>

---------

Co-authored-by: Seongho.Bak <49228032+psh4607@users.noreply.github.com>
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