Skip to content

Give OpenCode an attachable Stage 3 pr-reviewer recipe so its agent card exposes a Shell session - #6241

Merged
atomantic merged 3 commits into
mainfrom
claim/issue-6238
Sep 4, 2026
Merged

Give OpenCode an attachable Stage 3 pr-reviewer recipe so its agent card exposes a Shell session#6241
atomantic merged 3 commits into
mainfrom
claim/issue-6238

Conversation

@atomantic

Copy link
Copy Markdown
Owner

Summary

  • Stage 3 (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". The OPENCODE vendor row gains a sandboxed-actions recipe whose attachable argv is the bare opencode binary (its real interactive entry point) with --agent build pinned and -m namespaced 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.
  • Headless OpenCode actions runs are unchanged — still the ordinary opencode run … argv with provider args forwarded.
  • Recipes now declare spawnArgs (headless) and/or tuiSpawnArgs (attachable) instead of tui: true / an enforces flag. Attachable = supplies tuiSpawnArgs; enforced (OS-sandboxed, as the schedule UI reports it) = supplies spawnArgs. 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_AGENT joins OPENCODE_PUBLIC_REVIEW_AGENT in providerModels.js; opencodeConfig.js uses it instead of a bare literal.
  • No client change: AgentCard.jsx's noShellReason already keys off executionMode/tuiSessionId.

Verified empirically under node-pty in a scratch worktree with the exact env buildCliChildEnv composes 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 a write tool call and answered.

Note for reviewers: for a gateway-backed OpenCode wrapper OPENCODE_CONFIG_CONTENT is 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.jsopencode-tui asserted 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 stage
  • server/services/agentLifecycle.postureGate.test.js — a Stage 3 task on an OpenCode TUI provider reaches spawnTuiAgent with the actions profile
  • Affected server suites green: providerVendors*, providerModels, opencodeConfig, agentTuiSpawning, tuiHandshake, cliChildEnv, publicReviewProviderSelection, routes/providers, agentErrorAnalysis, agentPromptBuilder, importScoping, lib/index
  • Client: PipelineStageConfig, AIProviders, utils/providers green

Closes #6238

…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.
@atomantic

Copy link
Copy Markdown
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.

@atomantic

Copy link
Copy Markdown
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.

@atomantic
atomantic merged commit a18c872 into main Sep 4, 2026
7 checks passed
@atomantic
atomantic deleted the claim/issue-6238 branch September 4, 2026 17:47
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.

OpenCode Stage 3 pr-reviewer never gets an attachable shell (no actions-posture TUI recipe)

1 participant