Repository navigation
fix(opencode): stop deriving opencode run status from the pane's process - #24472
brennanb2025 wants to merge 6 commits into
Conversation
…ocess Agent status comes only from the general mechanisms: an agent's own hooks or plugins, plus the rule that clears a pane's row when its agent process exits. Done means a live agent finished its turn; an exited process leaves no row. #23722 broke that rule for one command: the runtime read a pane's foreground process and argv after each OSC 133 command start and posted Working, then Done, for an OpenCode `run`, which no hook reports. Remove that special case and everything that existed only for it: - the runtime producer (OpenCodeRunLifetimeStatus), its wiring into command start/finish, the daemon's background command-finished fact and pane teardown, and the after-facts queue that ordered its Done; - the foreground argv readers it used (local, POSIX and Windows); - the status store's process-origin terminal writes: the yield-to-hook window and the retired-pane revival a process Working could trigger; - the title tracker's command-start callback, which had no other consumer (the OSC 133 scanner and its other start consumers are unchanged); - the status plugin's skip of SessionStart inside an OpenCode 1 `run` process, which only hid an idle blink after the producer's Working. An OpenCode 2 `opencode run` in a pane now shows no status, and its exit clears nothing because nothing was posted. OpenCode 1 `run` reports through its in-process plugin as before #23722. Other agents, the OpenCode 2 TUI plugin, the server plugin's stand-down and the OpenCode 1 binder are unchanged.
|
Superseded: the current review status, including the passing live QA, is in the 2026-10-05 comment below: #24472 (comment) Review status (head 9c32987)The problem: #23722 added an OpenCode-2-only status path that watched the terminal's foreground process for User-facing change: an OpenCode 2 Review result: no P0, P1 or P2 issues; no code changes were needed. Three independent reviewers (removal census, status store and OpenCode 1 plugin, renderer and tests) plus a readiness checklist found nothing blocking.
Fixed during review: PR description wording only. It now says correctly when the old OpenCode 1 skip's idle blink happened, relabels the launch-token note as correctness, and records the pre-existing late-Done gap below as TEMPORARY. Deferred:
Verified:
Not verified: live Electron QA with real OpenCode 2 has not run. The remote QA machine's agent driver is out of usage, and no other allowed driver was available. A remote rig with main and this branch built side by side is set up and ready to resume. The PR stays a draft until that QA passes. |
Conflict resolutions: - status-plugin-runtime-state-source.ts: keep main's isOpenCodeCommandProcess (main's plugin post source now uses it for "serve"); drop the detector-only isOpenCodeRunProcess wrapper. - opencode-headless-command.ts/.test.ts: keep main's versions; main uses isOpenCodeRunCommand/findOpenCodeRunCommand for startup-prompt handling. Only the comment describing the removed status detector changes. - pty-connection-command-finished-late-done.test.ts: stays deleted; main only made its setup await installTerminalTestGlobals.
…2025/opencode-run-remove-detector
…2025/opencode-run-remove-detector
Review status, 2026-10-05 (head 9405f9b, supersedes the 10-01 status)The problem: #23722 added an OpenCode-2-only status path that watched the terminal's foreground process for User-facing change: an OpenCode 2 Code review: no P0, P1 or P2 issues. Three independent reviewers (removal census, status store and OpenCode 1 plugin, renderer and tests) plus a readiness checklist found nothing blocking. Details are in the 10-01 status comment above; all of it still holds after the main merges below. Changed since 10-01:
Live Electron QA (passed): run on a separate Mac with real OpenCode 2.0.21, comparing main (990b0ed) against this branch (c4f606f; later merges changed none of the PR's files). Each build was confirmed by string counts in its bundle: the removed detector's strings appear in main's bundle (2/3/3) and not at all in the PR's (0/0/0). An in-page sampler checked the status rows every 250 ms. All free OpenCode models were rate-limited (HTTP 429), so OpenCode talked to a local test model that replies after 20 s. OpenCode itself, its plugin and Orca were all real.
Main, after the visible This PR, during the same This PR, after it exited (no row): This PR, three This PR, full This PR, after the full window exited (row cleared): Deferred (unchanged from 10-01):
CI (head 9405f9b): green. Typecheck, all five test shards, relay integration, the macOS and Windows packages, managed hooks on Node 18 and verify all pass. One supplementary full-unit-test check was still queued when I last checked. Earlier red runs on this branch came only from breaks on main itself, each fixed on main and merged in: a test using an outdated type shape (#24991 vs #25073, fixed by #25706, #25709, #25717 and #25728), and a prompt-carry test that broke after #23672 (fixed by #25734). Not verified: the live QA covered macOS only (no Windows, Linux, SSH or WSL panes; the removed detector never ran in SSH or WSL panes anyway). It also didn't test a hook-driven Claude turn. |
…2025/opencode-run-remove-detector
…2025/opencode-run-remove-detector
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (29)
💤 Files with no reviewable changes (18)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 2 remain after this review. 📝 WalkthroughWalkthroughThe generated OpenCode plugin now enqueues Priority: ➖ Normal Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to The changed status behavior and command-completion paths show no demonstrated merge-blocking issue. Merge after normal checks. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to The inspected changes preserve identity checks and remove a status-acceptance exception. No newly introduced security weakness was identified, but incomplete coverage leaves some uncertainty. Retained concerns Security review detailsSecurity Blast Radius
Security Findings and Attack Paths
Trust Boundaries and Controls
Resilience and Maintainability Implications
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
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 |






ELI5
Orca shows an agent's status (Working, Needs input, Done) from the agent's own hooks or plugins. That works the same way for every agent. #23722 added one exception: for OpenCode 2's one-shot
opencode run "<prompt>"command, Orca watched the terminal's foreground process to guess when it was working. That special case also left a stale Done row after the command had exited. This PR removes it.opencode runnow behaves like any other command that sends no agent hooks: no status row.What it fixes and scope
orca worktree ps, mobile) left behind afteropencode runhas exited back to the shell. Removes an agent-specific status path. Regression source: fix(opencode): report OpenCode 2 status from each pane's own TUI #23722.opencode runin a pane shows no status, before or after it exits. OpenCode 2opencode minialready shows none. Both are client commands that load no Orca plugin in the pane.run, which reports through its own plugin; Claude, Codex and every other agent; and the shell's command start/finish markers, which other features still use.What Changed
Before: on the shell's command-start marker, main read the pane's foreground process and command line. If it was
opencode run, main posted Working, and on command finish it posted Done. Because the process had already exited by then, the Done either lingered (stale row) or was dropped, depending on timing.After: that detector and everything that existed only for it are gone:
opencode rundetector and its wiring on command start, command finish, the hidden-pane command-finished fact, and pane teardown;runprocess. It existed only to stop the run's session-start post from blinking the pane idle between the detector's Working and the plugin's own Working. The plugin's bytes change, so installed copies are rewritten once on the next start.opencode runcommand-line parser (isOpenCodeRunCommand), which OpenCode startup-prompt handling now uses (fix(opencode): submit admitted native startup briefs without overwriting input #24762).Why
opencode runandopencode minishow no status. The way to cover them through the normal path would be OpenCode exposing a session's client environment (which includes Orca's pane ID) to plugins. OpenCode already receives it but doesn't expose it. That would need an upstream OpenCode change; none is filed.run) can still be left behind. That rule predates fix(opencode): report OpenCode 2 status from each pane's own TUI #23722; a follow-up should decide whether a Done from the same turn is also dropped. This PR deletes the one test that pinned keeping it, because that test contradicts the rule above.Linked Issue
Follow-up to Linear STA-8629 and #23722. Supersedes #24238 and #24292 (closed). Should ship with the #23722 cherry-pick (STA-9065).
Visual Proof
Live check with real OpenCode 2 on macOS, main vs this PR. A test also proves no row appears for
opencode run, and that test fails on main's code.Before (main), after

opencode runhas exited, the stale Done row:After (this PR), the same command after exit, no row:

After (this PR), the full

opencodewindow still shows Done on its own pane:Testing
I manually tested these changes locally
Automated tests added/updated, or explained why not below
New
src/main/runtime/opencode-run-pane-status.test.tswires the runtime to a real status store, withopencode run …in the pane's foreground. It covers a visible pane and a hidden pane whose daemon reports the command finished. Neither produces a status event or row, and the command-finished fact still fires. With main's detector restored, both cases fail.Related suites, 251 explicit files: runtime including
orca-runtime.test.ts, all ofsrc/main/agent-hooks, daemon transient facts, process foreground readers, OpenCode/OpenCode 2/relay plugin, shared command-marker and side-effect tests, and the renderer pty-connection, foreground-tracker and completion tests. All pass; one renderer cleanup test timed out once under load and passes on its own (it imports none of the changed code).pnpm tc:node, oxlint, oxfmt and the changed-code quality check pass.A renderer test that pinned "a Done arriving after the command finished survives" was deleted rather than kept, because it contradicts the rule above. That renderer behaviour itself is unchanged here.
Review
Agent skill upstream boundary
docs/reference/agent-skill-sharing-upstream-boundary.mdand copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.Notes
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)