Skip to content

Fix typed OMP remote title flicker - #6954

Merged
Jinwoo-H merged 4 commits into
stablyai:mainfrom
Dvitash:Dvitash/bug-omp-pi-title-flicker-only-when-agent-started
Jul 3, 2026
Merged

Jinwoo-H merged 4 commits into
stablyai:mainfrom
Dvitash:Dvitash/bug-omp-pi-title-flicker-only-when-agent-started

Conversation

@Dvitash

@Dvitash Dvitash commented Jun 30, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • infer manually typed agent ownership in generic terminal panes before normalizing Pi-compatible remote status
  • use foreground agent ownership as a host/mobile fallback when launch metadata is absent
  • preserve typed Pi sessions as Pi while keeping typed OMP sessions labeled OMP
  • My previous PR (Fix remote OMP terminal title thrash #6689) fixed the case of starting the OMP session using the "+" button. This is for the more general case of starting it with typing "omp" in a blank terminal.

Closes #6943.

Screenshots

No new UI surfaces. The regression covers remote runtime panes started by typing omp in a normal terminal.

Testing

  • pnpm exec vitest run --config config/vitest.config.ts src/renderer/src/components/terminal-pane/pty-connection.test.ts src/main/runtime/orca-runtime.test.ts -t "typed omp|typed pi|unknown-launch foreground"
  • ./node_modules/.bin/tsgo --noEmit -p config/tsconfig.node.json
  • ./node_modules/.bin/tsgo --noEmit -p config/tsconfig.tc.web.json
  • ./node_modules/.bin/oxlint src/renderer/src/components/terminal-pane/pty-connection.ts src/renderer/src/components/terminal-pane/pty-connection.test.ts src/main/runtime/orca-runtime.ts src/main/runtime/orca-runtime.test.ts
  • Local remote-host smoke: typed omp in a normal terminal stayed labeled OMP on the remote host

Open in Stage

@ghost

ghost commented Jun 30, 2026

Copy link
Copy Markdown

Ready to review this PR? Stage has broken it down into 2 individual chapters for you:

Title
1 Infer agent ownership from typed terminal commands
2 Fallback to foreground agent for mobile sessions
Open in Stage

Chapters generated by Stage for commit 5b9c9a2 on Jun 30, 2026 10:36pm UTC.

@coderabbitai

coderabbitai Bot commented Jun 30, 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: eb83b103-4ffb-4e87-9c91-3aef38bd79b5

📥 Commits

Reviewing files that changed from the base of the PR and between 5b9c9a2 and f14c10c.

📒 Files selected for processing (2)
  • src/main/runtime/orca-runtime.test.ts
  • src/main/runtime/orca-runtime.ts
💤 Files with no reviewable changes (2)
  • src/main/runtime/orca-runtime.test.ts
  • src/main/runtime/orca-runtime.ts

📝 Walkthrough

Walkthrough

The change updates Pi-compatible terminal title normalization in the main runtime to use launch or foreground ownership, adds delayed snapshot publishing while foreground ownership probes resolve, and expands runtime tests for probe ordering and emitted tab state. In the renderer, it adds manual command inference from accepted shell input, uses that inferred agent in authoritative pane-agent selection, clears it on lifecycle boundaries, and updates tests and mocks for Pi-compatible omp and pi cases.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description covers summary, screenshots, and testing, but omits the required AI Review Report, Security Audit, and Notes sections. Add the missing AI Review Report, Security Audit, and Notes sections, and include the required cross-platform review details.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately names the main change: fixing typed OMP remote title flicker.
Linked Issues check ✅ Passed The PR fixes the typed-terminal OMP/Pi title flicker in remote panes and adds tests for typed OMP, typed Pi, and pending foreground probes.
Out of Scope Changes check ✅ Passed I don't see unrelated feature work; the mobile and foreground-agent changes appear to support the same title-stabilization fix.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

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

🧹 Nitpick comments (1)
src/renderer/src/components/terminal-pane/pty-connection.test.ts (1)

811-813: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Assert the Pi title never leaks in the OMP regression test.

The issue is title thrashing, so this test should fail if the pane briefly receives Pi ready before OMP ready.

🧪 Proposed test hardening
     expect(transport.sendInput).toHaveBeenCalledWith('omp\r')
+    expect(deps.setRuntimePaneTitle).not.toHaveBeenCalledWith('tab-1', 1, 'Pi ready')
+    expect(deps.updateTabTitle).not.toHaveBeenCalledWith('tab-1', 'Pi ready')
     expect(deps.setRuntimePaneTitle).toHaveBeenCalledWith('tab-1', 1, 'OMP ready')
     expect(deps.updateTabTitle).toHaveBeenCalledWith('tab-1', 'OMP ready')

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 4eef412d-121c-4470-a853-860cbd221f83

📥 Commits

Reviewing files that changed from the base of the PR and between bcb381e and 5b9c9a2.

📒 Files selected for processing (4)
  • src/main/runtime/orca-runtime.test.ts
  • src/main/runtime/orca-runtime.ts
  • src/renderer/src/components/terminal-pane/pty-connection.test.ts
  • src/renderer/src/components/terminal-pane/pty-connection.ts

Comment on lines 1937 to +1938
const onAgentExited = (): void => {
clearCommandInferredPaneAgent()

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

Clear manual ownership on PTY exit too.

onAgentExited is title-driven; PTY exits can also leave this binding mounted for suppressed restarts, so the next PTY can inherit a stale typed omp/pi owner. Call clearCommandInferredPaneAgent() from onExit before any early returns.

🐛 Proposed fix
   const onExit = (ptyId: string): void => {
+    clearCommandInferredPaneAgent()
     if (handledExitPtyId === ptyId) {
       return
     }

Jinwoo-H and others added 3 commits July 3, 2026 01:50
…tle-flicker-only-when-agent-started

# Conflicts:
#	src/renderer/src/components/terminal-pane/pty-connection.ts

@Jinwoo-H Jinwoo-H 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.

Thanks for the fix. I added follow-up hardening before landing:

  • kept ambiguous Pi-compatible mobile session titles queued until foreground ownership is known
  • handled same-status title races and stale foreground probes without per-frame foreground polling
  • tightened renderer typed-command inference around live title-only agents, stale retained done statuses, Ctrl+W/Delete/cursor edits, large paste input, and same-chunk command-finished ordering
  • added regression coverage for the OMP/Pi ownership edge cases

Validated with affected Vitest files, typecheck, lint, and Electron smoke/regression screenshots.

@Jinwoo-H
Jinwoo-H merged commit 0ff2c09 into stablyai:main Jul 3, 2026
2 checks passed
Jinwoo-H added a commit that referenced this pull request Jul 3, 2026
…rmance

The fix patched main's direct title-update block in onPtyData — an
architecture the term-speed-2 chain replaced with the per-PTY title
tracker. Resolution keeps the tracker and ports the fix's semantics into
applyTrackedPtyTitle: foreground-owner probe with title-observation
sequencing on status transitions, same-status compatible-title changes
reuse the pending probe, and mobile snapshot fan-out is deferred until
the probe settles (delayPtyBackedMobileSnapshotForForegroundAgent).
Renderer side keeps the chain's shared handleCommandFinished (side-
effect authority routing) and grafts the fix's
clearCommandInferredPaneAgentAfterPtySideEffects() call.

Validation: #6954's own 760+ lines of merged tests pass against the
tracker port (574 runtime + 344 pty-connection/lifecycle); full battery
5,661 green (1 documented pre-existing WSL failure); typecheck clean.

Co-authored-by: Orca <[email protected]>
nwparker added a commit that referenced this pull request Jul 4, 2026
… shadow-cursor tracking

Quality pass on terminal PRs merged 2026-07-03:

- pane-split-close: extract a shared `teardownManagedPane` so `closeManagedPane` and
  `detachManagedPaneForExternalMove` can't drift apart on future edits (#7215).
- terminal-link-activation: reuse the existing `isMacPlatform()` instead of a second
  inline `navigator.userAgent` copy, keeping one source of truth for Mac detection.
- pty-connection: gate the shadow-cursor moves on empty CSI params so parameterized/
  modified cursor keys (e.g. Ctrl+Left word-jump, `ESC[1;5D`) reset command tracking
  instead of silently desyncing the buffer used to infer a typed agent name; relocate
  the `getAuthoritativePaneAgent` JSDoc to the function it documents (#6954).

No behavior change except the cursor-tracking hardening; all touched unit suites pass.
nwparker added a commit that referenced this pull request Jul 4, 2026
… shadow-cursor tracking (#7320)

Quality pass on terminal PRs merged 2026-07-03:

- pane-split-close: extract a shared `teardownManagedPane` so `closeManagedPane` and
  `detachManagedPaneForExternalMove` can't drift apart on future edits (#7215).
- terminal-link-activation: reuse the existing `isMacPlatform()` instead of a second
  inline `navigator.userAgent` copy, keeping one source of truth for Mac detection.
- pty-connection: gate the shadow-cursor moves on empty CSI params so parameterized/
  modified cursor keys (e.g. Ctrl+Left word-jump, `ESC[1;5D`) reset command tracking
  instead of silently desyncing the buffer used to infer a typed agent name; relocate
  the `getAuthoritativePaneAgent` JSDoc to the function it documents (#6954).

No behavior change except the cursor-tracking hardening; all touched unit suites pass.
@Dvitash
Dvitash deleted the Dvitash/bug-omp-pi-title-flicker-only-when-agent-started branch July 6, 2026 12:46
@Dvitash Dvitash mentioned this pull request Jul 7, 2026
2 of 5 tasks
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
… shadow-cursor tracking (stablyai#7320)

Quality pass on terminal PRs merged 2026-07-03:

- pane-split-close: extract a shared `teardownManagedPane` so `closeManagedPane` and
  `detachManagedPaneForExternalMove` can't drift apart on future edits (stablyai#7215).
- terminal-link-activation: reuse the existing `isMacPlatform()` instead of a second
  inline `navigator.userAgent` copy, keeping one source of truth for Mac detection.
- pty-connection: gate the shadow-cursor moves on empty CSI params so parameterized/
  modified cursor keys (e.g. Ctrl+Left word-jump, `ESC[1;5D`) reset command tracking
  instead of silently desyncing the buffer used to infer a typed agent name; relocate
  the `getAuthoritativePaneAgent` JSDoc to the function it documents (stablyai#6954).

No behavior change except the cursor-tracking hardening; all touched unit suites pass.
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/Pi title flicker only when agent started with using "omp" command in a normal terminal.

2 participants