Skip to content

fix(omp): read Pi/OMP static state-title markers and retire stale spinners - #14602

Merged
brennanb2025 merged 3 commits into
mainfrom
brennanb2025/omp-wsl-titles-13890
Aug 31, 2026
Merged

brennanb2025 merged 3 commits into
mainfrom
brennanb2025/omp-wsl-titles-13890

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Aug 14, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 5 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​291 $\color{#cf222e}{\Huge{\mathbf{−}}}$​137 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​154
Prod 5 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​143 $\color{#cf222e}{\Huge{\mathbf{−}}}$​1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​142

ELI5

OMP used to spin a little braille animation in the terminal title while it worked. On Windows/WSL it can't animate any more, so as of 17.2.12 it writes a static punctuation marker instead: π : cwd means working, π > cwd means idle, π ! cwd means it needs input. Orca never learned those markers, so it read every one of them as "idle" — a working OMP agent looked finished, and Orca's own fallback spinner (started earlier by a hook event) kept spinning after the status row it stood in for was gone.

This teaches Orca the markers from one small table, and makes the fallback spinner retire together with the status row it represents.

What Changed

  • New src/shared/pi-state-title-marker.ts: a marker table (: → working, ! → permission, > → idle) plus one matcher built from it. Both the status classifier and the stale-title clear read that single table.
  • detectAgentStatusFromTitle consults the marker before the glyph and keyword gates, so a marker-bearing title is never decided by decoration that happens to sit in OMP's label.
  • normalizeTerminalTitle no longer reshapes a marker-bearing title as a Gemini title.
  • clearWorkingIndicators rewrites a working marker to the idle marker, so the existing 3-second stale-title fallback can actually retire a native working title. Every other strip pass left it untouched, so it re-armed the timer forever.
  • The synthetic title spinner is retired when the hook row it stands in for goes away: pane-scoped agentStatus:clear, and — via a new subscribeStatusDrop seam — user dismissal, which never routes through the clear fan-out. Connection-scoped transient clears are deliberately ignored.

Supersedes #13891 and #13923, which each fix part of this. Neither is modified or closed by this PR.

Why

Fixes the two halves of #13890 at the layers that own them.

Why a marker table rather than a regex per state. The failure in #13890 is not that Orca mis-parsed a title; it's that upstream re-punctuated a channel Orca was pattern-matching by hand, and the parser silently produced a wrong answer instead of no answer. Hard-coding three delimiters into a regex plus three branches recreates that coupling one release later. A table gives one place to add the next marker, and a contract test walks the table so the parser and the classifier cannot drift apart the way they did here.

Three deliberate robustness properties, all covered by tests:

  • The label is opaque. Everything after the leftmost marker is OMP's own cwd/session text, which legally contains |, more marker characters, and other agents' status glyphs. Leftmost-marker-wins handles all of it without parsing the label.
  • π only has to sit at a token boundary, not at the start of the string, so any wrapper prefix shape (zsh | π : cwd, tmux: π : cwd) still exposes the marker.
  • An unrecognized marker abstains rather than guessing. π ~ cwd returns null and the pre-existing Pi gates decide, so the next protocol change degrades to today's behavior instead of confidently asserting the wrong state.

Why the legacy form is untouched. Whitespace is required before the marker, so 17.2.11's π: cwd disabled title and π - cwd keep their historical idle classification and ⠋ π - cwd keeps reading as working. Hosts on the old OMP are unaffected.

Why no process.platform gate. This is WSL/ConPTY behavior, but the bytes are not local-only: the same title reaches a macOS or Linux client driving a Windows/WSL host over SSH or the mobile transport. Gating the parser on the client's platform would fix native Windows and leave every remote consumer broken. The classifier is shared by main, renderer, and remote consumers precisely so all of them agree.

Why two spinner seams, not one. The spinner is a stand-in for a live hook row, so it must not outlive one. Pane teardown was already covered; a pane-scoped status clear and a user dismissal were not, and they reach the server through different paths (emitPaneStatusCleared vs dropStatusEntry). Transient connection clears stay excluded — losing an SSH transport is not evidence the remote PTY stopped working.

Linked Issue

Fixes #13890

Upstream behavior change: OMP WSL/ConPTY titles, can1357/oh-my-pi#8014.

Related but distinct: #13749 / #13776 cover stale identity after an agent exits back to a shell; this is an OMP process that stays inside its TUI and transitions between working and idle.

Visual Proof

N/A — no layout, styling, or copy changed. The user-visible effect is which status a pane reports and whether its title keeps rotating; both are asserted directly in tests rather than by screenshot. The display title a working native OMP pane normalizes to is unchanged from the existing Pi path (⠋ Pi working, Pi idle).

Testing

Focused suites (5 files, 411 tests) and the shared/terminal-pane sweep, on macOS:

pnpm vitest run src/shared/pi-state-title-marker.test.ts src/shared/agent-detection.test.ts \
  src/main/synthetic-title-spinner.test.ts src/main/agent-hooks/server.test.ts \
  src/renderer/src/components/terminal-pane/terminal-title-tracker-parity.test.ts \
  --config config/vitest.config.ts
# 411 passed

pnpm vitest run --config config/vitest.config.ts src/shared/ \
  src/renderer/src/components/terminal-pane/ src/renderer/src/lib/agent-status.test.ts
# 723 files passed | 3 skipped, 8285 tests passed | 19 skipped

Red/green proof that the new tests are not vacuous — with only the two call sites in agent-title-status.ts stubbed out (parser and tests left in place), pi-state-title-marker.test.ts goes 13 failed / 13 passed; restored, 26 passed. The 13 that still pass without the fix are the legacy-form and abstention cases, which are asserting preserved behavior on purpose.

Coverage added, table-driven:

  • legacy π: cwd, π - cwd, ⠋ π - cwd keep their historical classification
  • bare 17.2.12+ π : / π > / π !
  • wrapper-prefixed zsh | π : cwd, zsh | tmux | π > cwd, tmux: π : cwd
  • permission-wait π ! cwd, bare and wrapped
  • opaque labels containing |, further markers, and another agent's status glyphs
  • an unknown marker abstaining
  • the stale working-title clear, both as a unit and end-to-end through the main/renderer parity harness (title stops, 3s elapses, both paths emit the same became-idle)
  • the spinner retiring on a pane-scoped clear, staying put on a connection-scoped transient clear, and the status-drop seam firing exactly once per real deletion

Gates on changed files only (a full pnpm typecheck was skipped deliberately — it OOMs on this machine; CI covers it):

  • pnpm exec oxlint — clean

  • pnpm exec oxfmt --check — clean

  • node config/scripts/check-changed-code-quality.mjs -- <merge-base> — code quality 0, type-aware 0, React Doctor 0, across 10 changed files

  • I manually tested these changes locally — no. I have no Windows + WSL2 host in this environment, so the runtime path is covered by the byte-level parity harness rather than a physical A/B. Worth a Windows/WSL smoke before merge.

  • Automated tests added/updated

AI Disclosure

Implemented with Claude (Opus 5) in Orca.

Review

  • Security — no network, credential, persistence, IPC surface, or privilege-boundary change. Parsing is bounded to terminal-title strings already flowing through this code, and the marker matcher is a single non-backtracking regex over one title.
  • Cross-platform (Linux/Windows/macOS) — no process.platform branch, by design: the title bytes originate on a Windows/WSL host but are classified by whichever client renders the pane, which may be any platform. Behavior on non-OMP titles is unchanged, and the legacy OMP forms are explicitly pinned by test.
  • Remote SSH — the shared classifier is what main, renderer, and SSH consumers already use, so a WSL host reached over SSH gets the same answer as a local pane. Connection-scoped transient clears remain isolated from pane spinner state, so a dropped transport still cannot idle a possibly-working remote PTY.
  • Mobile — mobile titles come from the same shared classifier and pick the fix up with no mobile-side change.
  • Backwards compatibility — no RPC params, stream opcodes, persisted shapes, or published content changed; this only reclassifies bytes both sides already exchange. A client on this build talking to an older host still classifies correctly, since classification is client-side. Legacy OMP 17.2.11 titles are unchanged.
  • Performance — one regex exec per title, ahead of gates that already ran several substring scans; clearPiStateWorkingMarker runs only on the 3-second stale path. No new timers, allocations per frame, or IPC.

Checklist

  • This PR is small and focused
  • I explained what changed and why (including ELI5)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred) — changed-file lint/format/quality gates and the shared + terminal-pane test sweep pass locally; full typecheck and build deferred to CI (local typecheck OOMs)

Author

  • X / Twitter: @BrennanKB5

…nners

OMP 17.2.12 replaced its animated braille title frames with static markers
on WSL/ConPTY (`π : working`, `π > idle`, `π ! needs input`). Orca read all
three as idle, so a working OMP pane lost its status, and a synthetic title
spinner started by an earlier hook kept rotating after its status row was
gone.

Classify the markers from one shared table so a later upstream punctuation
change is a row, not a reparse, and stop the spinner when the hook row it
stands in for is cleared or dismissed.

Fixes #13890
@coderabbitai

coderabbitai Bot commented Aug 14, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

Next included review available in 17 seconds.

View limit details

Limit details: You’ve used all 10 included reviews currently available.

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

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 51f047ab-7bad-4d51-915f-b3f9833843ff

📥 Commits

Reviewing files that changed from the base of the PR and between 0c4b1b3 and 2479a26.

📒 Files selected for processing (1)
  • src/shared/agent-detection.test.ts

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 74d1f23e-100d-4ed0-b472-9dd3964e0bdb

📥 Commits

Reviewing files that changed from the base of the PR and between 3d341c1 and 0c4b1b3.

📒 Files selected for processing (10)
  • src/main/agent-hooks/server.ts
  • src/main/codex/codex-index-heal-binary-contract.test.ts
  • src/main/index.ts
  • src/main/synthetic-title-spinner.test.ts
  • src/main/synthetic-title-spinner.ts
  • src/renderer/src/components/terminal-pane/terminal-title-tracker-parity.test.ts
  • src/shared/agent-detection.test.ts
  • src/shared/agent-title-status.ts
  • src/shared/pi-state-title-marker.test.ts
  • src/shared/pi-state-title-marker.ts
🚧 Files skipped from review as they are similar to previous changes (8)
  • src/main/synthetic-title-spinner.ts
  • src/main/synthetic-title-spinner.test.ts
  • src/shared/agent-title-status.ts
  • src/shared/agent-detection.test.ts
  • src/main/index.ts
  • src/shared/pi-state-title-marker.test.ts
  • src/main/agent-hooks/server.ts
  • src/renderer/src/components/terminal-pane/terminal-title-tracker-parity.test.ts

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


📝 Walkthrough

Walkthrough

The change adds Pi/OMP title-marker parsing for working, permission, and idle states. It integrates explicit marker detection with existing title-status logic and clears stale working markers. It adds parity and detection tests. AgentHookServer now publishes definitive status-drop events. Main-process listeners stop synthetic title spinners for pane-scoped clears and dropped statuses while preserving connection-scoped transient spinners. Codex index-heal contract tests receive formatting-only changes.

Merge Risk: 🔵 Low · up to 0c4b1

The change improves Pi/OMP status detection and spinner cleanup, but some OpenCode-wrapped titles may still appear idle while working or awaiting permission, and an unusual renderer error could leave a stale title spinner. The PR is mergeable with explicit owner awareness and follow-up on these bounded issues.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning The Codex binary index-heal contract test was reformatted extensively without behavior changes, but it is unrelated to the OMP marker and spinner fixes described in [#13890]. Remove the unrelated Codex test reformat from this pull request or move it to a separate pull request.
Docstring Coverage ⚠️ Warning Docstring coverage is 61.54% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 13 functions across 10 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the OMP marker parsing fix and stale spinner retirement, which are the main changes.
Description check ✅ Passed The description includes all required sections, explains the change and rationale, identifies issue #13890, documents testing, and records deferred full checks and platform limits.
Linked Issues check ✅ Passed The changes address the linked issue objectives [#13890]: OMP static marker detection, legacy compatibility, wrapper support, stale-title cleanup, pane-scoped spinner retirement, transient-clear exclu…
Full details: Linked Issues check

Explanation

The changes address the linked issue objectives [#13890]: OMP static marker detection, legacy compatibility, wrapper support, stale-title cleanup, pane-scoped spinner retirement, transient-clear exclusion, and regression coverage. The separate agent_end completion path is identified as additional work, not a missing implementation of these objectives.

✨ 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.

@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: a5a77f95-f68a-41d2-bbca-fa0fe5017d29

📥 Commits

Reviewing files that changed from the base of the PR and between 9bb8836 and 32fa24a.

📒 Files selected for processing (10)
  • src/main/agent-hooks/server.test.ts
  • src/main/agent-hooks/server.ts
  • src/main/index.ts
  • src/main/synthetic-title-spinner.test.ts
  • src/main/synthetic-title-spinner.ts
  • src/renderer/src/components/terminal-pane/terminal-title-tracker-parity.test.ts
  • src/shared/agent-detection.test.ts
  • src/shared/agent-title-status.ts
  • src/shared/pi-state-title-marker.test.ts
  • src/shared/pi-state-title-marker.ts

Comment on lines +179 to +184
// Why: Pi/OMP's marker is an explicit state protocol, so it wins over the glyph and
// keyword gates below — its label is free-form cwd/session text that can carry either.
const piStateStatus = getPiStateTitleStatus(title)
if (piStateStatus) {
return piStateStatus
}

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

Check Pi state markers before the OpenCode gate.

isOpenCodeNativeTitle at Line 175 handles OC | π : cwd first. It returns idle when the title has no spinner. Execution then does not reach this explicit working marker.

Move the Pi marker check before the OpenCode check. Add OC | π : cwd and OC | π ! cwd regression cases to src/shared/agent-detection.test.ts.

Proposed fix
+  const piStateStatus = getPiStateTitleStatus(title)
+  if (piStateStatus) {
+    return piStateStatus
+  }
+
   if (isOpenCodeNativeTitle(title)) {
     return containsAgentSpinnerGlyph(title) ? 'working' : 'idle'
   }
-
-  const piStateStatus = getPiStateTitleStatus(title)
-  if (piStateStatus) {
-    return piStateStatus
-  }

@Chrrxs

Chrrxs commented Aug 23, 2026

Copy link
Copy Markdown

I live-tested this PR on Windows 11 with WSL2 and OMP 17.2.14. The marker parsing works, but the workspace could still stay on Working after OMP had returned to a native π > ... title.

I had missed #15658. That PR is the missing completion fix for this path.

#14602 handles the terminal title and stops the synthetic spinner when a hook row is cleared or dismissed. In the failing run, the hook row never reached done, so neither cleanup path ran. The generated Pi/OMP extension polls ctx.isIdle() after agent_end. OMP keeps that false at its idle prompt and does not emit agent_settled, so Orca never posts the terminal agent_end. A nested tool shell can also leak OSC 133;D and retire hook authority before the real event.

That leaves a live working row and its synthetic ⠋ OMP timer. The raw terminal history can end in π > ..., correctly classified as idle by this PR, while the timer replaces the runtime title with ⠋ OMP every 80 ms. That is what I observed in the running app.

For normal completion, this PR needs #15658 or equivalent:

  • Treat event.willContinue === true as continuation. Otherwise post terminal agent_end immediately.
  • Keep launch authority when OSC 133;D comes from a nested shell and the execution host still reports OMP in the foreground.
  • Treat a failed or null foreground read as unverifiable, not as an agent exit.

The test gap is straightforward. The parity test feeds π : and then π > through the title trackers without a hook-started synthetic spinner or a lingering working hook row. A combined regression should start Working through the hook path, emit a native idle title, and assert that the row settles and no synthetic frame appears after the next 80 ms tick. A restart case should also prove that a restoredUnconfirmed working row cannot start a new spinner over an idle restored title.

I have not A/B tested #15658 itself yet, but the failing trace matches the event contract it fixes. #14602 is still needed for static title parsing. It is not enough by itself for the stale Working symptom when OMP's terminal agent_end never reaches Orca.

@brennanb2025

Copy link
Copy Markdown
Contributor Author

OMP status review / visual validation

  • Supervised readiness-checklist + adversarial Codex review completed at start and end; no proven in-scope defects, regressions, or performance issues found. No files changed.
  • Validation passed: 411 focused tests; 8,285 tests across 723 files (3 skipped files, 19 skipped tests); pnpm typecheck; changed-file oxlint/oxfmt; code-quality gates; git diff --check.
  • Windows high-spec validation: Electron launched successfully over Playwright CDP on the dedicated PR worktree, and WSL Ubuntu-24.04 was available. A WSL terminal tab was created, but the final visible OSC-title assertion/screenshot was blocked by the remote terminal probe, so no Windows screenshot is attached and the WSL title transition remains a maintainer follow-up.
  • No mobile-facing schema or wire changes were found. The branch remains unchanged by this review.

The PR is still open and may require conflict resolution against current main before merge.

@brennanb2025

Copy link
Copy Markdown
Contributor Author

Final preparation status

  • Review-until-clean completed with readiness-checklist at start/end, OSS precedent review, and adversarial correctness/performance/regression passes.
  • No code changes were warranted. Validation passed: 411 focused tests; 8,285 tests across 723 files (3 skipped files, 19 skipped tests); pnpm typecheck; changed-file oxlint/oxfmt; code-quality gates; and git diff --check.
  • Windows high-spec validation launched the Electron dev build over Playwright CDP and confirmed WSL Ubuntu-24.04 availability. A WSL tab was created, but the final visible OSC-title assertion/screenshot was blocked by the remote terminal probe, so no Windows screenshot is attached.
  • No mobile-facing schema or wire changes were found.
  • The branch is unchanged but currently conflicts with main; resolve that before merge.

…-omp-wsl-titles

# Conflicts:
#	src/main/agent-hooks/server.test.ts
#	src/shared/agent-title-status.ts
@coderabbitai

coderabbitai Bot commented Aug 31, 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.

@greptile-apps

greptile-apps Bot commented Aug 31, 2026 •

Copy link
Copy Markdown

Greptile Summary

The PR adds support for OMP’s static Pi state-title markers and ties synthetic spinner cleanup to definitive status-row removal.

  • Adds a shared marker table and parser for working, idle, and permission titles.
  • Preserves marker-bearing titles during normalization and rewrites stale working markers to idle.
  • Retires pane-scoped synthetic spinners when status rows are cleared or dismissed while preserving them across transient connection clears.
  • Adds classifier, stale-title parity, lifecycle, and spinner regression coverage.

Confidence Score: 5/5

The PR appears safe to merge, with no additional actionable defects beyond the marker-boundary issue already raised in the existing thread.

The new marker handling and spinner lifecycle paths remain aligned with stable pane identity, and transient SSH connection clears do not retire live pane spinners.

Important Files Changed

Filename Overview
src/shared/pi-state-title-marker.ts Introduces the shared OMP marker parser and stale-working-marker rewrite; the known broad-match concern is already covered by an existing thread.
src/shared/agent-title-status.ts Gives explicit OMP state markers precedence over decorative glyphs and preserves marker-bearing titles during normalization.
src/main/agent-hooks/server.ts Adds a guarded multi-subscriber notification for definitive status-row dismissals.
src/main/index.ts Connects pane-scoped status clear and dismissal events to synthetic spinner retirement.
src/main/synthetic-title-spinner.ts Distinguishes pane-scoped clears from connection-scoped transient clears for spinner cleanup.

Reviews (2): Last reviewed commit: "test(omp): preserve static state titles ..." | Re-trigger Greptile

Comment on lines +34 to +35
`(?:^|[\\s|])π[ \\t]+([${PI_STATE_MARKERS.map(escapeForCharacterClass).join('')}])(?=\\s|$)`,
'u'

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Marker matcher claims embedded text

The (?:^|[\s|]) boundary recognizes π :, π >, or π ! anywhere in free-form shell or agent title text, not only at the start of an OMP segment. Because this result precedes the other provider detectors, matching text receives an unrelated Pi status, skips Gemini normalization, and can have its punctuation rewritten during stale-title cleanup.

Knowledge Base Used: Agent integrations and hooks

@brennanb2025

brennanb2025 commented Aug 31, 2026 •

Copy link
Copy Markdown
Contributor Author

Conflict resolution and review complete.

  • Preserved the current title/status refactor and updated stale normalization expectations for static OMP titles.
  • No additional in-scope issues were found in the review.
  • Focused verification: 4 test files / 120 tests passed, pnpm tc passed, and changed-code quality checks passed.
  • The PR branch remains at 2479a26; the child worktree is clean.

The PR is open and GitHub reports it as mergeable.

@brennanb2025

Copy link
Copy Markdown
Contributor Author

CI is green after rerunning the previously flaky test shard. All required checks pass.

@brennanb2025
brennanb2025 merged commit e54cfc1 into main Aug 31, 2026
52 of 54 checks passed
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
…nners (stablyai#14602)

* fix(omp): read Pi/OMP static state-title markers and retire stale spinners

OMP 17.2.12 replaced its animated braille title frames with static markers
on WSL/ConPTY (`π : working`, `π > idle`, `π ! needs input`). Orca read all
three as idle, so a working OMP pane lost its status, and a synthetic title
spinner started by an earlier hook kept rotating after its status row was
gone.

Classify the markers from one shared table so a later upstream punctuation
change is a row, not a reparse, and stop the spinner when the hook row it
stands in for is cleared or dismissed.

Fixes stablyai#13890

* test(omp): preserve static state titles during normalization

---------

Co-authored-by: Merge Sim <sim@local>
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 17.2.12+ loses working status and can leave a spinner stuck on WSL

2 participants