Skip to content

fix(terminal): preserve OSC 133 context across scanner handoffs - #32294

Open
nwparker wants to merge 1 commit into
mainfrom
fix/omp-osc133-scan-handoff
Open

nwparker wants to merge 1 commit into
mainfrom
fix/omp-osc133-scan-handoff

Conversation

@nwparker

@nwparker nwparker commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 5 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​479 $\color{#cf222e}{\Huge{\mathbf{−}}}$​35 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​444
Prod 13 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​205 $\color{#cf222e}{\Huge{\mathbf{−}}}$​7 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​198

Switching a terminal between foreground and background could split OMP’s adjacent OSC 133 B C D;0 prompt-bubble markers across independent scanners. Losing B/BC context made the bubble close look like a shell command completion, retiring a live pane’s hook authority and session identity.

The daemon now shadows the existing shared OSC 133 scanner across foreground bytes and emits completion facts only while backgrounded. Foreground handoff markers carry optional bounded scanner state, which main restores after generic escape-tail seeding. Reattaching after a detached interval resets this state; uninterrupted attachment replacement preserves it. Existing genuine shell/failed-command retirement semantics remain covered.

Related: #26933, #24436. Ordinary complete adjacent app-zone markers were already fixed by #30273/#30285. This PR addresses the independently reproduced handoff gap; it does not establish that every Esc/ask/spinner report has this cause, so it does not auto-close those issues. Existing #24196 covers broader process-authority confirmation; this change repairs parser continuity before completion facts reach consumers.

Validation:

  • 198 tests pass across 16 focused files: every-byte handoffs with BEL/ST, both directions after B/BC/partial D, real HTTP hook ingestion retaining accepted session identity and accepting subsequent hooks, true-exit and failed-exit retirement exactly once, actual daemon routing markers, uninterrupted attachment replacement and detach/missed-output/reattach, OpenCode controls and existing terminal lifecycle tests.
  • ORCA_BACKGROUND_LAUNCH=1 pnpm tc passes; changed-code quality has zero new findings; all 151 reliability gate definitions validate. New gate remains experimental.
  • Independent native Codex review found no blocking issue; 126 focused tests plus the 7-test refined attachment suite passed (overlapping coverage).
  • Baseline production-API reproduction fails four handoff cases with an all-background passing control.

Compatibility and limits: the marker field is optional; older peers keep their previous behavior. Both main and daemon need updating for the complete repair. No live OMP, rendered Electron, native PTY, WSL or paired-host acceptance is claimed. Mobile/folder workspaces use the same runtime facts; direct remote-runtime byte parsing is unchanged.

@coderabbitai

coderabbitai Bot commented Oct 23, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

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

Next included review available in 1 minute.

Check out review usage here.

View limit details

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

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: f0e812b4-4329-4631-9851-f5af253e9c97
📥 Commits

Reviewing files that changed from the base of the PR and between 7b0a7ee and 56d7e7e.

📒 Files selected for processing: 18
  • config/reliability-gates.jsonc
  • src/main/daemon/daemon-background-transient-facts.test.ts
  • src/main/daemon/daemon-background-transient-facts.ts
  • src/main/daemon/daemon-pty-adapter-protocol-compatibility.test.ts
  • src/main/daemon/daemon-pty-adapter.ts
  • src/main/daemon/daemon-session-background-routing.ts
  • src/main/daemon/daemon-stream-droppability-lifecycle.test.ts
  • src/main/daemon/daemon-stream-events.ts
  • src/main/daemon/daemon-terminal-admission.ts
  • src/main/daemon/session-output-plane.ts
  • src/main/daemon/terminal-host-create-contract.ts
  • src/main/ipc/pty/provider/bind-listeners.ts
  • src/main/providers/pty-provider-events.ts
  • src/main/runtime/omp-scan-handoff-launch-authority.test.ts
  • src/main/runtime/terminal/wait/terminal-wait-blocked-checks.ts
  • src/shared/terminal-osc133-command-finished.ts
  • src/shared/terminal-osc133-scan-handoff.test.ts
  • src/shared/terminal-output-side-effects.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

This branch has not been deployed

No deployments
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