Skip to content

feat(agent-status): read OSC 7501 program status beside hooks - #30261

Merged
nwparker merged 1 commit into
mainfrom
nwparker/osc7501-core
Oct 19, 2026
Merged

nwparker merged 1 commit into
mainfrom
nwparker/osc7501-core

Conversation

@nwparker

@nwparker nwparker commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 38 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​2192 $\color{#cf222e}{\Huge{\mathbf{−}}}$​16 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​2176
Prod 88 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​2402 $\color{#cf222e}{\Huge{\mathbf{−}}}$​208 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​2194

ELI5

Terminal programs can tell the terminal what they're doing (working, waiting for you, done, failed, how far along) with a standard escape sequence called OSC 7501. Claude Code, Codex, Grok, pi and oh-my-pi already send it. With this PR Orca understands it, while still preferring its own hooks wherever they exist.

What Changed

Before: Orca learned an agent's status only from per-agent hooks, or by guessing from window titles. Programs without an Orca integration (brew, terraform, an agent run with hooks off) had no status.

After: any program that speaks OSC 7501 gets a status row: working, waiting (approval or question), blocked (e.g. sign-in), done or failed, carrying its own message and progress. For agents that have hooks, nothing visible changes: hooks still own state, prompt, tool, transcript and resume identity. How the extra data is displayed (progress ring, letter icons, previews) comes in the next PR.

Mechanism:

  • Parsing: src/shared/program-status/ holds the protocol grammar and limits, a split-safe scanner (it also watches OSC 133 A and RIS, which end a program's records), per-terminal records, and a projector. The projector emits one lifecycle payload plus one facet per change.
  • Probe reply: Orca answers the OSC 7501 ; ? probe from the visible xterm (terminal-capability-replies) and from the hidden-pane emulator (terminal-view-attribute-responder). Claude and pi stay silent without that reply.
  • Lifecycle state: it joins the existing terminal-status ingress and has one owner per pane. server/program-status/hook-precedence.ts makes OSC 7501 yield to a live hook row, unless hooks have been silent for 2 minutes on a state the program has since left.
  • The facet: programStatus (state, kind, progress, message) is owned only by the OSC 7501 channel and lives in server/program-status/facet-store.ts. It's attached to rows at publish time, never persisted, and never decides state. A facet-only change goes out as programStatusOnly and patches just the facet in the renderer store: no notifications, state history or telemetry. It also reaches mobile, paired clients and worktree ps (42% / (Sign-in required)).
  • Classification, explicit before glyphs: several readers used to classify agent state only from title glyphs: idle edges, pending-message delivery, mailbox delivery, tui-idle waiters and exit inference. Claude stops painting its ⠂/✳ glyph once the probe is answered, which would have blinded them. Now, while a program reports OSC 7501, its activity is the status both the shared title tracker (createAgentStatusTracker) and main's records (classifyPtyTitleStatus) use. Titles only classify agents that report nothing explicit, so non-OSC 7501 agents are unchanged. A chunk's activity changes are applied before its titles, which then no longer move status.
  • Idle edges carry their classification: an idle edge now includes the status the tracker classified (idle / permission), and the prompt-cache timer identifies Claude from the pane's status row, so nothing downstream re-reads the title to work out what happened.

Why

OSC 7501 gives exact, ordered status for any program, at no per-event cost and with nothing to install. That makes it ideal over SSH and for tools Orca will never integrate. It can't replace hooks: it has no prompt, tool input, reply text or session id, and native chat and resume depend on those.

So I rejected both "switch agents to OSC 7501" and "ignore it where hooks exist" in favour of one owner for state (hooks first) plus an additive facet for what only the program knows. The facet lives in its own store, not inside the payload, so it can't race hook rows, isn't persisted, and stays wire-compatible: one optional field that older peers ignore.

Stack:

  1. refactor: extract helpers that agent-status files need room for #30260 prep refactors
  2. feat(agent-status): read OSC 7501 program status beside hooks #30261 (this PR) OSC 7501 core
  3. feat(agent-status): show OSC 7501 program status in rows and tabs #30262 OSC 7501 UI

Linked Issue

N/A (maintainer change; no pre-existing issue)

Visual Proof

Little visual change here: program rows appear with today's styling, and the presentation lands in the next PR, which has the screenshots.

Real Claude Code 2.1.302 with hooks, sampled from the renderer store during a turn: hooks keep owning the row while the facet carries Claude's own phase line.

t row state hook tool OSC 7501 facet owner
3s working Bash working · "Waiting 4 seconds" hook
5s working Write working · "Writing a.txt" hook
10s working Bash working · "Creating empty c.txt" hook
18s done Write done hook

Testing

  • I manually tested these changes locally
  • Automated tests added/updated

Live (macOS, background Orca dev build of the full stack):

  • Claude Code 2.1.302/2.1.303 with hooks: the probe is answered and Claude's titles are glyph-less, yet the agent-working and agent-idle (status: idle) edges fire from its OSC 7501 reports. The row stays hook-owned with facet updates beside it, the prompt-cache timer starts, and the tab title resets when Claude exits.
  • Claude Code 2.1.302 mapping: idle, working, question, permission, cancel and exit mapped correctly.
  • Codex startup: no spurious completion. Its startup report lands as a session-boundary done.
  • Codex 0.163, Grok 1.0.60, pi 1.3.0, oh-my-pi 18.10: verified with a PTY harness that answers like Orca.

Automated:

  • Unit tests: protocol, records, scanner, projector, facet store, hook precedence, presentation, and the explicit-first tracker.
  • Runtime tests: facet-before-status ordering, live-facet clearing on PTY exit, and Claude's captured glyph-less byte order still driving working/idle edges and the PTY's status.
  • Renderer tests: the facet-only IPC path and remote patching.
  • Results: typecheck and the changed-code lint gate are clean, and 118.9k tests pass across src/{shared,main,renderer,cli}. The remaining failures also fail on main or on this machine (real-shell suites, packaging, orcad paths, structured-session adoption, badgeColor), or are timing flakes that pass when run on their own. The one failure, orca-runtime.test.ts (badgeColor on runtime cloneRepo), also fails on main.

AI Disclosure

Review

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

  • Cross-platform: the parsing is plain TypeScript, so no platform branches.
  • SSH / remote: reports and replies use the existing PTY and provider-input paths (SSH, WSL, daemon). Remote-runtime panes run the same scanner in the renderer.
  • Compatibility: one optional live-only field; no new stream opcode and no persisted schema change.
  • Security: reports are bounded by the spec's limits, control characters are rejected, and bidi/invisible formatting is stripped. The only bytes Orca writes back are the fixed probe reply.
  • Performance: a few includes checks per chunk on the fast path; facet ticks skip all state subscribers.
  • Docs: src/main/agent-hooks/README.md has the OSC 7501 support matrix and the precedence rules.

Checklist

  • This PR is small and focused (a cohesive core: small single-purpose modules plus tests)
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • 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)

Programs can tell Orca what they are doing through the Program Status
Protocol (OSC 7501); Claude Code, Codex, Grok, pi and oh-my-pi already do.
Orca answers the protocol's feature-detection probe (visible xterm and the
hidden-pane emulator), parses reports from PTY output on the execution host
(src/shared/program-status/), and keeps two lanes:

- Lifecycle state keeps one owner per pane. Hooks win; OSC 7501 drives the
  row when hooks are off, missing, or silent on a state the program has
  left (server/program-status/hook-precedence).
- The program's own report (progress, its one-line message, blocks such as
  sign-in) is a live-only `programStatus` facet kept per pane
  (server/program-status/facet-store), stitched onto rows at publish time
  and carried to the renderer store, mobile, paired clients and
  `worktree ps`. Facet-only changes patch just the facet.

Title-driven readers (idle edges, delivery, tui-idle, exit inference)
classify by the program's OSC 7501 activity while it reports one and fall
back to title glyphs only for agents that report nothing explicit, so they
keep working when Claude stops painting its title glyph after the probe.
@nwparker
nwparker force-pushed the nwparker/osc7501-core branch from 1ef6bde to e922020 Compare October 19, 2026 03:53
@nwparker
nwparker changed the base branch from nwparker/osc7501-prep to main October 19, 2026 03:53
@coderabbitai

coderabbitai Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

📝 Walkthrough

The change adds support for OSC 7501 program-status reports across terminal processing, runtime status tracking, server hook-row handling, and renderer state. It parses reports into status payloads and facets, applies program activity alongside title-derived status, and propagates facets through IPC and runtime projections. It also adds program-status query replies, presentation and CLI formatting, cleanup behavior, and tests and documentation for these paths.

Priority: ➖ Normal

Merge Risk: 🟡 Moderate · up to e9220

The new program-status channel can delete or overwrite status rows written by the older in-band status protocol when both protocols appear in the same terminal. After dropped output, a terminal can also keep showing an agent as working when it has finished. Resolve or explicitly accept both issues before merging.

Pre-merge checks: Passed 4 · Inconclusive 1

Failed Failed checks: 1 inconclusive

Check name Status Explanation Resolution
Docstring Coverage Inconclusive Docstring coverage is 26.32% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 19 functions across 50 files. (76 skipped… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title is concise, specific, and accurately describes the main change: reading OSC 7501 program status alongside hook status.
Description check Passed The description is detailed and covers the required explanation, mechanism, rationale, testing, visual impact, compatibility, security, and checklist areas. It identifies the linked issue as not appli…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description is detailed and covers the required explanation, mechanism, rationale, testing, visual impact, compatibility, security, and checklist areas. It identifies the linked issue as not applicable for a maintainer change. Some optional sections are empty, and the checklist claims all commands pass while the testing notes remaining failures, but the overall description is complete and relevant.

Full details: Docstring Coverage

Explanation

Docstring coverage is 26.32% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 19 functions across 50 files. (76 skipped: 1 unsupported, 75 over the file limit.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
  • 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.

@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


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: ef7da9ab-c7a9-49b3-aa1d-898b1b46d20d
📥 Commits

Reviewing files that changed from the base of the PR and between 6328a10 and e922020.

📒 Files selected for processing: 126
  • src/cli/workspace-format.ts
  • src/cli/worktree-ps-program-status.test.ts
  • src/cli/worktree-ps-program-status.ts
  • src/main/agent-hooks/README.md
  • src/main/agent-hooks/agent-hook-runtime-deps.ts
  • src/main/agent-hooks/server-program-status-hook-yield.test.ts
  • src/main/agent-hooks/server/program-status/facet-store.test.ts
  • src/main/agent-hooks/server/program-status/facet-store.ts
  • src/main/agent-hooks/server/program-status/hook-precedence.test.ts
  • src/main/agent-hooks/server/program-status/hook-precedence.ts
  • src/main/agent-hooks/server/program-status/pane-timers.test.ts
  • src/main/agent-hooks/server/program-status/pane-timers.ts
  • src/main/agent-hooks/server/server-authority-aliases.ts
  • src/main/agent-hooks/server/server-ingest-terminal.ts
  • src/main/agent-hooks/server/server-lifecycle.ts
  • src/main/agent-hooks/server/server-listeners.ts
  • src/main/agent-hooks/server/server-persistence.ts
  • src/main/agent-hooks/server/server-row-ownership.ts
  • src/main/agent-hooks/server/server-status-identity.ts
  • src/main/agent-hooks/server/server-tab-cleanup.ts
  • src/main/agent-hooks/server/server-types.ts
  • src/main/daemon/terminal-view-attribute-responder.test.ts
  • src/main/daemon/terminal-view-attribute-responder.ts
  • src/main/runtime/construction/runtime-construction-dependencies.ts
  • src/main/runtime/construction/runtime-construction.ts
  • src/main/runtime/construction/runtime-host-services.ts
  • src/main/runtime/orca-runtime-tests/program-status-osc.spec.ts
  • src/main/runtime/orca-runtime-tests/terminal-side-effect-facts-part-02.spec.ts
  • src/main/runtime/orca-runtime-tests/terminal-side-effect-facts-part-03.spec.ts
  • src/main/runtime/orca-runtime-tests/terminal-side-effect-facts.spec.ts
  • src/main/runtime/orca-runtime.test.ts
  • src/main/runtime/runtime-hook-agent-row-selection.ts
  • src/main/runtime/runtime-mobile-agent-status-builder.test.ts
  • src/main/runtime/runtime-mobile-agent-status-builder.ts
  • src/main/runtime/runtime-mobile-agent-status-projection.ts
  • src/main/runtime/runtime-terminal-contracts.ts
  • src/main/runtime/runtime-terminal-state-records.ts
  • src/main/runtime/runtime-worktree-agent-rows.ts
  • src/main/runtime/runtime-worktree-agent-source.ts
  • src/main/runtime/runtime-worktree-agent-sources.test.ts
  • src/main/runtime/runtime-worktree-pty-agent-sources.ts
  • src/main/runtime/terminal/lifecycle/floating-session-liveness.ts
  • src/main/runtime/terminal/lifecycle/pty-exit-lifecycle.ts
  • src/main/runtime/terminal/lifecycle/terminal-view-resources.ts
  • src/main/runtime/terminal/output/pty-output-ingestion.ts
  • src/main/runtime/terminal/output/terminal-derived-agent-facts.ts
  • src/main/runtime/terminal/output/terminal-output-generation.ts
  • src/main/runtime/terminal/output/terminal-title-observation.ts
  • src/main/runtime/terminal/output/terminal-title-tracker.ts
  • src/main/runtime/terminal/wait/terminal-wait-blocked-checks.ts
  • src/main/runtime/tui-idle-evidence.test.ts
  • src/main/runtime/tui-idle-evidence.ts
  • src/main/startup/main-window-agent-status.ts
  • src/renderer/src/components/terminal-pane/parked-terminal-byte-watcher.ts
  • src/renderer/src/components/terminal-pane/pty-connection/agent-task-complete-notify.ts
  • src/renderer/src/components/terminal-pane/pty-connection/pty-input-recovery.ts
  • src/renderer/src/components/terminal-pane/pty-output-effect-ordering.ts
  • src/renderer/src/components/terminal-pane/pty-output-processor-program-activity.test.ts
  • src/renderer/src/components/terminal-pane/pty-output-processor.ts
  • src/renderer/src/components/terminal-pane/pty-output-side-effect-queue.ts
  • src/renderer/src/components/terminal-pane/pty-output-title-observer.ts
  • src/renderer/src/components/terminal-pane/pty-transport-types.ts
  • src/renderer/src/components/terminal-pane/pty-transport.ts
  • src/renderer/src/components/terminal-pane/terminal-capability-replies.ts
  • src/renderer/src/components/terminal-pane/terminal-side-effect-facts-handler.test.ts
  • src/renderer/src/components/terminal-pane/terminal-side-effect-facts-handler.ts
  • src/renderer/src/hooks/ipc-events-agent-status-store-test-fixtures.ts
  • src/renderer/src/hooks/ipc-events/agent-status-event-applicator.ts
  • src/renderer/src/hooks/ipc-events/agent-status-listeners.ts
  • src/renderer/src/hooks/ipc-events/agent-status-partial-updates.ts
  • src/renderer/src/hooks/ipc-events/agent-status-program-status-only.test.ts
  • src/renderer/src/hooks/ipc-events/agent-status-unavailable.test.ts
  • src/renderer/src/hooks/useIpcEvents-agent-status-batch-projection.test.ts
  • src/renderer/src/lib/agent-idle-edge.test.ts
  • src/renderer/src/lib/agent-idle-edge.ts
  • src/renderer/src/runtime/remote-agent-row-program-status.test.ts
  • src/renderer/src/runtime/runtime-rpc-client.ts
  • src/renderer/src/runtime/sync-runtime-graph-agent-status-projection.test.ts
  • src/renderer/src/runtime/sync-runtime-graph-projection-hot-path.test.ts
  • src/renderer/src/runtime/sync-runtime-graph/agent-status-projection.ts
  • src/renderer/src/runtime/web-session-tabs-sync/agent-status-patch.ts
  • src/renderer/src/runtime/web-session-tabs-sync/state-equality-core.test.ts
  • src/renderer/src/runtime/web-session-tabs-sync/state-equality-core.ts
  • src/renderer/src/store/slices/agent-status-batch.test.ts
  • src/renderer/src/store/slices/agent-status-contract.ts
  • src/renderer/src/store/slices/agent-status-live-entry-builder.ts
  • src/renderer/src/store/slices/agent-status-program-status-actions.ts
  • src/renderer/src/store/slices/agent-status-program-status.test.ts
  • src/renderer/src/store/slices/agent-status-runtime.ts
  • src/renderer/src/store/slices/agent-status-slice-contract.ts
  • src/renderer/src/store/slices/agent-status.ts
  • src/shared/agent-detection.ts
  • src/shared/agent-status-ipc-payload.ts
  • src/shared/agent-status-observation.ts
  • src/shared/agent-status-osc-pending-retention.test.ts
  • src/shared/agent-status-osc-scan-budget.test.ts
  • src/shared/agent-status-osc.test.ts
  • src/shared/agent-status-osc.ts
  • src/shared/agent-status-subagent-snapshot.ts
  • src/shared/agent-status-tracker-program-activity.test.ts
  • src/shared/agent-status-types.ts
  • src/shared/agent-title-status.ts
  • src/shared/claude-terminal-interrupt.test.ts
  • src/shared/claude-terminal-interrupt.ts
  • src/shared/osc-title-extraction.ts
  • src/shared/program-status/activity.ts
  • src/shared/program-status/agent-status-projector.test.ts
  • src/shared/program-status/agent-status-projector.ts
  • src/shared/program-status/facet.ts
  • src/shared/program-status/osc-scanner.test.ts
  • src/shared/program-status/osc-scanner.ts
  • src/shared/program-status/presentation.test.ts
  • src/shared/program-status/presentation.ts
  • src/shared/program-status/protocol.test.ts
  • src/shared/program-status/protocol.ts
  • src/shared/program-status/query-responder.test.ts
  • src/shared/program-status/query-responder.ts
  • src/shared/program-status/records.test.ts
  • src/shared/program-status/records.ts
  • src/shared/program-status/title-activity-order.ts
  • src/shared/protocol-version.ts
  • src/shared/runtime-worktree-contracts.ts
  • src/shared/terminal-agent-status-processor.test.ts
  • src/shared/terminal-agent-status-processor.ts
  • src/shared/terminal-output-side-effects.ts
  • src/shared/terminal-side-effect-facts.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 2 remain after this review.

Comment on lines +202 to +214
if (event.removesProgramStatusRow === true) {
// Why: gone records end only the program's own row; they are no verdict on a hook agent.
this.hookSilenceRechecks.cancel(paneKey)
if (previous?.observation?.origin === 'osc') {
// Why a row drop, not pane teardown: the process lives on, and so do its alias and caches.
if (mutationBefore !== undefined) {
this.commitStatusRowMutation(mutationBefore, previous)
}
this.dropStatusEntry(paneKey)
this.emitPaneStatusCleared({ paneKey, programStatusRemoved: true })
}
return
}

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 | 🏗️ Heavy lift

🔎 Supported by static analysis

🏁 Script executed:

sed -n '190,340p' src/main/agent-hooks/server/server-ingest-terminal.ts
rg -n "9999" src --glob '!*.test.ts' -l | head -40
rg -n "fromProgramStatus|programStatusOrigin|origin: 'osc'" src/main src/shared | head -60

Repository: stablyai/orca

Length of output: 10923


🏁 Script executed:

set -o pipefail
printf '%s\n' '--- OSC 9999 references and emitters ---'
rg -n -F --glob '*.ts' --glob '*.tsx' --glob '*.md' -e '\x1b]9999;' -e '9999;' -e 'OSC 9999' -e 'osc9999' -e 'OSC9999' src docs .github 2>/dev/null || test "$?" -eq 1
printf '%s\n' '--- program-status flow and provenance fields ---'
rg -n -F --glob '*.ts' -e 'programStatusPayloads' -e 'fromProgramStatus' -e 'removesProgramStatusRow' -e 'origin:' -e 'ingestProgramStatusFacet' -e 'ingestTerminalStatus' src/main src/shared | head -240
printf '%s\n' '--- relevant declarations and parser/projector files ---'
sed -n '1,240p' src/shared/agent-status-osc.ts
sed -n '120,210p' src/main/runtime/terminal/output/terminal-derived-agent-facts.ts
sed -n '130,205p' src/main/runtime/runtime-terminal-contracts.ts
sed -n '1,180p' src/shared/agent-status-observation.ts
printf '%s\n' '--- runtime/configuration references for terminal agents and wrappers ---'
rg -n -i --glob '*.ts' --glob '*.tsx' --glob '*.md' -e 'agent integration' -e 'wrapper' -e 'pty' -e 'terminal.*agent' -e 'osc' src/main src/shared docs 2>/dev/null | head -240

Repository: stablyai/orca

Length of output: 42297


🏁 Script executed:

set -o pipefail
printf '%s\n' '--- merged protocol processor ---'
nl -ba src/shared/terminal-agent-status-processor.ts | sed -n '1,180p'
printf '%s\n' '--- derived terminal facts and event dispatch ---'
nl -ba src/main/runtime/terminal/output/terminal-derived-agent-facts.ts | sed -n '1,240p'
printf '%s\n' '--- OSC 7501 projector ---'
nl -ba src/shared/program-status/agent-status-projector.ts | sed -n '1,240p'
printf '%s\n' '--- ingest event contract and mutation path ---'
nl -ba src/main/agent-hooks/server/server-ingest-terminal.ts | sed -n '70,340p'
printf '%s\n' '--- status application and origin handling ---'
nl -ba src/main/agent-hooks/server/server-status-application.ts | sed -n '230,330p'
printf '%s\n' '--- protocol tests showing interleaving and source path ---'
nl -ba src/shared/terminal-agent-status-processor.test.ts | sed -n '1,90p'
nl -ba src/main/runtime/orca-runtime-tests/terminal-output-and-worker-recovery.spec.ts | sed -n '130,205p'

Repository: stablyai/orca

Length of output: 42405


[P1] Keep OSC 9999 and OSC 7501 row provenance separate.

The PTY processor accepts both protocols on the same PTY and preserves their byte order. It can therefore process an OSC 9999 payload followed by an OSC 7501 payload from the same stream.

emitTerminalAgentStatusEvents marks OSC 7501 events with fromProgramStatus, but the row stores only observation.origin: 'osc'. When an OSC 7501 report has removesProgramStatusRow, the removal branch checks only that shared origin. It can therefore drop an OSC 9999 row. An ordinary OSC 7501 update also reaches applyNormalizedStatus and can replace an OSC 9999 row because no stored provenance or agentType check gives the OSC 9999 row precedence.

Record OSC 7501 provenance on the stored row. Gate program-status removal and update precedence on that provenance instead of on the shared origin: 'osc' value.

Comment on lines 243 to 246
resetAgentStatusCarry: () => {
processAgentStatusChunk = createAgentStatusOscProcessor()
scanProgramStatus = createProgramStatusSideEffectScanner()
},

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 | 🟡 Minor | ⚡ Quick win

🔎 Supported by static analysis

🏁 Script executed:

#!/bin/bash
rg -nP -C4 '\bresetCrossChunkParserState\b'

Repository: stablyai/orca

Length of output: 4892


Clear program activity when resetting parser state.

When resetCrossChunkParserState runs after dropped PTY bytes, resetAgentStatusCarry recreates scanProgramStatus but leaves titleObserver with its previous programActivity. The new scanner has no record of the prior activity, so it cannot emit the transition to null. Later title updates can remain classified as working, which prevents idle classification and related completion handling.

🐛 Suggested fix
--- "a/src/renderer/src/components/terminal-pane/pty-output-processor.ts"
+++ "b/src/renderer/src/components/terminal-pane/pty-output-processor.ts"
@@ -240,10 +240,12 @@
     clearStaleTitleTimer: titleObserver.clearStaleTitleTimer,
     flushPendingSideEffects: sideEffects.flush,
     resetBellDetector: () => bellDetector.reset(),
     resetAgentStatusCarry: () => {
       processAgentStatusChunk = createAgentStatusOscProcessor()
       scanProgramStatus = createProgramStatusSideEffectScanner()
+      // The fresh scanner no longer knows the program's records; titles classify again.
+      titleObserver.applyProgramActivity(null)
     },
     getPendingEscapeTailAnsi: () => partialEscapeTail,
     disposePendingSideEffectGauge: sideEffects.disposeGauge
   }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
resetAgentStatusCarry: () => {
processAgentStatusChunk = createAgentStatusOscProcessor()
scanProgramStatus = createProgramStatusSideEffectScanner()
},
resetAgentStatusCarry: () => {
processAgentStatusChunk = createAgentStatusOscProcessor()
scanProgramStatus = createProgramStatusSideEffectScanner()
// The fresh scanner no longer knows the program's records; titles classify again.
titleObserver.applyProgramActivity(null)
},

@nwparker nwparker closed this Oct 19, 2026
@nwparker nwparker reopened this Oct 19, 2026
@nwparker
nwparker merged commit e3c9370 into main Oct 19, 2026
62 checks passed
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