Repository navigation
fix(terminal): OMP's prompt-bubble markers no longer end the agent's turn, so the phone's chat finds the session (#10923) - #30273
Merged
Conversation
…nt's turn (#10923) OMP ends every user bubble with OSC 133 B C D;0 to close its own prompt zone. Orca read that D as the shell's command finishing, retired the pane's hook authority mid-turn and deleted its status row, so the phone's chat view lost the provider session it reads the transcript by. A D;0 directly after B C is now an app's zone close, not a command exit.
Contributor
|
Warning Review limit reachedYou'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. View limit details
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. Comment |
This was referenced Oct 18, 2026
This was referenced Oct 18, 2026
Closed
7 of 9 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ELI5
Some agent CLIs draw invisible "this is a prompt" markers around the messages you type. OMP draws a "command started" marker and, right after it, a "command finished" marker at the end of every message bubble. Orca uses the same kind of marker from your shell to learn that a program has exited. It mistook OMP's marker for the shell saying "OMP exited", so in the middle of every turn it threw away what it knew about the running agent, including which conversation it is in. The phone's chat view needs exactly that to find the transcript, so it went blank.
What Changed
Before: in a terminal running OMP, sending a message (from the phone or the desktop) made Orca drop the pane's agent status mid-turn. On a headless
orca servehost the phone'ssession.tabs.listnever carriedagentStatus.providerSessionfor the OMP tab, so native chat had no transcript to read. The optimistic bubble showed, then the chat went back to empty, which is the OMP report in #10923. The agent's later hooks for that turn were also refused, because the pane had been retired.After: OMP's bubble markers are ignored. The pane keeps its status and session through the turn, the phone's tab list carries the OMP session, and
nativeChat.readSessionreturns the conversation. When OMP really exits, the shell's own marker still ends the command as before.Mechanism:
createOsc133CommandFinishedScanner(src/shared/terminal-osc133-command-finished.ts) is the one scanner every consumer uses: main's per-PTY tracker, the daemon's background fact relay, and the renderer. The scanner now remembers which OSC 133 marks arrived back to back, with no other output between them. AD;0that comes straight afterBthenCis an app closing its own zone, so it no longer counts as command-finished. Every otherCandDbehaves exactly as before.Root cause: OMP 18 ends each user bubble with
133;B 133;C 133;D;0(oh-my-pipackages/tui/src/chat/user-message.ts,OSC133_ZONE_CLOSE). Orca read thatDas command-finished. That fact callsretirePtyAgentLaunchAuthority, which callsretirePaneAuthorityon the hook server and deletes the pane's status row (terminal-title-tracker.tsandterminal-transient-facts.ts).Wire compatibility: no wire change. The host stops deleting a row it used to delete, so older phones get the existing optional
providerSessionfield they already read.Why
The rule has to be narrow, because the shell itself can print
Cand thenD;0back to back. A silent command such ascddoes that, and synthetic tests do too. Those finish events nudge things like the git status refresh and agent identity cleanup, so they have to keep firing.What tells them apart is the
B(end of the prompt). A shell prints itsCafter the command line the user typed, so aBis never directly before it. OMP printsB C D;0together in a single write.The rule needs no timers and no held state, so it also survives the daemon handing scanning over when a pane is hidden or shown. An earlier version of this PR waited for the shell's next prompt mark instead, and the Codex review found it lost a silent command's finish across that handoff.
Alternatives considered:
C/Dnesting depth: the daemon creates a fresh scanner each time a pane goes to the background, so the depth would be wrong in exactly the headless case.Linked Issue
Part of #10923 (the OMP reproduction). The other reproductions are covered in Notes.
Visual Proof
N/A. This is host-side status data with no UI change. The phone draws the same chat view once the session arrives.
Testing
Reproduced on fresh origin/main first, then verified with the fix, all locally on macOS with isolated HOME and profile, background launch and no windows:
orca servewith realompin its PTY and a local fake OpenAI-compatible model. A scripted phone client typed a prompt, then polledsession.tabs.listand callednativeChat.readSession.retirePaneAuthority(fromemitDaemonPtyTransientFact→ command-finished) deleting the row mid-turn, so the tab never gotproviderSession.readSessionreturns the user and assistant messages.src/main/runtime/__fixtures__/omp-user-bubble-osc133-zone.txt, recorded withconfig/scripts/capture-agent-pty-transcript.mjs(the scrub check came back clean).src/shared/terminal-osc133-self-closed-zone.test.ts(fails on main):C D;0), a command typed after the prompt'sB, and a failed command.src/main/runtime/omp-user-bubble-launch-authority.test.ts: a launched OMP pane keeps its hook authority through the real transcript and loses it when the shell reports the exit. This fails on main.src/shared,src/main/runtime,src/main/daemonandsrc/renderer/src/components/terminal-panefolders pass single-worker, apart from local failures that also fail on origin/main without this change:orca-runtime.test.tsandorca-runtime-structured-agent-session-create-intent.test.tsNot run: Windows and Linux, and the desktop renderer path (that path uses the same scanner, so it is covered only by the unit tests).
AI Disclosure
Review
Agent skill upstream boundary
Notes
Other #10923 reproductions, checked on current main:
orca serve+ Claude/Codex (the original report): already fixed on main.tests/e2e/headless-serve-mobile-native-chat-identity.spec.tspasses locally (fix(agents): a resumed agent's chat is readable on the phone before its first new turn #29664 and earlier).runtime:<env>, and the Mac forwardssession.tabs.listandnativeChat.*to that host's own orcad, which runs its own hook server and reads the transcript from its own disk. This is from reading the code; it was not run live here.providerSessionwith the Linux path, and the reader maps it to\\wsl.localhost. A distro with no Node 18+ never starts the relay (wsl-hook-relay-launch.ts, exit code 43), so its hooks never arrive. That is a likely cause, but it is unconfirmed.session.tabs.createTerminalcarries noresumeProviderSession(the gap noted in fix(agents): a resumed agent's chat is readable on the phone before its first new turn #29664).Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)