Skip to content

Fix remote OMP terminal title thrash - #6689

Merged
nwparker merged 10 commits into
stablyai:mainfrom
Dvitash:fix/omp-remote-host-title-thrash
Jun 29, 2026
Merged

nwparker merged 10 commits into
stablyai:mainfrom
Dvitash:fix/omp-remote-host-title-thrash

Conversation

@Dvitash

@Dvitash Dvitash commented Jun 29, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • preserve OMP launch ownership through remote/mobile terminal snapshots and live PTY foreground metadata
  • normalize Pi-compatible titles and status entries only when the authoritative owner shares the same title identity group
  • keep mirrored remote tabs, PTY OSC 9999 handling, and sidebar title-derived rows from repainting OMP-owned terminals back to Pi

Closes #6619.

Screenshots

No new UI surfaces. The supplied GIFs cover the previous failure mode: an OMP-owned remote session could render Pi-compatible working titles such as Pi, Pi ready, or legacy ? - tmp frames while the agent was active.

Testing

  • ./node_modules/.bin/vitest run --config config/vitest.config.ts src/shared/agent-detection.test.ts src/main/runtime/orca-runtime.test.ts src/renderer/src/runtime/web-session-tabs-sync.test.ts src/renderer/src/components/terminal-pane/pty-connection.test.ts src/renderer/src/components/sidebar/worktree-title-derived-agent-rows.test.ts src/renderer/src/components/sidebar/useWorktreeAgentRows.test.ts
    • Result: 6 files passed, 826 tests passed.
  • ./node_modules/.bin/tsgo --noEmit -p config/tsconfig.node.json
  • ./node_modules/.bin/tsgo --noEmit -p config/tsconfig.tc.web.json
  • ./node_modules/.bin/tsgo --noEmit -p config/tsconfig.tc.cli.json
  • ./node_modules/.bin/oxlint src/shared/synthetic-agent-title.ts src/shared/agent-title-owner.ts src/shared/agent-detection.test.ts src/main/runtime/orca-runtime.ts src/main/runtime/orca-runtime.test.ts src/renderer/src/runtime/web-session-tabs-sync.ts src/renderer/src/runtime/web-session-tabs-sync.test.ts src/renderer/src/components/terminal-pane/pty-connection.ts src/renderer/src/components/terminal-pane/pty-connection.test.ts src/renderer/src/components/sidebar/worktree-agent-rows.ts src/renderer/src/components/sidebar/worktree-title-derived-agent-rows.ts src/renderer/src/components/sidebar/worktree-title-derived-agent-rows.test.ts src/renderer/src/components/sidebar/useWorktreeAgentRows.ts src/renderer/src/components/sidebar/useWorktreeAgentRows.test.ts
  • ./node_modules/.bin/oxlint src/shared/agent-title-owner.ts
  • Manual Windows client paired to Linux dev remote runtime smoke test on latest commit 538a1efbe

AI Review Report

Reviewed the remote host snapshot flow, renderer mirrored-tab reconciliation, PTY OSC 9999 handling, and sidebar title-derived agent rows. The compatibility helper only rewrites titles and status when the incoming profile and owner profile share titleIdentityGroup, so true Pi sessions, unrelated agents, and custom titles stay unchanged.

Security Audit

Basic audit completed. The changes propagate existing agent ownership metadata and normalize display/status strings. No new command execution, IPC surface, filesystem writes, credential handling, network endpoints, or git provider behavior is introduced.

Notes

The fresh-profile dev server script was local test scaffolding and has been removed from this PR. The remaining changes are limited to owner propagation, compatible title/status normalization, and short comments documenting why owner-based compatibility is needed.

@coderabbitai

coderabbitai Bot commented Jun 29, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 7280de43-8ea0-427f-91fd-96463fc945fc

📥 Commits

Reviewing files that changed from the base of the PR and between 001087e and 8f9e609.

📒 Files selected for processing (3)
  • src/main/runtime/orca-runtime.test.ts
  • src/main/runtime/orca-runtime.ts
  • src/renderer/src/components/terminal-pane/pty-connection.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/renderer/src/components/terminal-pane/pty-connection.ts
  • src/main/runtime/orca-runtime.ts

📝 Walkthrough

Walkthrough

Adds a new agent-title-owner shared module with exported helpers for compatible agent type, title, and status normalization. SyntheticAgentTitleProfile gains an optional titleIdentityGroup field used by those helpers. The helpers are applied in renderer pane connection logic, sidebar worktree row derivation, web session tab sync, and main runtime mobile session derivation. The main runtime also tracks a per-PTY foregroundAgent, refreshes it from the controller on agent-status transitions, and uses it when deriving mobile tab ownership and titles.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 60.00% which is insufficient. The required threshold is 80.00%. 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 matches the main change: stabilizing OMP remote terminal titles and preventing thrash.
Description check ✅ Passed The description follows the template with Summary, Screenshots, Testing, AI Review Report, Security Audit, and Notes sections.
Linked Issues check ✅ Passed The changes address #6619 by preserving OMP ownership and normalizing Pi-compatible titles so OMP-backed labels stay stable.
Out of Scope Changes check ✅ Passed The code changes and tests all support the OMP/Pi title-flicker fix, with no obvious unrelated additions.

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: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/main/runtime/orca-runtime.ts (1)

17354-17367: 🚀 Performance & Scalability | 🟠 Major | ⚡ Quick win

Serial per-PTY foreground probe regresses mobile listing latency.

refreshPtyWorktreeRecordsFromController backs listTerminals, getWorktreePs, and refreshMobileSessionPtyRecords (mobile RPC hot paths). Awaiting refreshPtyForegroundAgentFromController once per session serializes a getForegroundProcess round-trip for every PTY, so listing latency grows linearly with terminal count (each call also has no per-call timeout, unlike the listProcesses() call guarded by withTimeoutResult). Additionally, if one refresh rejects (e.g. a snapshot listener throws via touchMobileSessionSnapshotsForPty), the whole loop aborts. Fan the refreshes out and settle them together.

⚡ Proposed parallelization
-    for (const session of sessions) {
+    const foregroundAgentRefreshes: Promise<void>[] = []
+    for (const session of sessions) {
       const worktreeId =
         inferWorktreeIdFromPtyId(session.id) ??
         findResolvedWorktreeIdForPath(resolvedWorktrees, session.cwd)
       if (targetWorktreeId && worktreeId !== targetWorktreeId) {
         continue
       }
       if (worktreeId) {
         this.recordPtyWorktree(session.id, worktreeId, {
           connected: true
         })
       }
-      await this.refreshPtyForegroundAgentFromController(session.id)
+      foregroundAgentRefreshes.push(this.refreshPtyForegroundAgentFromController(session.id))
     }
+    await Promise.allSettled(foregroundAgentRefreshes)
🧹 Nitpick comments (3)
src/shared/agent-title-owner.ts (1)

69-120: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add a short Why: comment for the compatibility rewrite rule.

These helpers encode the PR’s core Pi/OMP ownership constraint, but the reason titles/types are only rewritten when titleIdentityGroup matches is not documented in the code. A 1-2 line comment here would make future changes much safer.

As per coding guidelines, "When writing or modifying code driven by a design doc or non-obvious constraint, add a comment explaining why the code behaves the way it does."

Source: Coding guidelines

src/main/runtime/orca-runtime.ts (1)

5008-5013: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win

Avoid foreground-agent polling on every OSC title frame.

refreshPtyForegroundAgent fires for every non-null OSC title — agents update their title rapidly (spinner frames) during active output, so this triggers a continuous getForegroundProcess probe per active PTY (a relay round-trip for SSH/daemon-backed terminals). The inflight dedup caps concurrency to one per PTY but does not stop the steady stream of probes. The foreground agent rarely changes within a session, so gate the refresh on an actual title/status transition (shouldTouchPtyBackedSessionTabs is computed just above).

♻️ Proposed gate
         shouldTouchPtyBackedSessionTabs =
           prevTitle !== oscTitle || prevStatus !== pty.lastAgentStatus
         if (agentStatus === 'idle' && prevStatus !== 'idle') {
           this.resolvePtyTuiIdleWaiters(pty, ptyId)
         }
-        this.refreshPtyForegroundAgent(ptyId)
+        if (shouldTouchPtyBackedSessionTabs) {
+          this.refreshPtyForegroundAgent(ptyId)
+        }
src/renderer/src/components/terminal-pane/pty-connection.ts (1)

980-991: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Document the authoritative-owner precedence.

This precedence chain is the core Pi/OMP anti-thrashing rule, but the ordering is non-obvious from the helper alone. A short Why comment here would make future reordering much safer.

As per coding guidelines, **/*.{ts,tsx,js,jsx}: "When writing or modifying code driven by a design doc or non-obvious constraint, add a comment explaining why the code behaves the way it does."

Suggested comment
+  // Why: Pi-compatible titles/statuses must resolve against the pane's
+  // authoritative launch owner so remote snapshots/hooks don't repaint OMP
+  // sessions back to Pi during reconnects or status updates.
   const getAuthoritativePaneAgent = (): AgentType | undefined => {

Source: Coding guidelines


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 6f6826ad-ebe7-43bb-bae5-5b66f67d097a

📥 Commits

Reviewing files that changed from the base of the PR and between 49c0917 and 92b5b06.

📒 Files selected for processing (15)
  • config/scripts/dev-serve-fresh-profile.sh
  • src/main/runtime/orca-runtime.test.ts
  • src/main/runtime/orca-runtime.ts
  • src/renderer/src/components/sidebar/useWorktreeAgentRows.test.ts
  • src/renderer/src/components/sidebar/worktree-agent-rows.ts
  • src/renderer/src/components/sidebar/worktree-title-derived-agent-rows.test.ts
  • src/renderer/src/components/sidebar/worktree-title-derived-agent-rows.ts
  • src/renderer/src/components/terminal-pane/pty-connection.test.ts
  • src/renderer/src/components/terminal-pane/pty-connection.ts
  • src/renderer/src/lib/use-tab-agent.ts
  • src/renderer/src/runtime/web-session-tabs-sync.test.ts
  • src/renderer/src/runtime/web-session-tabs-sync.ts
  • src/shared/agent-detection.test.ts
  • src/shared/agent-title-owner.ts
  • src/shared/synthetic-agent-title.ts


PORT="${ORCA_REMOTE_DEV_SERVER_PORT:-6769}"
PAIRING_ADDRESS="${ORCA_REMOTE_DEV_PAIRING_ADDRESS:-}"
PROFILE_DIR="${ORCA_REMOTE_DEV_USER_DATA_PATH:-${XDG_CONFIG_HOME:-$HOME/.config}/orca-dev-remote-server-fresh}"

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.

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Resolve PROFILE_DIR before changing directories.

If --profile-dir or ORCA_REMOTE_DEV_USER_DATA_PATH is relative, Lines 107-116 reinterpret it relative to REPO_ROOT, not the caller’s working directory, because the script cds before rm -rf. That makes ./orca-dev-test capable of wiping or recreating the wrong directory.

Suggested fix
 PORT="${ORCA_REMOTE_DEV_SERVER_PORT:-6769}"
 PAIRING_ADDRESS="${ORCA_REMOTE_DEV_PAIRING_ADDRESS:-}"
 PROFILE_DIR="${ORCA_REMOTE_DEV_USER_DATA_PATH:-${XDG_CONFIG_HOME:-$HOME/.config}/orca-dev-remote-server-fresh}"
 RUN_BUILD=0
@@
 done
+
+if [[ "$PROFILE_DIR" != /* ]]; then
+  PROFILE_DIR="$PWD/$PROFILE_DIR"
+fi
 
 if [[ -z "$PAIRING_ADDRESS" ]]; then

Also applies to: 65-70, 107-116

Dvitash and others added 4 commits June 28, 2026 23:15
…us transition

The foreground-process probe added for OMP/Pi owner resolution is only ever
consulted as the owner fallback when launchAgent is unknown. For all
Orca-launched agents (including the OMP path this PR fixes) the relay
getForegroundProcess round-trip was pure waste.

- Skip the probe entirely when pty.launchAgent is set.
- Gate the onPtyData trigger on an actual agent-status transition, not on
  per-frame braille-spinner title churn.
- Fire-and-forget the refresh on the mobile listing hot path so latency does
  not grow per-session and a throwing snapshot listener can't abort the sweep.

Adds regression tests covering both the skip and the status-transition gate,
and a Why comment on the renderer's authoritative-owner precedence.

Co-authored-by: Orca <[email protected]>
@nwparker
nwparker merged commit 29df9a3 into stablyai:main Jun 29, 2026
@nwparker

Copy link
Copy Markdown
Contributor

Thanks for this, @Dvitash! 🙏 Merged.

This is a clean fix for a genuinely subtle problem — OMP wrapping Pi means it
legitimately emits Pi-identity frames, so the titleIdentityGroup gate (only
rewriting when the incoming and owner profiles share a group) is exactly the
right boundary: true Pi sessions, unrelated agents, and custom titles all stay
untouched. The shared agent-title-owner helper with Why: comments and the
broad test coverage across the host snapshot, mirrored-tab, PTY OSC, and
sidebar paths made this easy to verify.

I reviewed for correctness, performance, and safety; reproduced the flicker
against main as a negative control; and confirmed the live renderer build
collapses interleaved OMP/Pi frames to a stable OMP label with zero Pi leaks.

I pushed one follow-up commit before merging to tighten the new foreground-agent
probe, since foregroundAgent is only consulted as the owner fallback when
launchAgent is unknown:

  • Skip the getForegroundProcess probe entirely when launchAgent is already
    known (covers every Orca-launched agent, including this OMP path), and gate
    the onPtyData trigger on a real status transition instead of per-frame
    braille-spinner title churn — otherwise SSH/daemon-backed terminals would do
    a relay round-trip on essentially every output frame during active work.
  • Made the refresh fire-and-forget on the mobile listing hot path
    (listTerminals/getWorktreePs) so listing latency doesn't grow per session
    and a throwing snapshot listener can't abort the liveness sweep.

Both line up with the CodeRabbit perf notes. Thanks again for the thorough work
and the detailed testing writeup!

nwparker added a commit that referenced this pull request Aug 25, 2026
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 <[email protected]>
nwparker added a commit that referenced this pull request Aug 25, 2026
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 <[email protected]>
nwparker added a commit that referenced this pull request Aug 25, 2026
…16381)

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

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 <[email protected]>

* 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 #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 <[email protected]>

* 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 (#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 <[email protected]>

* 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 <[email protected]>

* 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 <[email protected]>

* 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 <[email protected]>

* 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 <[email protected]>

---------

Co-authored-by: Seongho.Bak <[email protected]>
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 <[email protected]>

* 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 <[email protected]>

* 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 <[email protected]>

* 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 <[email protected]>

* 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 <[email protected]>

* 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 <[email protected]>

* 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 <[email protected]>

---------

Co-authored-by: Seongho.Bak <[email protected]>
(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 <[email protected]>

* 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 <[email protected]>

* 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 <[email protected]>

* 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 <[email protected]>

* 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 <[email protected]>

* 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 <[email protected]>

* 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 <[email protected]>

---------

Co-authored-by: Seongho.Bak <[email protected]>
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
Fixes stablyai#6619: OMP-owned remote/mobile terminals no longer flicker their tab
label between "OMP" and "Pi".

OMP wraps Pi, so it emits Pi-identity OSC titles and status frames during
active work. On the host, in mirrored remote tabs, and in the title-derived
sidebar rows, those frames were stored verbatim — so an OMP-launched pane
alternated between "OMP" (launch identity) and "Pi" (live frame). The fix
introduces a shared owner-normalization helper (agent-title-owner.ts) that
rewrites Pi-compatible titles/status entries to the authoritative launch
owner, but only when the incoming and owner profiles share the same
titleIdentityGroup — so true Pi sessions, unrelated agents, and custom titles
are left untouched.

Maintainer hardening on top of the original change:
- Skip the new getForegroundProcess probe entirely when launchAgent is already
  known (it is only ever the owner fallback when launchAgent is unknown), and
  gate the onPtyData trigger on a real status transition rather than per-frame
  braille-spinner title churn — avoiding a relay round-trip per output frame on
  SSH/daemon-backed terminals.
- Make the foreground refresh fire-and-forget on the mobile listing hot path
  (listTerminals/getWorktreePs) so latency does not grow per session and a
  throwing snapshot listener cannot abort the liveness sweep.
- Added regression tests + a Why comment on the renderer owner precedence.

Verified: 829 tests pass; node/web/cli typechecks clean; oxlint clean;
reproduced the flicker against main as a negative control and confirmed the
live renderer build collapses interleaved OMP/Pi frames to a stable OMP label
with zero Pi leaks while leaving true-Pi/unrelated/custom titles unchanged.

Co-authored-by: Dvitash <[email protected]>
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 <[email protected]>

* 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 <[email protected]>

* 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 <[email protected]>

* 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 <[email protected]>

* 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 <[email protected]>

* 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 <[email protected]>

* 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 <[email protected]>

---------

Co-authored-by: Seongho.Bak <[email protected]>
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]: OMP tab label flickers between OMP and Pi

2 participants