Skip to content

feat: opencode as a tier-1 ACP runtime + BUZZ_DEFAULT_RUNTIME engine override - #6526

Open
innerline wants to merge 5 commits into
block:mainfrom
innerline:feat/opencode-runtime
Open

feat: opencode as a tier-1 ACP runtime + BUZZ_DEFAULT_RUNTIME engine override#6526
innerline wants to merge 5 commits into
block:mainfrom
innerline:feat/opencode-runtime

Conversation

@innerline

Copy link
Copy Markdown

Summary

Promotes OpenCode from a PATH-probed tier-2 preset to a compiled-in tier-1 runtime (alongside goose/claude/codex), and adds an operator-level default-engine override. Alternative to #3869 — see Positioning below.

Tier-1 promotion

  • opencode acp native ACP; auto-install via the vendor's cross-platform installer (curl -fsSL https://opencode.ai/install | bash — handles Git Bash/Windows natively, no PowerShell installer exists to route through the Defender-safe two-step form)
  • underlying_cli: Some("opencode") so the Desktop install button actually runs Phase-1 install (goose pattern)
  • ~/.opencode/bin added to common_binary_paths — the installer writes there and only edits shell rc files, so this is the deterministic probe location
  • skill_dir: .opencode/skills joins the nest symlink fan-out (buzz-cli skill discoverable by opencode agents)
  • Two deliberate Nones, verified against opencode source: auth_probe_args (opencode auth list exits 0 even with zero credentials — no faithful exit-code probe exists) and model_env_var (opencode core reads no model env var; model pinning flows through ACP session/new natively, which buzz-acp already applies)
  • Logo moved to the compiled-in RUNTIME_LOGOS inline map (claude pattern); the preset-logo coverage guard passes
  • File-size ratchet satisfied structurally: the runtime const and resolver live in runtime_metadata.rs, tests in discovery/tests/opencode.rs

Default-engine override (opt-in)

  • BUZZ_DEFAULT_RUNTIME=<runtime-id> in the Desktop process environment makes any registered harness the default for newly-created agents (three-tier lookup: builtins → presets → custom registry); unresolvable ids warn and fall back to bundled buzz-agent. Stock installs unchanged
  • buzz-acp default_agent_args: empty args mean acp for opencode (goose pattern) so standalone/remote launches never fall into the TUI
  • README documents both

Remote agents

  • examples/sprig-opencode/ — derived image (FROM ghcr.io/block/buzz-sprig + pinned musl binary) following the spec's lean-default/image-override rule; referenced from remote-agents.md

Verification

  • desktop: 1068 managed_agents tests pass, cargo fmt/clippy clean, biome clean, tsc --noEmit clean, file-size ratchet passes
  • buzz-acp: 803 tests pass
  • full lefthook pre-push suite green (desktop-test, typecheck, tauri-checks, rust-tests)

Positioning vs #3869

#3869 adds an account-connection/auth surface (supports_account_connection) and provider-qualified model discovery through existing ACP paths — valuable machinery this PR does not include. This PR instead covers the operational gaps #3869 leaves: auto-install (underlying_cli + install commands vs none), skill discovery (.opencode/skills vs None), deterministic PATH probing (~/.opencode/bin), the default-engine override, and the remote-agent image example. Happy to rebase whichever direction maintainers prefer — the entries are complementary more than conflicting.

Promote opencode from a PATH-probed tier-2 preset to a compiled-in
KNOWN_ACP_RUNTIMES entry alongside goose/claude/codex, so it gets an
auto-install button, config-file awareness, and skill discovery:

- native ACP (opencode acp); installer writes ~/.opencode/bin which is
  now probed in common_binary_paths
- skill_dir .opencode/skills joins the nest symlink fan-out
- auth_probe_args and model_env_var stay None deliberately: opencode
  auth list exits 0 with zero credentials (no faithful probe) and
  opencode core reads no model env var (config-side pinning)
- catalog copy, RuntimeIcon comment, and e2e fixture move opencode
  from the preset group to the builtin group with can_auto_install

Signed-off-by: innerline <innerline@me.com>
Track A of making opencode a first-class Buzz backend engine:

- buzz-acp default_agent_args: opencode defaults to 'acp' like goose, so
  env-launched/remote opencode harnesses never fall into the TUI
- desktop default_agent_command reads BUZZ_DEFAULT_RUNTIME and resolves
  it through the three-tier harness lookup (builtins/presets/custom), so
  operators can make opencode the site default for new agents; unknown
  ids warn and fall back to bundled buzz-agent (stock installs unchanged)
- document the tier-1 promotion and the engine override in the buzz-acp
  BYOH README

Model pinning and MCP servers need no bridge: buzz-acp already applies
them at the ACP protocol level (session/new model catalog + mcpServers),
which opencode supports natively.

Signed-off-by: innerline <innerline@me.com>
The differential ratchet forbids growth of discovery.rs (1438) and its
tests.rs (1820) past their merge-base sizes, which the tier-1 promotion
and engine-override commits exceeded. Restructure without behavior
change:

- OPENCODE_RUNTIME entry and the BUZZ_DEFAULT_RUNTIME resolver move to
  runtime_metadata.rs (well under its limit); the KNOWN_ACP_RUNTIMES
  array references the const
- default_agent_command becomes a thin override-or-bundled wrapper
- new opencode tests move to discovery/tests/opencode.rs, declared from
  runtime_metadata via #[path] so tests.rs stays at base size

Signed-off-by: innerline <innerline@me.com>
The preset-logo coverage guard (presetLogos.test.mjs) asserts PRESET_LOGOS
tracks the backend PRESET_HARNESSES ids exactly; after the tier-1
promotion opencode is no longer a preset, so its entry failed the guard
and blocked the pre-push desktop-test lane. Bundled logos for builtins
live in RUNTIME_LOGOS as inline assets (claude pattern) — copy
opencode.svg into the onboarding assets dir and import it ?inline.

Signed-off-by: innerline <innerline@me.com>
Add examples/sprig-opencode — a Dockerfile deriving FROM the published
sprig image and layering the pinned opencode musl binary (v1.18.21),
plus usage notes. This follows the remote-agent spec's rule that the
default image stays lean and alternate-harness dependencies arrive via
the image override ('buzz-sprig plus your tools'), rather than growing
Dockerfile.sprig. Reference the example from remote-agents.md and the
agent_command enumeration now lists opencode.

Signed-off-by: innerline <innerline@me.com>
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