Give OpenCode an attachable Stage 3 pr-reviewer recipe so its agent card exposes a Shell session - #6241
Merged
Conversation
…gent card exposes a Shell session (#6238) A Stage 3 ("PR Code Review & Actions") run on an OpenCode-backed TUI provider was always forced headless: the OPENCODE vendor row declared no sandboxed-actions recipe, so supportsTuiPublicReviewActionsProvider answered false and the agent card showed "No shell". The headless argv is a one-shot `opencode run …`, which cannot become an interactive session by dropping flags the way Claude's recipe does. Add a sandboxed-actions recipe to the OPENCODE row. Headless runs keep today's `run`-prefixed argv byte-for-byte; the attachable (`tui: true`) shape is the bare binary — OpenCode's real TUI entry point — with `--agent build` pinned and `-m` namespaced by the same prefixOpencodeModel call, and the spawner pastes the prompt as it does for every other TUI. Verified under node-pty against a local Ollama backend: the pasted prompt renders, Enter submits it, and the build agent completes a tool call. The recipe matches any spawnable OpenCode binary (MTPLX and gateway backends included), unlike the Ollama-only no-tool gate. The recipe adds no sandbox — the headless run already had full tool access with the disposable worktree as isolation — so it carries `enforces: false` and the schedule UI keeps reporting the choice as worktree-only rather than OS-sandboxed.
…ch argv builders a recipe supplies A recipe now carries `spawnArgs` (headless) and/or `tuiSpawnArgs` (attachable) instead of `tui: true` / `enforces: false` flags: attachable means a row supplies `tuiSpawnArgs`, enforced means it supplies `spawnArgs`. OpenCode's actions row supplies only the attachable builder, so it falls through to the ordinary headless argv, stays worktree-only in the schedule UI, and is left out of the 'install one of these' suggestion — all structurally, with no per-row opt-outs. Also homes OPENCODE_BUILD_AGENT beside OPENCODE_PUBLIC_REVIEW_AGENT, composes isLocalOpencodeProvider from the shared binary matcher, and factors the OpenCode model-append/envelope helpers so the two argv shapes share them.
…applies (local-only endpoints)
Owner
Author
|
Required code review was not completed before publication. This PR is intentionally left open and will not be merged until the required review completes. |
Owner
Author
|
Blocked reviewer: codex (usage limit exhausted; resets 2026-09-07). The claude local review returned APPROVE with one non-blocking doc note, already addressed in the last commit. To finish: rerun the codex review against this branch, then merge. |
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.
Summary
sandboxed-actions) runs on an OpenCode-backed TUI provider now get a PTY and an "Open Shell" link instead of being forced headless with "No shell". TheOPENCODEvendor row gains asandboxed-actionsrecipe whose attachable argv is the bareopencodebinary (its real interactive entry point) with--agent buildpinned and-mnamespaced by the same helper the headless argv uses; the spawner pastes the prompt as it does for every other TUI. Matches any spawnable OpenCode binary (MTPLX and gateway backends included), unlike the Ollama-only no-tool gate.opencode run …argv with provider args forwarded.spawnArgs(headless) and/ortuiSpawnArgs(attachable) instead oftui: true/ anenforcesflag. Attachable = suppliestuiSpawnArgs; enforced (OS-sandboxed, as the schedule UI reports it) = suppliesspawnArgs. OpenCode's actions row supplies only the attachable builder, so it stays worktree-only in the UI and out of the "install one of these" suggestion structurally. Claude's row is unchanged in behavior.OPENCODE_BUILD_AGENTjoinsOPENCODE_PUBLIC_REVIEW_AGENTinproviderModels.js;opencodeConfig.jsuses it instead of a bare literal.AgentCard.jsx'snoShellReasonalready keys offexecutionMode/tuiSessionId.Verified empirically under node-pty in a scratch worktree with the exact env
buildCliChildEnvcomposes for the actions profile against a local Ollama backend: the bare invocation boots, the bracketed-paste prompt renders ([Pasted ~1 lines]chip), Enter submits it, and the build agent completed awritetool call and answered.Note for reviewers: for a gateway-backed OpenCode wrapper
OPENCODE_CONFIG_CONTENTis stripped by the actions env allowlist and the child runs on the operator's own~/.config/opencode— pre-existing headless behavior, now called out in the recipe's doc comment rather than changed here.Test plan
server/lib/providerVendors.publicReview.test.js—opencode-tuiasserted attachable (every backend) with the bare-binary argv, headless argv pinned unchanged, no-tool posture still Ollama-only, enforced-posture list still excludes OpenCode's actions stageserver/services/agentLifecycle.postureGate.test.js— a Stage 3 task on an OpenCode TUI provider reachesspawnTuiAgentwith the actions profileCloses #6238