Skip to content

Add a tight OpenCode adapter with run-scoped state isolation #662

Closed

Description

@aviggiano

Part of #653. Smithers already ships the OpenCode harness in its built-in registry, and the OpenCode + OpenRouter pairing has already driven a full ultrafuzz run at ten concurrent agent seats with opaque catalogue model IDs, using nothing but the stock Smithers agent constructed with a model string, yolo mode, --pure and an output byte cap. The pairing is proven; the isolation is not.

Problem

That run wrote all of OpenCode's state into the operator's real home — config directory, database and write-ahead log, snapshots, tool output, cached model catalogue and downloaded binaries. No ultrafuzz run may write harness state outside a run-scoped root.

Scope

Add packages/runtime/src/templates/smithers/agents/opencode.tsx on the claude.tsx template (~90 lines):

  • Construct the Smithers OpenCode agent with the profile model and extraArgs: ["--pure"] (no external plugins).
  • Point every state root at a run-scoped directory through env: workflowControlChildEnvironment(...): the XDG config/data/cache/state roots plus OpenCode's own config-dir variable, and the suppressors for autoupdate, share, model-catalogue fetch, default plugins and project config.
  • Merge over the env the Smithers agent already sets for yolo mode rather than replacing it — replacing it silently disables permission bypass.
  • Read only auth / api_key_env / config_dir from [agents.OpenCodeAgent] via the shared TOML reader off ULTRAFUZZ_CONFIG_PATH.
  • Keep the subclass to the buildCommand env scrub.

Register in agentFactories and AGENT_TEMPLATES; add OpenCodeAgent: "opencode" to AGENT_EXECUTABLES in packages/runtime/src/doctor.ts with a version-pin assertion against the qualified version. Ship an opt-in [models.opencode] profile, non-default.

Acceptance criteria

  • Adapter is under ~100 lines and overrides only buildCommand.
  • Filesystem test: run a smoke prompt with the home directory pointed at a temporary root and assert nothing is created under OpenCode's default config, data or cache locations.
  • Unit test: the credential reaches the child env and never the argv.
  • Unit test: the agent's own yolo permission env survives the adapter's env merge.
  • ultrafuzz doctor requires the pinned OpenCode CLI.

Dependencies

None. The previous dependency on #659 is removed — the pairing needs no further qualification and the isolation work stands alone.

Activity

  1. changed the title [-]Qualify OpenCode + OpenRouter with fully isolated state[/-] [+]Add a tight OpenCode adapter with run-scoped state isolation[/+] on Aug 20, 2026
  2. aviggiano commented on Aug 24, 2026

    @aviggiano
    CollaboratorAuthor

    Closing as shipped: PR #696 ("tight OpenCode adapter with run-scoped state isolation") reached main via PR #744, and the release notes list the opt-in OpenCode adapter. Verified on main: agents/opencode.tsx, the doctor AGENT_EXECUTABLES OpenCodeAgent entry, and the [agents.OpenCodeAgent] config section (including the OPENCODE_DB-leak hardening, 459ae1d). Remaining polish is tracked in #701.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions