Skip to content

feat(runner): add OpenCode as a read-only external provider (#68) - #202

Merged
mergify[bot] merged 3 commits into
mainfrom
feat/68-opencode-runner
Oct 16, 2026
Merged

mergify[bot] merged 3 commits into
mainfrom
feat/68-opencode-runner

Conversation

@ericlitman

@ericlitman ericlitman commented Oct 16, 2026 •

Copy link
Copy Markdown
Owner

Summary

Adds OpenCode as a read-only external provider, restored from 08556cd (reviewed in #196). Under #203 (merged as #205), a read-only lane means the read-only settings pstack passes to OpenCode; the runner adds no refusal or guard because of the operator's own host, account, repository or organization configuration, and the catalog notes say what that configuration can do. Closes #68.

pstack-runner --provider opencode --mode read-only
  sidecar: <receipt>.provider/opencode.json = LOCKDOWN ("*": deny; read, glob, grep, list, todowrite allow)
  env: XDG_CONFIG_HOME, OPENCODE_TEST_HOME, OPENCODE_CONFIG → sidecar; project config, Claude Code skills,
       external skills and autoupdate off; other OPENCODE_* and provider keys dropped
  preflight: opencode models opencode
  opencode run --pure --agent build --format json --title pstack-lane -m opencode/deepseek-v4.1-flash-free --variant max
  • Family deepseek-v4.1-flash-free (OpenCode Zen, no key), efforts low, high, max, default max. Stored logins authenticate other OpenCode models as the user has them. Proof is the pinned argv.
  • No pre-launch guard and no .opencode/ refusal. Round 1's debug config --pure guard, its tests and its nine recorded fixtures are removed (Eric approved the removal, 2026-10-16).
  • The catalog notes state what still loads and what it was measured to do on OpenCode 1.19.1: a managed config and the macOS managed-preferences plist; remote config from a stored well-known login or console organization; a repository's .opencode/plugins/*.js, whose top-level code runs even with --pure and the project-config switch; stored logins.
  • The verifier's route and descriptor patterns accept / in a model ID, and the catalog recipe gains one OpenCode lane, so this PR is verifier-changing.

Evidence

  • Direct live checks, OpenCode 1.19.1, through this branch's launcher (pstack-runner --parent claude --provider opencode --model opencode/deepseek-v4.1-flash-free --effort max --mode read-only):
    • Git fixture: exit 0, complete, preflight passed, output equal to the fixture's marker.
    • Git fixture holding .opencode/opencode.json: exit 0, complete, no refusal, output equal to the marker.
    • A repository .opencode/plugins/canary.js under the lane's environment and --pure: its top-level code ran (marker written) and its plugin function did not, which is what the notes say.
  • Unit: opencode.test.ts (launch, environment, preflight, parser, adapterSuite); run.test.ts runs the preflight and the model with one config, environment and cwd, and runs a lane in a repository holding .opencode/ and an opencode.json that the environment turns off.
  • Exact-head live gate: passed on 095b127 from its candidate checkout with --self-test, 12 planned sessions: evidence comment. The Claude and Codex parents each dispatched opencode:opencode/deepseek-v4.1-flash-free@max read-only through the installed launcher; both lane receipts read complete with preflight passed, and both parents resolved the catalog sheet's OpenCode descriptor as an external route.

Merge Danger

Door: two-way. A new provider that no default role uses; reverting removes it.

Blast Radius: opt-in. Only a model sheet that names opencode:... reaches it. On a host or account whose OpenCode configuration adds tools, servers or routing, a lane gets them, as the notes say.

Live gate

Run from a checkout of this PR's head with --self-test, because the PR changes the verifier (AGENTS.md); the publisher revision equals the candidate SHA. 12 planned sessions, within the verifier's limit.

Feature Why
claude:runner, codex:runner with --runner-route opencode:opencode/deepseek-v4.1-flash-free@max The changed behavior is an OpenCode lane dispatched by each parent: preflight, launch, parse and receipt.
claude:catalog, codex:catalog The generated catalog gains OpenCode rows, and the recipe's sheet carries an OpenCode descriptor with a /; each parent must resolve it as an external route.
project-skill in both harnesses (automatic) The verifier's route patterns changed.

No setup: setup's behavior does not change.

Acceptance criteria

Criterion (#68) Verification
Current scope: "a read-only lane on opencode/deepseek-v4.1-flash-free ... with pstack's own lane settings ..., stored logins as the user has them, and no pre-launch guard or .opencode/ refusal" Adapter and opencode.test.ts; the two direct live lanes; the exact-head live gate.
Current scope: "The catalog notes say what still loads: managed and macOS managed-preferences configuration, remote configuration from a well-known login or console organization, a home or repository .opencode/ plugin, and anything else OpenCode 1.19.1 reads, and that these can add tools, servers or routing to a lane." references/model-catalog.md OpenCode notes, from the batch-158 measurements; the repository-plugin note re-measured on this branch.
Original: "detect the opencode CLI, provide the necessary configuration and invocation logic, handle missing installations with a clear error" executable: "opencode" (a missing binary is unavailable-cli), run-owned config and argv; adapterSuite and run.test.ts.
Original: "preserve existing integrations" bun run test 457 pass, including every existing provider's suite.
Original: "include basic documentation and tests" OpenCode rows and notes in references/model-catalog.md; opencode.test.ts, run.test.ts, registry.test.ts.

Unfret rebuttal

Unfret rebuttal for head 095b127479a06fcf2cee23cae149189e563403e9, finding v1:b9a9d1aa84ec2a84a8f4e6d855c7b8f418f3332e1ec8f9d8d8f58c0a15797fc0
Claim: the lockdown has no lsp key, so OpenCode's built-in language servers stay enabled and a read starts rust-analyzer, eslint or tsserver on repository code.
Disproof: OpenCode 1.19.1 enables no built-in LSP server unless the merged config sets lsp. packages/opencode/src/lsp/lsp.ts:151 is `if (!cfg.lsp) { yield* Effect.logInfo("all LSPs are disabled") }` and only the else branch registers servers. The lockdown (opencode.ts:7-13) and the lane's merged config have no lsp key. Measured on 1.19.1 with the lane environment: capture c04 logs "all LSPs are disabled"; read lanes in a TypeScript fixture with a lockfile and node_modules/typescript (c16) and in a plain fixture (c11) started no language-server process. LSP starts only when a configuration layer sets lsp (managed LSP in c12, lsp:true in c13b), which is operator configuration that REVIEW.md's #203 sentence puts out of scope.

Review round 1 (head e679251)

Gate results

On head 095b127 (58ad12f plus a merge of main for #205's REVIEW.md sentences), from the worktree root:

Check Exit Summary
bun run test 0 457 pass, 0 fail
bun run typecheck 0
bun run static 0 verifier suite 166 pass, 0 fail, plus tsc --strict
claude plugin validate plugins/pstack 0 Validation passed

Not verified

  • The macOS managed-preferences plist and a console organization's /api/config: no managed Mac and no console account here; the notes say these are from OpenCode's source.
  • OpenCode versions other than 1.19.1.

🤖 Generated with Claude Code

Restores the OpenCode adapter from 08556cd. Before the authentication
preflight, the runner now reads OpenCode's merged configuration with
`opencode debug config --pure` under the lane's environment and refuses
the lane unless it equals the run-owned read-only lockdown, so a managed,
remote, home or project layer cannot add MCP servers, LSP commands,
plugins, provider routing or agent changes. The verifier's route patterns
accept OpenCode's `/` model IDs.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@mergify

mergify Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Merge Protections

🟢 All 2 merge protections satisfied — ready to merge.

Show 2 satisfied protections

🟢 Queue ready pull requests

Automatically queue non-draft pull requests targeting main after verify, Unfret, and live-gate pass on the head and every review thread is resolved.

  • #review-threads-unresolved = 0
  • -draft
  • check-success=Unfret
  • check-success=live-gate
  • check-success=verify

🟢 🚦 Auto-queue

When all merge protections are satisfied and these conditions match, this pull request will be queued automatically.

  • -files~=^\.github/
  • base = main

@ericlitman

Copy link
Copy Markdown
Owner Author

Live evidence: Open Pstack

  • Candidate SHA: e679251bff11c3f125d8250f1c4597345b92de3f
  • Base SHA: 4e6d9714f5b1e2afd83619c5a946645eaf26340b
  • Result: PASSED — named features verified
  • Self-test: completed in both harnesses
  • Planned sessions: 12 (limit 12)
  • Publisher revision: e679251bff11c3f125d8250f1c4597345b92de3f
  • Evidence-set SHA-256: 2a11212f13ec833e0e8d44195fb3015bee43a0337ec9726b815fa487f74cad1a
  • Installation (claude): CLI 2.1.301 (Claude Code), plugin 1.11.0, candidate e679251bff11c3f125d8250f1c4597345b92de3f, tree 367389e1e268988da67454204ca428f73db36e76855eb23f754e483d71693e7c.
  • Installation (codex): CLI codex-cli 0.163.0, plugin 1.11.0, candidate e679251bff11c3f125d8250f1c4597345b92de3f, tree 367389e1e268988da67454204ca428f73db36e76855eb23f754e483d71693e7c.
  • Observation (claude / runner): surface claude -p stream-json with the candidate plugin-dir; action recipe runner: route-1, full-access-writer, bounded-writer; result passed 16 assertions; ids retained privately; 16 assertions machine-checked; transcript SHA-256 e4b2d478c7e1558b698ed7d2c1c704b29bda051fc40c49023e9d303947618dce; artifact-set SHA-256 dd308371402c99e9d4b402b04e7fc9f030c7d82f4b5ec8b0bde748f4aca249a3.
  • Observation (claude / catalog): surface claude -p stream-json with the candidate plugin-dir; action recipe catalog: consume-sheet, consume-sheet-bounded, native-agents; result passed 27 assertions; ids retained privately; 27 assertions machine-checked; transcript SHA-256 8eb9866587459742373fc1913424667295a20f9e298b749e620299f441914613; artifact-set SHA-256 4f56176fbb58b6ead18d843a31a8738262d760c227f65ebb724e55b47ff4167a.
  • Observation (claude / project-skill): surface claude -p stream-json with the candidate plugin-dir; action recipe project-skill: doctor; result passed: doctor:exit-0 doctor:skill-loaded doctor:doctor-ran doctor:doctor-canonical-pass; 4 assertions machine-checked; transcript SHA-256 62af0b508a9f77cbe0957fbd4da5970594d5ca0a83cdb627836000d1db765ced; artifact-set SHA-256 d13e128030bfbce119a66a7b9b4413fe5e94ab6a027692fa0ce3485ab38479ce.
  • Observation (codex / runner): surface codex exec --json with the run-owned candidate installation; action recipe runner: route-1, linked-worktree-writer; result passed 10 assertions; ids retained privately; 10 assertions machine-checked; transcript SHA-256 3da287102ed72f5cd9660dd5a24b9731995ed6e72c9b81d3d9c90bdd686bcab8; artifact-set SHA-256 bce1e6c810ba4416bfd582d5ca0c3c0d9d622f50499b027fc0d9aaecc62cb337.
  • Observation (codex / catalog): surface codex exec --json with the run-owned candidate installation; action recipe catalog: consume-sheet, consume-sheet-bounded; result passed 24 assertions; ids retained privately; 24 assertions machine-checked; transcript SHA-256 14269dede8012319c24fcad573ac9451b6ba08dbd176091dc0eea91ccee0a015; artifact-set SHA-256 0816ca68c2cbca6cbf42e67bc54e95b346a8086722c8b61b697d4d2ff2743f34.
  • Observation (codex / project-skill): surface codex exec --json with the run-owned candidate installation; action recipe project-skill: doctor; result passed: doctor:exit-0 doctor:skill-loaded doctor:doctor-ran doctor:doctor-canonical-pass; 4 assertions machine-checked; transcript SHA-256 e124f5752ecf67c96f8a1de0ad5cb6531249d5a59c2ba3490e9d32c0b2ec0d6c; artifact-set SHA-256 557cced63d70525fe1b1da3a418565554c28051f27fb98f7212f320c279b95c2.
  • Policy: every new head requires a fresh run; this verifier does not change PR state, queue, or merge.

@greptile-apps

greptile-apps Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

RetriggerView in Greptile

[Medium impact] No new code defect was established that requires a change before merging.

Summary

Adds OpenCode as an opt-in external provider for read-only lanes.

  • Callers can run DeepSeek through an OpenCode read-only lane.
  • Verifier routes can now carry OpenCode’s provider-qualified model ID.

ericlitman accepted removing the guard and allowing managed, remote, and repository configuration to affect lanes. ericlitman also pre-accepted the missing-step_start concern and acknowledged the stale verifier role count as advisory.

The merge bases differ, so this review used the full PR diff for new-issue discovery. Previous thread bodies and states were not supplied and could not be retrieved; no numbered previous-finding determinations are recorded. No runtime tests were executed.

Reviews (2) · Last reviewed commit: "Merge origin/main for #205's REVIEW.md r..." · Reviewed by Greptile

@unfret-eal

unfret-eal Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

✅ Accepted risk

Accepted by ericlitman: GH-68 (authority 48fa77b)

🟡 Medium · Streams without a step start are marked complete

Advisories (1)
  • 🔵 Low · Verifier catalog feature guide left stale by the added OpenCode role · .claude/skills/verify-open-pstack/features/recipes.ts:629
    Line 629 adds 'interrogate reviewers' (an OpenCode lane whose model contains '/', on an external route) to CATALOG_LANES. Both consume-sheet cases now require nine roles. The verifier's catalog.md feature description is not in this diff and still enumerates the earlier role set; the prior round confirmed it stale at this same head. An operator reading the feature guide to choose live-gate features gets a wrong account of what the catalog cases cover. The generated prompts and exact report assertions still enforce the new role, so the impact is limited to documentation. Also reported for this defect: - Catalog guide omits the added OpenCode role (.claude/skills/verify-open-pstack/features/recipes.ts:629): Adding interrogate reviewers leaves features/catalog.md's Headless description stale: it still enumerates seven roles before the additional writer role and omits the OpenCode descriptor and external route. Both consume-sheet cases now require eight roles before the writer, nine total. Operators following the required feature guide receive an incorrect coverage description; the executable assertions still enforce the new role, so the impact is documentation-only. - Catalog guide omits the newly required OpenCode role (.claude/skills/verify-open-pstack/features/recipes.ts:629): Adding interrogate reviewers makes both consume-sheet cases require eight roles before the additional writer role, but features/catalog.md:21 still describes seven and omits the OpenCode descriptor and its external route. Operators following the required feature guide therefore receive an inaccurate description of routes.json. The executable assertions cover the new role correctly, so the impact is limited to stale verification documentation. - Catalog feature documentation omits the added role (.claude/skills/verify-open-pstack/features/recipes.ts:629): Adding the OpenCode `interrogate reviewers` lane makes the verifier's unchanged catalog feature description and seven-role enumeration stale: the recipe now checks eight roles before the writer role. The executable assertions still enforce the lane, but the operator-facing description understates the live-gate coverage.
    Not blocking because: The guide understates coverage, but both cases generate their prompts and exact report assertions from CATALOG_LANES. The documentation omission neither removes executable coverage nor permits a false passing gate.
Details

Run: GET /unfret/run/panel:095b127479a06fcf2cee23cae149189e563403e9:uwHdi23hNNN:wOTG84GJJOs.

@unfret review · @unfret status · @unfret help

@unfret-eal unfret-eal Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛑 3 blocking findings
🔴 Critical · Guard copies the full resolved OpenCode config, including credentials, into the receipt
🔴 Critical · Remote configuration can bypass the read-only guard
🟡 Medium · Streams without a step start are marked complete
Check

ericlitman and others added 2 commits October 16, 2026 14:19
…usal (#68)

Read-only means the read-only settings pstack passes to OpenCode (#203).
OpenCode lanes no longer refuse a repository holding .opencode/ or a host
whose merged configuration differs from the lockdown; the guard's tests
and recorded fixtures go with it (approved by Eric, 2026-10-16). The
catalog notes say what managed, remote, stored-login and repository
configuration still load and what each was measured to do.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@ericlitman
ericlitman marked this pull request as ready for review October 16, 2026 18:22
@ericlitman

Copy link
Copy Markdown
Owner Author

Live evidence: Open Pstack

  • Candidate SHA: 095b127479a06fcf2cee23cae149189e563403e9
  • Base SHA: 2094580d476105d2341f9d50355dd5d3eef9af04
  • Result: PASSED — named features verified
  • Self-test: completed in both harnesses
  • Planned sessions: 12 (limit 12)
  • Publisher revision: 095b127479a06fcf2cee23cae149189e563403e9
  • Evidence-set SHA-256: c6f89ced0cbb7d44e83fa6323608dca5c7f63586608da57fa2e07e0d1cc323de
  • Installation (claude): CLI 2.1.301 (Claude Code), plugin 1.11.0, candidate 095b127479a06fcf2cee23cae149189e563403e9, tree 812dc12d6b6196776f1da2666c5d8b1ff935355811cb3e3f97e661b810cfd1d5.
  • Installation (codex): CLI codex-cli 0.163.0, plugin 1.11.0, candidate 095b127479a06fcf2cee23cae149189e563403e9, tree 812dc12d6b6196776f1da2666c5d8b1ff935355811cb3e3f97e661b810cfd1d5.
  • Observation (claude / runner): surface claude -p stream-json with the candidate plugin-dir; action recipe runner: route-1, full-access-writer, bounded-writer; result passed 16 assertions; ids retained privately; 16 assertions machine-checked; transcript SHA-256 d432264c965a9be1542e9f46defe7d4c5839481009ce4c053896f1840219a90d; artifact-set SHA-256 b307f4e8d86c73a72615d6fd2faaada1ed932df5ce6b35553e127d4ac1b7d261.
  • Observation (claude / catalog): surface claude -p stream-json with the candidate plugin-dir; action recipe catalog: consume-sheet, consume-sheet-bounded, native-agents; result passed 27 assertions; ids retained privately; 27 assertions machine-checked; transcript SHA-256 00260c8efb98b4476f9fe54b2cd89f495ba2d88c2f8b31314b7d1167970b39fd; artifact-set SHA-256 952e5845916eac3019f00cc82c9d3d35c6a36700e20d26c2086ca0d4101a178e.
  • Observation (claude / project-skill): surface claude -p stream-json with the candidate plugin-dir; action recipe project-skill: doctor; result passed: doctor:exit-0 doctor:skill-loaded doctor:doctor-ran doctor:doctor-canonical-pass; 4 assertions machine-checked; transcript SHA-256 3743a9c565672166b47a109f989421ba3ae9cefd257ee8928d8970a317d2e792; artifact-set SHA-256 da64260d3ac1e5dfd945c9d5bab1d5aaa015a98c4a0bba291f59c697e46c9e98.
  • Observation (codex / runner): surface codex exec --json with the run-owned candidate installation; action recipe runner: route-1, linked-worktree-writer; result passed 10 assertions; ids retained privately; 10 assertions machine-checked; transcript SHA-256 8ebd91166561878ea6d896c6eb46fb541fe4ef67fb98a2943f57d5766254926e; artifact-set SHA-256 2e6a3946164f4bd2e3d6c602e76a74076891c4f3f42d44adfd4422b69c2d1254.
  • Observation (codex / catalog): surface codex exec --json with the run-owned candidate installation; action recipe catalog: consume-sheet, consume-sheet-bounded; result passed 24 assertions; ids retained privately; 24 assertions machine-checked; transcript SHA-256 47a3ea07e90988f1fe4cbca2fea3ac0aa6647b2d93e1e78a0633564e90566add; artifact-set SHA-256 d8f7bddd3d2fd47dea4c8eee512f54ce69082b86cb8a37f4fdfa5c53b69e94d7.
  • Observation (codex / project-skill): surface codex exec --json with the run-owned candidate installation; action recipe project-skill: doctor; result passed: doctor:exit-0 doctor:skill-loaded doctor:doctor-ran doctor:doctor-canonical-pass; 4 assertions machine-checked; transcript SHA-256 96f5e1ed8ecc037581c04689da7a3296b40576240865979ce20bc9a2e077ebb2; artifact-set SHA-256 542f20d2ef0c2f19f41ee8ebac97f92c6ea7a513853560833b90ec5285f59369.
  • Policy: every new head requires a fresh run; this verifier does not change PR state, queue, or merge.

@unfret-eal unfret-eal Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛑 2 blocking findings
🔴 Critical · Lockdown leaves built-in LSP servers on, so reads run repository code
🟡 Medium · Streams without a step start are marked complete
Check

@ericlitman

Copy link
Copy Markdown
Owner Author

@unfret review

@unfret-eal unfret-eal Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛑 1 blocking finding
🟡 Medium · Streams without a step start are marked complete
Check

@ericlitman

Copy link
Copy Markdown
Owner Author

Waiver for head 095b127 (OpenCode, #68).

The one blocking finding on this head, v1:51170472aa4e59fffc7bdc87b65830d1164d53d8bd3ffbafb46afca3bd319b1b "Streams without a step start are marked complete", is classed pre-accepted:

  • Trigger: OpenCode emitting a text event and a step_finish with reason stop and no step_start. No OpenCode 1.19.1 capture shows that shape: every captured turn, including cancellations, provider errors and rejected tools, opens each step with step_start (batch-158 OpenCode captures 05 to 16, and the parser fixtures recorded from them). The finding needs a vendor response outside the observed contract.
  • Consequence: a malformed stream would be read as complete with that text. No security, secret, data-loss or gate consequence; the lane is read-only and the parent reads the reply as the lane's answer.

The round's other findings are advisory (the verifier's features/catalog.md text does not mention the new OpenCode lane; the recipe's prompts and exact report comparison still enforce it). The earlier criticals were dismissed (guard removed) or waived by the judge under REVIEW.md's #203 sentence, and the LSP critical was not raised again after its rebuttal in the PR body.

Live gate on this head: success (issue comment 6222108889).

@ericlitman

Copy link
Copy Markdown
Owner Author

@Mergifyio refresh

@mergify

mergify Bot commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

refresh

✅ Pull request refreshed

@mergify

mergify Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • ✅ Entered queue — 2026-10-16 18:59 UTC · Rule: default · triggered by merge protections
  • ✅ Checks skipped · PR is already up-to-date
  • ✅ Merged — 2026-10-16 18:59 UTC · at 1e8e2c69271d7b89ed83257c47b0c095c2c5786d · merge

This pull request spent 10 seconds in the queue, including 1 second running CI.

Required conditions to merge

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Opencode support?

1 participant