Skip to content

fix(opencode): keep detached services from invalidating the foreground terminal - #25378

Merged
nwparker merged 4 commits into
mainfrom
orca/opencode-detached-service-foreground
Oct 5, 2026
Merged

nwparker merged 4 commits into
mainfrom
orca/opencode-detached-service-foreground

Conversation

@nwparker

@nwparker nwparker commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​65 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​65
Prod 3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​16 $\color{#cf222e}{\Huge{\mathbf{−}}}$​9 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​7

ELI5

OpenCode can start a background service while its terminal remains active. On macOS, Orca mistook the service's missing terminal for a different terminal and refused to identify the foreground OpenCode process.

What Changed

Reuse Orca's existing check for a real controlling terminal in the host foreground-process resolver. Detached services no longer invalidate the foreground TUI. Unknown foreground terminals, genuinely different terminals, multiplexers, and missing process identities still return unverifiable.

Why

macOS reports a detached service's terminal as ??. Sharing the existing predicate keeps process-group cleanup and foreground evidence consistent without guessing from a process name or introducing another process parser. The wire format and freshness checks stay unchanged.

Linked Issue

Related to #22829 and the inherited-hook investigation in #13385. This PR does not close either broader report.

Visual Proof

N/A — this changes the host process check and adds no renderer changes. Installed OpenCode process captures and their results are described below.

Testing

  • Reproduced the before behavior with installed OpenCode 2.0.16 in an isolated background Orca app on macOS: the TUI and shell shared ttys096, while the detached service reported ??; two host observations refused with tty_boundary before input.
  • Added regression and refusal-boundary tests. The unchanged resolver fails 13 of 22 focused cases; the fix passes all 86 tests across five existing process/remote-evidence test files.
  • Node and CLI typechecks; changed-code quality; formatting and diff checks.
  • Replayed both actual process captures through the unchanged parser and fixed resolver: only the TUI becomes the fenced foreground process.
  • Verified the rebuilt app with installed OpenCode 2.0.16: nine fresh host observations identify the real foreground process as live while the detached service still reports ??. The app quit normally, all 46 recorded process IDs were absent, and four TCP listeners plus both private Unix sockets were checked closed.

The live run stopped before prompts: an additional test guard compared differently spaced process timestamps. That guard failure is retained; the run does not demonstrate model completion or inherited-hook behavior. The host foreground check itself passed all nine observations.

Linux sentinel cases and mixed remote-evidence admission are covered by tests. No Windows or SSH runtime claim. All four changed paths were independently reviewed, and the normal join preserves every other path from Main.

Review

Independent source and captured-evidence review completed. The genuine rebuilt-app host observations and cleanup were checked separately; the additional test guard failure is disclosed above.

Agent skill upstream boundary

  • Not applicable; no upstream skill-installer content is copied or translated.

Checklist

  • Small and focused; before/after behavior, mechanism, and approach explained.
  • Self-reviewed and independently reviewed.
  • Cross-platform, SSH/remote, and mixed-version behavior considered.
  • Relevant local tests and typechecks pass; CI passes on the exact published head (15 successful checks; 17 skipped).

@nwparker
nwparker marked this pull request as ready for review October 5, 2026 04:33
@nwparker
nwparker merged commit 7863871 into main Oct 5, 2026
34 of 35 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