Repository navigation
feat(opencode): bare launch works on OpenCode 2 - #801
Conversation
OpenCode 2 refused bare launches because it has no --pure mode and runs one shared server per instance. A bare 2.x session now runs on a private OpenCode 2 server started for the instance's bare home, with an isolated config dir and a 2.x config that sets system "." for build and plan, empty instructions, plugins and MCP, denies skills and disables titles. Session rules start with a deny-all so OpenCode lists only shell, read, write, edit, glob, grep (and the named T3 tools); this also hides skill, which agent defaults kept listed. Before the first prompt Chromeria reads agent, plugin, MCP and skill inventories over the v2 API, fails the open on unexpected context, and reports them in the receipt. Refs #320 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Refs #320 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review found the adapter hooks untested: the driver test stops at server start and the bare.ts tests call helpers directly, so a rebase dropping a hook in the upstream v2 adapter would pass. A replay test now opens a bare session, checks the inventory reads, the session rules sent at create, that no T3 Code instruction entry is written before the prompt, and the receipt. Inspection reads run in order so the replay is deterministic. Refs #320 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Independent review, round 1 (head
No blocking defects found after tracing routing, server lifetime, permission updates through create/resume/fork, MCP and instruction handling, receipts, and registry/docs changes. Source inspection only. PASS (no blocking findings). Author response: fixed in |
|
Independent review, round 2 (head
Reviewed the whole exact-head diff and round 2 changes. The new oracle independently checks permissions, instruction omission, and receipt contents; fixture defaults preserve existing behavior, registry edits are consistent, and sequential inspection remains fail-closed. Static review only. PASS (no blocking findings). Author note: the MCP gate stays covered by the live named-MCP launch in the PR body (only |
|
Agent cost: |
Thread transfer impact✅ Thread transfer remains within every enforced ceiling.
Other scenariosAll 64 scenario measurements match All 64 scenario measurements
Baseline: Scenario and decoded snapshot size10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.
Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed. |
What: Bare launch now works on OpenCode 2.x: a bare thread runs on a private OpenCode 2 server with system prompt
.and only shell/file tools.Why: Chromeria refused bare on 2.x ("no demonstrated bare stripping interface"), and the user's machines are moving to OpenCode 2.
So what: Needs independent review and the user's merge decision; nothing is deployed.
Closes #320
Elon record
Requirements and who asked: The user (2026-11-18) needs bare launch on OpenCode 2.x before moving machines to it; the bare contract (stripped prompt, positive tools, truthful receipt) comes from #289.
Deleted: Bare on the shared 2.x server or background service, external
serverUrlbare, stripping OpenCode's<env>/date block (no control exists), a tool-listing model call at open (costs a request), agent permissions in the bare config (session rules decide visibility).Bottleneck: OpenCode 2 has no
--pure;skillandopencode_worktree_removestayed listed under"*": false, so the decisive question was OpenCode 2's tool-visibility rule, read from its embedded source and measured on a scratch 2.3.2 server.Checked myself: Captured the real outbound model request of a live bare launch on my own dev server (below), the failing-before tests on the base code,
vp run check:changed,bash scripts/fork-check.sh --upstream upstream.How it works
driver.ts: bare 2.x opens go to a second v2 adapter backed by a privateopencode serve, started lazily at the first bare open (success cached) with the instance's bare home (<state>/bare/<instance>/opencode2/xdg-config). Normal 2.x threads keep the shared server. An externalserverUrlrefuses bare, as on 1.x.v2/bare.ts(fork-owned):agents.build/plan.system ".", emptyinstructions,plugins,mcp,policies: skill.use deny, title disabled. Isolation reuses the 1.x recipe (shadowXDG_CONFIG_HOME,OPENCODE_DISABLE_PROJECT_CONFIG,OPENCODE_DISABLE_CLAUDE_CODE,OPENCODE_CONFIG_CONTENT).*deny, and it appends agent defaults (skill browser deny) after config. So bare session rules start with* deny, then allow read/glob/grep (keeping OpenCode's.envask defaults), then the normal mode rules filtered toshell, read, edit, glob, grep, external_directoryand this thread's T3 MCP pattern when the launch namest3-code.agent.get(build/plan system must be.),plugin.list(only built-ins),mcp.list(only T3 Code thread servers),skill.list(empty). Anything else fails the open; results go into the receipt.v2/adapter.tshooks: bare sessions skip T3 Code's instruction entry and add the T3 MCP server only when named, as on 1.x, and exposegetBareReceipt.<env>block, OpenCode's worktreesession_movehint, andopencode_worktree_remove, which OpenCode gates on theeditpermission (it cannot be hidden without hiding edit/write).Proof
Failing-before tests (
driver.test.ts, lowest layer that fails on main): on the base code both new cases fail withBareLaunchError: OpenCode 2.x has no demonstrated bare stripping interface(no server start); on this branch a bare open reaches a server whose env carries the bare config and isolated config dir, normal opens keep the shared server, and an externalserverUrlrefuses with its own reason.v2/bare.test.tschecks the visible tool set under OpenCode's rule for full-access, supervised and plan modes, named and unnamed T3 MCP, and that inspection rejects a prompt, a package plugin and a foreign MCP server.Live bare launch (dev server in this worktree, scratch HOME/XDG, OpenCode 2.3.2 installed in a scratch prefix, free local Gemma via oMLX through a logging proxy; zero paid spend). The scratch project's
AGENTS.mdsays "Always answer in French".t3_thread_launchwithbare: {}completed with the replyhi. Outbound request to the model:With
bare: { additions: [{ type: "mcp", server: "t3-code", tool: "t3_thread_read" }] }the tools add exactlyt3-code-<thread>_t3_thread_read. The bare server ran as its own process withXDG_CONFIG_HOME=<state>/bare/opencode/opencode2/xdg-config. Stored receipt evidence:system_text observed_retained (build ".", plan "."),plugins/mcp/skills observed_clean, toolsunobserved(session-rule identities). For comparison, normal full-access session rules on the same bare config produced a 9953-char system prompt and 12 tools includingskill,subagent,webfetch,execute.Not via the v2 context API: on 2.3.2,
GET /api/session/:id/contextreturns only session messages (model switch, user, assistant, idle); it does not show the system prompt or tool list, so the prompt and tools above come from the captured outbound request instead. The provider for Gemma was defined in the bare home'sxdg-config/opencode/opencode.jsonas a test fixture, because bare isolation drops user provider config (same as 1.x).Checks:
vp run check:changedall pass (format, lint, knip, typecheck of 42 packages, tests);bash scripts/fork-check.sh --upstream upstreamOK; OpenCode 2 adapter, bare adapter and 1.x adapter suites pass (363 tests); focused suites rerun on the rebased head (251 tests).Upstream first:
pingdotgg/t3codehas no bare launch (fork feature #289/#335); code search forbareSupportand PR search for OpenCode prompt stripping found nothing to port.Evals: no fork-owned model-facing text (instructions, MCP tool descriptions or schemas) changed, so no eval cases selected.
browser doc: no user-visible change
Work by Claude Opus 5.5 in Claude Code (T3 Code).
🤖 Generated with Claude Code