Skip to content

feat(runtime): implement OpenCodeRuntime - #8473

Closed
waynesun09 wants to merge 44 commits into
mainfrom
feat-opencode-runtime-7103
Closed

waynesun09 wants to merge 44 commits into
mainfrom
feat-opencode-runtime-7103

Conversation

@waynesun09

@waynesun09 waynesun09 commented Oct 15, 2026 •

Copy link
Copy Markdown
Member

Summary

Adds OpenCode as an opt-in fullsend agent runtime. Claude Code stays the default.

This supersedes #7103 by @yvonnedevlinrh. It contains their 33 commits unchanged, with authorship and sign-off kept, rebased onto current main. The commits on top close the open review findings. OpenCode is supported for read-only agents only until the sandbox hook adapter lands (#7824, unbound-force/unbound-force#515). The runtime does not enforce this; the docs say so.

Related to #1260. Downstream tracker: unbound-force/unbound-force#510.

Changes Made

From #7103 (see that PR for the full description):

  • OpenCode bootstrap, run, config, and transcript handling, with a runner-owned config directory outside the workspace.
  • Agent definitions and tool allowlists translated to OpenCode's agent format and permission records.
  • Model aliases, provider/model references, and effort through --variant.
  • Sandbox image installs a pinned, SHA-256 verified OpenCode (now 1.19.1, see below).
  • Runtime selection, CLI help, config validation, and docs.

Fixes on top:

  • Permission order: trusted rules are applied in config order with glob keys, as OpenCode does (last match wins), so a trusted {"read":"allow","*":"deny"} can no longer be widened by the agent.
  • Pattern-map permissions: when the trusted policy gives a tool a pattern map (bash: {"gh *": "allow", "*": "deny"}), an agent that declares the tool now gets that pattern map. Before this fix, the agent-level "*": "deny" denied the tool outright.
  • Agent fallback: before every iteration the runner clears the other places OpenCode loads agent overrides from (agent/, agents/, mode/, modes/, opencode.jsonc, $HOME/.opencode, $HOME/.config/opencode), re-uploads the translated agent file and re-runs opencode debug agent. An iteration fails when OpenCode prints Falling back to default agent, on stderr or, in debug mode, in the debug log.
  • OpenCode 1.19.1: the pin moves from 1.18.30 to 1.19.1 (latest 1.x, both tarball checksums verified). Its built-in catalog has claude-*-5-5@default, and OPENCODE_DISABLE_MODELS_FETCH=true keeps the sandbox on that catalog. The runtime's flags, event stream, permission evaluation and agent loading are unchanged from 1.18.30. OpenCode 2.x is a separate rewrite with breaking CLI and config changes and no release tarballs, so it is left for a later migration.
  • Model aliases: opus, sonnet and haiku resolve to the same 5.5 generation as the other Claude-family runtimes (claude-*-5-5@default). A parity test checks this. OpenCode has no model fallback chain yet (feat(runtime/opencode): fall back along the alias chain when a model is not served #8476), so on a Vertex project that does not serve 5.5, name a model the project serves.
  • Skills: OpenCode uses the shared uploadHarnessSkills from Forge skills that share a directory basename replace each other: review loses issue-labels #7830, so skills land at skills/<declared SKILL.md name>.
  • Reset after .env: the run prelude repeats the override reset after sourcing the agent-writable .env and fails (exit 98) if the agent file's SHA-256 changed.
  • Smaller fixes: the agent's frontmatter model: applies when the harness names none (as on Claude Code and Codex); an exported empty GOOGLE_CLOUD_LOCATION is unset; a transcript with malformed lines is reported as an error. The per-iteration reset also clears tool/, tools/, command/, commands/, a cached models.json and auth.json.
  • Docs: docs/runtimes/opencode.md is now a short local-run walkthrough with real output, a models table and troubleshooting; the mechanics moved to the runtime implementation guide. Code comments are trimmed.
  • Tests: fixed the stale GOOGLE_CLOUD_LOCATION assertion and covered the empty-region case. The tests that need sha256sum in the pinned utility directories now skip on hosts without it (macOS).

Out of scope

The hook adapter (#7824), credential redaction (#7320), Renovate for OPENCODE_VERSION (#8201), and the Vertex @default suffix handling (#7823).

Test plan

  • go build ./..., and pre-commit run --from-ref origin/main --to-ref HEAD
  • Tests for the touched packages on Linux (Fedora 44): internal/runtime, agentnew, cli, config, repos, scaffold, sandbox, harness, pkg/behaviourtest/...
  • A local fullsend run triage with runtime: opencode (OpenCode 1.19.1 sandbox image built from this branch), against the throwaway repo nonflux/tmp-8473-opencode, with a trusted bash pattern-map policy: agent exit 0, output validation passed. Re-run at the final head after the post-.env reset and agent-file check: exit 0, validation passed. With claude-sonnet-5-5@default the id resolves from the 1.19.1 catalog; the Vertex project used for testing does not serve 5.5 (availability is per project), so that run used claude-sonnet-4-6@default.
  • OpenCode behaviour test: e2e/behaviour/features/runtime/opencode.feature, gated on the runtime-opencode capability. Not run: it needs a published sandbox image that contains OpenCode, which exists only after this merges.

Backward Compatibility

This change is additive and opt-in. Existing configurations keep Claude Code unless they select runtime: opencode.

🤖 Generated with Claude Code

@waynesun09
waynesun09 requested a review from a team October 15, 2026 20:06
@waynesun09

Copy link
Copy Markdown
Member Author

/fs-fix-stop

@github-actions

Copy link
Copy Markdown

Fix agent disabled for this PR. Remove the fullsend-no-fix label or use /fs-fix to re-engage.

@fullsend-ai-review

fullsend-ai-review Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

🤖 Finished Review · ✅ Success · Started 8:08 PM UTC · Completed 8:29 PM UTC

Commit: 187e368 · View workflow run →

Runtime: pi · Model: sonnet → claude-sonnet-5-5 · Effort: high · Cost: $5.48

@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Implement an opt-in OpenCode agent runtime

✨ Enhancement ⚙️ Configuration changes 🧪 Tests 📝 Documentation 🕐 40+ Minutes

Grey Divider

AI Description

• Adds OpenCode execution, agent translation, Vertex model selection, and transcript handling while
 retaining Claude Code as default.
• Makes OpenCode selectable through configuration and CLI, with a pinned sandbox binary and
 inference egress allowance.
• Documents the read-only pilot limitation and tests permissions, agent fallback, and run failures.
Diagram

graph TD
  Select["Runtime selection"] --> Harness["Agent harness"] --> Bootstrap["OpenCode bootstrap"] --> Config["Runner config"]
  Harness --> Run["Iteration runner"] --> Binary["OpenCode CLI"] --> Events["Events and transcripts"]
  Config --> Binary
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Enforce read-only eligibility at runtime selection
  • ➕ Prevents write-capable roles from selecting OpenCode while the hook adapter is unavailable.
  • ➕ Makes the documented pilot boundary an enforceable constraint.
  • ➖ Requires a role-aware check across configuration and per-run overrides.
  • ➖ The gate must change when hook support lands.

Recommendation: The existing runtime interfaces are a good fit, and runner-held configuration is preferable to workspace configuration. Before broader deployment, add a role-aware gate: this PR documents read-only use, but disabling security also removes the hook guard for write-capable agents. Until then, limit use to controlled, disposable-repository pilots.

Files changed (46) +3632 / -256

Enhancement (8) +1473 / -64
options.goRoute generated OpenCode agents through Vertex +5/-1

Route generated OpenCode agents through Vertex

• Treats OpenCode harnesses as Vertex-backed so they retain the required credentials and provider environment.

internal/agentnew/options.go

render.goAdd OpenCode policy input to generated harnesses +7/-0

Add OpenCode policy input to generated harnesses

• Maps operator-supplied OPENCODE_CONFIG_CONTENT into OpenCode harness sandbox environments.

internal/agentnew/render.go

runtime_prompt.goOffer OpenCode in the interactive prompt +5/-4

Offer OpenCode in the interactive prompt

• Adds OpenCode as an experimental read-only choice and preserves the Claude Code recommendation.

internal/cli/runtime_prompt.go

opencode.goReplace the OpenCode runtime stub +94/-59

Replace the OpenCode runtime stub

• Defines the runner-owned config location and OpenCode environment exports. Establishes the operational runtime and transcript interfaces in place of stub behavior.

internal/runtime/opencode.go

opencode_bootstrap.goTranslate and bootstrap OpenCode agents +444/-0

Translate and bootstrap OpenCode agents

• Creates agent, skill, and plugin directories; translates Claude-style definitions and intersects tool permissions with trusted policy. Preflights the binary and verifies the selected agent loads as primary.

internal/runtime/opencode_bootstrap.go

opencode_integrity.goRetain trusted OpenCode state and detect fallback +156/-0

Retain trusted OpenCode state and detect fallback

• Validates harness-provided permissions and credentials and stores their pristine values for run iterations. Watches stderr for OpenCode's default-agent fallback warning.

internal/runtime/opencode_integrity.go

opencode_run.goExecute and monitor OpenCode iterations +621/-0

Execute and monitor OpenCode iterations

• Resolves models and effort, restores trusted environment values, and runs OpenCode with streamed JSON output. Preserves exit status through transcript capture, restores the agent each iteration, and rejects fallback or corrupt success streams.

internal/runtime/opencode_run.go

opencode_transcript.goExtract OpenCode transcripts and debug logs +141/-0

Extract OpenCode transcripts and debug logs

• Downloads the captured JSONL stream and optional debug log. Replays transcripts to identify error results for run reporting.

internal/runtime/opencode_transcript.go

Bug fix (1) +19 / -5
opencode_progress.goFlag malformed OpenCode stream events +19/-5

Flag malformed OpenCode stream events

• Counts malformed JSON events and marks an error envelope as failed even when its payload cannot be decoded.

internal/runtime/opencode_progress.go

Tests (14) +1776 / -110
options_test.goTest OpenCode Vertex selection +1/-1

Test OpenCode Vertex selection

• Adds OpenCode to the generated-agent Vertex routing cases.

internal/agentnew/options_test.go

render_test.goTest generated OpenCode environment +47/-0

Test generated OpenCode environment

• Checks that OpenCode harnesses include the config content and Vertex settings while other runtimes do not.

internal/agentnew/render_test.go

run_overrides_test.goPreserve unknown-runtime rejection tests +6/-6

Preserve unknown-runtime rejection tests

• Replaces formerly invalid OpenCode inputs with unknown names now that OpenCode is selectable.

internal/cli/run_overrides_test.go

runtime_binaries_test.goCheck OpenCode inference binary allowance +8/-5

Check OpenCode inference binary allowance

• Maps OpenCode to the native binary glob required by the Vertex egress profile.

internal/cli/runtime_binaries_test.go

runtime_prompt_test.goTest interactive OpenCode selection +4/-3

Test interactive OpenCode selection

• Verifies OpenCode is accepted while unknown and test-only runtime choices remain rejected.

internal/cli/runtime_prompt_test.go

config_test.goTest OpenCode configuration acceptance +6/-8

Test OpenCode configuration acceptance

• Changes validation expectations to accept OpenCode and reject genuinely unknown runtimes.

internal/config/config_test.go

manifest_test.goTest OpenCode in fleet defaults +4/-7

Test OpenCode in fleet defaults

• Verifies a managed manifest accepts an OpenCode runtime default.

internal/repos/manifest_test.go

capabilities_test.goTest OpenCode debug-log naming +8/-4

Test OpenCode debug-log naming

• Updates capability tests for OpenCode's DebugLogNamer implementation and retains fallback coverage.

internal/runtime/capabilities_test.go

opencode_bootstrap_test.goExercise OpenCode bootstrap and lifecycle +688/-0

Exercise OpenCode bootstrap and lifecycle

• Tests agent and skill uploads, trusted environment failures, agent fallback checks, run events, artifact extraction, and iteration cleanup using fake sandbox commands.

internal/runtime/opencode_bootstrap_test.go

opencode_progress_test.goTest malformed stream detection +53/-8

Test malformed stream detection

• Updates parser tests for malformed-line counts and verifies malformed error payloads still produce an error verdict.

internal/runtime/opencode_progress_test.go

opencode_test.goCover OpenCode policy, execution, and artifacts +902/-26

Cover OpenCode policy, execution, and artifacts

• Replaces stub expectations with tests for model aliases, permission intersections, command construction, environment restoration, failure handling, transcripts, and debug logs.

internal/runtime/opencode_test.go

registry_test.goTest repository and agent OpenCode selection +46/-39

Test repository and agent OpenCode selection

• Verifies OpenCode resolves through repository and per-agent configuration while unknown runtime names remain invalid.

internal/runtime/registry_test.go

scaffold_test.goPin the updated Vertex binary allowlist +1/-1

Pin the updated Vertex binary allowlist

• Updates the exact-list assertion to include the OpenCode binary.

internal/scaffold/scaffold_test.go

runtime_test.goKeep behaviour-step invalid-runtime coverage +2/-2

Keep behaviour-step invalid-runtime coverage

• Uses unknown runtime names in rejection cases now that OpenCode is valid.

pkg/behaviourtest/steps/runtime_test.go

Documentation (15) +286 / -65
config.tsLink the OpenCode runtime guide +1/-0

Link the OpenCode runtime guide

• Adds OpenCode to the runtime documentation navigation.

docs/.vitepress/config.ts

architecture.mdShow OpenCode in the runtime architecture +7/-3

Show OpenCode in the runtime architecture

• Adds OpenCode, its config directory, and Vertex path to the architecture diagram and runtime overview.

docs/architecture.md

agent.mdDocument OpenCode agent options +3/-3

Document OpenCode agent options

• Lists OpenCode as an agent runtime and documents provider/model references for agent settings.

docs/cli/agent.md

github.mdDocument OpenCode in GitHub setup +1/-1

Document OpenCode in GitHub setup

• Adds OpenCode to the documented runtime choices for repository setup.

docs/cli/github.md

run.mdDocument OpenCode run overrides +4/-4

Document OpenCode run overrides

• Adds OpenCode to runtime and model flag descriptions and runtime-related output guidance.

docs/cli/run.md

runtime-implementation.mdUpdate the runtime implementation and security matrix +39/-31

Update the runtime implementation and security matrix

• Records OpenCode integration points, binary egress needs, artifact handling, and the absence of sandbox hooks. Notes that the current security-disabled workaround also disables host-side scans.

docs/contributing/runtime-implementation.md

glossary.mdIdentify OpenCode as an experimental runtime +1/-1

Identify OpenCode as an experimental runtime

• Replaces the stub description with the opt-in, read-only pilot status.

docs/glossary.md

cli-internals.mdList OpenCode in CLI command guidance +2/-2

List OpenCode in CLI command guidance

• Adds OpenCode to documented agent runtime flag choices.

docs/guides/dev/cli-internals.md

choosing-a-runtime.mdAdd OpenCode to runtime selection guidance +2/-1

Add OpenCode to runtime selection guidance

• Describes its experimental read-only scope and how to select it during GitHub setup.

docs/guides/getting-started/choosing-a-runtime.md

configuring-github.mdMention the OpenCode setup option +1/-1

Mention the OpenCode setup option

• Identifies OpenCode as an experimental opt-in choice during GitHub setup.

docs/guides/getting-started/configuring-github.md

layered-config-reference.mdList OpenCode as a valid layered runtime +2/-2

List OpenCode as a valid layered runtime

• Adds opencode to the valid runtime values for layered configuration.

docs/guides/infrastructure/layered-config-reference.md

config-reference.mdDocument OpenCode configuration limits +5/-2

Document OpenCode configuration limits

• Adds OpenCode to the runtime values and states its read-only pilot limitation.

docs/reference/config-reference.md

runtimes.mdDescribe OpenCode capabilities and limits +20/-11

Describe OpenCode capabilities and limits

• Replaces its stub listing with an opt-in runtime entry. Documents model, effort, permission, skill, artifact, and deferred hook behavior.

docs/runtimes.md

opencode.mdAdd an OpenCode setup and operations guide +195/-0

Add an OpenCode setup and operations guide

• Explains configuration, Vertex models, local setup, permissions, artifacts, and troubleshooting. Warns that disabling security for current runs also disables scans and redaction.

docs/runtimes/opencode.md

registry.goUpdate runtime selection guidance +3/-3

Update runtime selection guidance

• Clarifies that membership in ValidRuntimes controls configuration selection; OpenCode was already resolvable by the registry.

internal/runtime/registry.go

Other (8) +78 / -12
ContainerfileInstall a verified OpenCode binary +49/-0

Install a verified OpenCode binary

• Installs pinned OpenCode 1.18.30 releases for amd64 and arm64 with checksum and version checks. Creates the sandbox config directory outside the workspace.

images/sandbox/Containerfile

admin.goExpose OpenCode in install help +1/-1

Expose OpenCode in install help

• Updates runtime flag help while retaining Claude Code as the default.

internal/cli/admin.go

agent.goExpose OpenCode in agent flag help +2/-2

Expose OpenCode in agent flag help

• Documents OpenCode runtime selection and provider/model values for agent settings.

internal/cli/agent.go

github.goExpose OpenCode in GitHub setup help +1/-1

Expose OpenCode in GitHub setup help

• Lists OpenCode as a per-repository runtime choice.

internal/cli/github.go

run.goExpose OpenCode in run override help +2/-2

Expose OpenCode in run override help

• Lists OpenCode in runtime and model override descriptions.

internal/cli/run.go

config.goMake OpenCode a valid runtime +11/-5

Make OpenCode a valid runtime

• Adds opencode to the recognized runtime set for repository, agent, and fleet configuration.

internal/config/config.go

sandbox.goDefine the OpenCode sandbox config path +10/-0

Define the OpenCode sandbox config path

• Adds a shared constant for the runner-owned OpenCode directory outside the cloned repository.

internal/sandbox/sandbox.go

fullsend-vertex-ai.yamlPermit OpenCode Vertex inference egress +2/-1

Permit OpenCode Vertex inference egress

• Adds the native OpenCode binary to the scaffolded Vertex inference profile's binary allowlist.

internal/scaffold/fullsend-repo/profiles/fullsend-vertex-ai.yaml

@qodo-code-review

qodo-code-review Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)

Grey Divider


Action required

1. Readers miss the planned-support warning ✗ Dismissed
Description
The new OpenCode pages describe write-path and hook-adapter work in ordinary prose, and the only
attempted callout is written as **Planned: write-path support.** rather than the required `>
**Planned:**` label. When readers use the runtime index or implementation matrix, unfinished
capabilities are presented as current runtime guidance instead of a consistently marked planned
feature.
Code

docs/runtimes/opencode.md[R13-16]

+> **Planned: write-path support.** OpenCode is enabled for read-only agents (`triage`,
+> `prioritize`). Write-capable agents (`code`, `fix`) are gated on the security-hook adapter, tracked
+> in [unbound-force#515](https://github.com/unbound-force/unbound-force/issues/515): OpenCode has no
+> native PreToolUse/PostToolUse hooks, so until the runner-owned, sha256-gated plugin adapter lands,
Evidence
The checklist requires every mention of an unimplemented feature to use the exact > **Planned:**
callout format with an issue link. The new OpenCode documentation uses a nonconforming bold
paragraph for planned write-path support and adds additional unmarked statements about the missing
adapter in the runtime index and implementation matrix.

docs/runtimes/opencode.md[13-22]
docs/runtimes.md[73-75]
docs/contributing/runtime-implementation.md[159-164]
Skill: writing-user-docs

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
OpenCode's unfinished write-path and hook-adapter support is not consistently documented with the required `> **Planned:**` callout format.

## Fix Focus Areas
- docs/runtimes/opencode.md[13-22]
- docs/runtimes.md[73-75]
- docs/contributing/runtime-implementation.md[159-164]

## Recommended Fix
Rewrite each description of not-yet-implemented OpenCode functionality as a blockquote beginning exactly with `> **Planned:**`, and retain a link to the relevant tracking issue.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. OpenCode transcripts retain raw credentials ✗ Dismissed
Description
OpenCodeRuntime.Run writes the unredacted JSON stream directly to OutputPath and the sandbox
transcript tee, while ExtractTranscripts downloads that second copy without a redaction step. Any
credential-bearing model output or tool data therefore remains in both persisted artifacts when
OpenCode is used.
Code

internal/runtime/opencode_run.go[R302-307]

+	// The --format json stream is consumed live on the host (streamed to the
+	// parser and host-side tee'd to RunParams.OutputPath). ExtractTranscripts,
+	// however, runs after Run and downloads the transcript from a sandbox file,
+	// so the stream must also land in a sandbox-side path. Pipe opencode's
+	// stdout through tee into the runner-owned sandbox transcript file
+	// (openCodeSandboxTranscriptPath), which ExtractTranscripts downloads.
Evidence
The new runtime documents that its transcripts are raw and unredacted, and the implementation tees
the stream to a sandbox file, writes it to OutputPath, and downloads it without applying
redaction.

Redact credentials in persisted OpenCode and pi artifacts
internal/runtime/opencode_run.go[302-307]
internal/runtime/opencode_run.go[502-509]
internal/runtime/opencode_transcript.go[41-68]
docs/runtimes/opencode.md[24-34]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
OpenCode's JSON event stream is persisted verbatim in the host output file and in the sandbox transcript downloaded after the run. These paths bypass the existing output-file and transcript credential-redaction pipeline.

## Fix Focus Areas
- internal/runtime/opencode_run.go[302-307]
- internal/runtime/opencode_run.go[502-509]
- internal/runtime/opencode_transcript.go[41-68]

## Recommended Fix
Route both the host-side output and sandbox-side tee through the shared credential redaction pipeline before writing or downloading artifacts, and apply the same redaction during transcript extraction. Add tests proving that tokens, authorization headers, and other credential-bearing event content are absent from both persisted copies.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


3. OpenCode pins never receive updates ✗ Dismissed
Description
The new OPENCODE_VERSION and checksum arguments are added without a Renovate manager or
checksum-refresh task. Future OpenCode releases therefore leave the sandbox image on 1.18.30 until
someone updates the pin manually.
Code

images/sandbox/Containerfile[R340-342]

+ARG OPENCODE_VERSION=1.18.30
+ARG OPENCODE_SHA256_AMD64=55007246858165496ff85ba1c2b648f7421e8e2013bf4189a680c9ff8e699d17
+ARG OPENCODE_SHA256_ARM64=4111a55c2a02c0fac314bd51e9a2330280e6d29d2b85b9554fff6d62612566ed
Evidence
The PR adds the pinned OpenCode version and architecture-specific checksums, while the existing
Renovate custom managers end without any OpenCode entry or checksum update task.

Automate OpenCode version updates with Renovate
images/sandbox/Containerfile[340-342]
renovate.json[258-272]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The sandbox image introduces an OpenCode version pin and per-architecture checksums, but Renovate has no rule to update them automatically.

## Fix Focus Areas
- images/sandbox/Containerfile[340-342]
- renovate.json[258-272]

## Recommended Fix
Add a Renovate custom manager for `OPENCODE_VERSION` using the OpenCode GitHub releases datasource, group the version and checksum changes, and add the required post-upgrade checksum task so both architecture hashes are refreshed with each release.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


View high (2)
4. Agents can bypass read-only tool limits ✗ Dismissed
Description
The OpenCode config directory is group-writable by the sandbox user, and Bootstrap creates its
plugins/ directory without restricting writes. When a read-only agent is allowed the documented
bash permission, it can place a plugin there for a later iteration to load, bypassing the tool
restrictions supplied by the runner.
Code

internal/runtime/opencode_bootstrap.go[R112-116]

+	mkdirCmd := fmt.Sprintf("mkdir -p %s %s %s",
+		shellQuote(cfg+"/"+openCodeAgentDir),
+		shellQuote(r.openCodeSkillsPath()),
+		shellQuote(cfg+"/"+openCodePluginsDir))
+	if _, _, _, err := sandbox.Exec(sandboxName, mkdirCmd, 10*time.Second); err != nil {
Evidence
The image grants the sandbox group write access to the config directory; bootstrap creates plugins
under it. The documented pilot policy allows bash while denying edit and write, and iteration
cleanup does not remove the config tree.

images/sandbox/Containerfile[374-375]
internal/runtime/opencode_bootstrap.go[110-116]
docs/runtimes/opencode.md[117-125]
internal/runtime/opencode_run.go[606-620]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
A bash-enabled read-only agent can write into OpenCode's runner-owned plugin directory and affect later iterations.
## Fix Focus Areas
- images/sandbox/Containerfile[374-375]
- internal/runtime/opencode_bootstrap.go[110-116]
- internal/runtime/opencode_run.go[188-239]
## Recommended Fix
Make the config tree, including plugins and agent definitions, unwritable by the sandbox agent. Perform runner updates through a privileged upload path, and preserve that ownership across iterations.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


5. Write agents run without sandbox hooks ✗ Dismissed
Description
OpenCodeRuntime.Run checks adapter availability only when HooksSettingsPath is set, while
neither Bootstrap nor Run rejects write-capable roles or permissions. Because security-enabled
runs set that path and are rejected without an adapter, setting security.enabled: false lets
code, fix, or other agents with Write/Edit permissions run without sandbox tool hooks, a host
context scan, or a runtime content scan.
Code

internal/config/config.go[R300-304]

+// NOTE: opencode does not yet provide sandbox hooks for write-capable agents
+// (code, fix). The exit-97 guard is keyed on security.enabled, not agent role:
+// with security enabled it requires the adapter, while disabling security does
+// not block write-capable roles. Role-aware enforcement is deferred to
+// unbound-force#515 with the hook adapter.
Evidence
Harness.SecurityEnabled() defaults to true, and the runner supplies HooksSettingsPath for
security-enabled runs; Run then reports that the hooks adapter is unavailable. The configuration
comment and runtime documentation state that disabling security removes this guard without blocking
write-capable roles, and neither Bootstrap nor Run checks the role or final write/edit
permissions.

Install and enforce OpenCode sandbox security hooks
internal/config/config.go[300-304]
internal/runtime/opencode_run.go[470-482]
docs/runtimes/opencode.md[13-22]
internal/runtime/opencode_run.go[476-483]
internal/runtime/opencode_run.go[440-446]
internal/harness/harness.go[245-250]
internal/cli/run.go[2425-2436]
internal/config/config.go[295-307]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
OpenCode can run write-capable agents when `security.enabled: false`, bypassing the unavailable hook adapter and leaving those runs without tool enforcement or scanners. Security-enabled runs are instead rejected because the adapter is unavailable.

## Fix Focus Areas
- internal/config/config.go[300-304]
- internal/runtime/opencode_run.go[470-483]
- internal/runtime/opencode_bootstrap.go[130-140]
- docs/runtimes/opencode.md[13-22]

## Recommended Fix
Add a fail-closed gate before OpenCode runs, regardless of `security.enabled`. In `Bootstrap`, after `openCodePermissionRecord` and `intersectPermissionRecord`, reject final agent permissions that allow `edit` or `write`, including an unrestricted empty record; alternatively, pass the harness role through `BootstrapInput` and reject write-capable roles until the hook adapter is installed. Add tests for security-enabled and security-disabled configurations, including write/edit permissions and unrestricted agents.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Remediation recommended

6. Critical changes merge without end-to-end tests ✗ Dismissed
Description
The PR changes internal/cli code without documenting a successful make e2e-test run or adding a
required job that executes that target. The available workflow runs make behaviour-test and `make
playback-test` instead, so these CLI changes can merge without the checklist's required end-to-end
gate.
Code

internal/cli/run.go[R460-461]

+	cmd.Flags().StringVar(&oFlags.runtime, "runtime", "", "override the agent runtime from config.yaml for this run (claude, pi, codex, opencode, dummy or dummy-playback; also $FULLSEND_RUNTIME)")
+	cmd.Flags().StringVar(&oFlags.model, "model", "", "override the harness/agent model for this run (alias such as opus/sonnet/haiku, a model id, or provider/id on pi, codex, and opencode — codex takes OpenAI ids and gateway/<model> only; also $FULLSEND_MODEL)")
Evidence
The PR modifies internal/cli/run.go, which activates the end-to-end testing requirement. The
repository workflow runs behaviour and playback targets rather than make e2e-test, and the PR test
plan lists package tests but no successful end-to-end test run.

Rule 1062051: Run end-to-end tests for critical internal modules before merge
internal/cli/run.go[460-461]
.github/workflows/e2e.yml[200-220]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Changes under `internal/cli` are not backed by evidence that the required `make e2e-test` check ran and passed before merge. The PR description also does not claim that end-to-end tests were executed.

## Fix Focus Areas
- internal/cli/run.go[460-461]
- .github/workflows/e2e.yml[200-220]

## Recommended Fix
Add or invoke a required `make e2e-test` job for changes under `internal/cli`, or document and enforce an equivalent end-to-end target that covers these paths. Ensure the job runs for this PR and fails the merge when the tests fail.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


7. Agent pilots fail before startup ✗ Dismissed
Description
OpenCode bootstrap requires OPENCODE_CONFIG_CONTENT, but the existing harnesses in agents and
mlflow-assessments do not export it, and selecting OpenCode with a runtime override does not
regenerate those harnesses. Once an OpenCode-capable image is available, an overridden run reaches
bootstrap and fails with OPENCODE_CONFIG_CONTENT is empty.
Code

internal/runtime/opencode_integrity.go[R82-84]

+func validateOpenCodeTrustedEnv(env openCodeTrustedEnv) error {
+	if strings.TrimSpace(env.ConfigContent) == "" {
+		return fmt.Errorf("reading the trusted OpenCode environment: OPENCODE_CONFIG_CONTENT is empty")
Evidence
Bootstrap rejects an empty configuration; the generator only supplies it for newly generated
OpenCode harnesses. Neither cited consumer harness declares the value.

fullsend -> agents
fullsend -> mlflow-assessments
internal/runtime/opencode_integrity.go[65-95]
internal/agentnew/render.go[127-133]
internal/cli/run_overrides.go[147-164]
External repo: fullsend-ai/agents, harness/review.yaml [54-73]
External repo: fullsend-ai/mlflow-assessments, .fullsend/harness/llm-judge.yaml [32-41]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Existing agents and mlflow-assessments harnesses do not deliver the trusted OpenCode configuration required by bootstrap when selected through a runtime override.

## Fix Focus Areas
- internal/runtime/opencode_integrity.go[82-95]
- internal/agentnew/render.go[127-133]
- /cross_repos/agents/harness/review.yaml[54-73]
- /cross_repos/mlflow-assessments/.fullsend/harness/llm-judge.yaml[32-41]

## Recommended Fix
Coordinate an OpenCode policy and provider configuration in each pilot harness's sandbox environment, or arrange for the runner to supply validated trusted configuration when overriding an existing harness. Verify an override using a checked-in read-only harness.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


8. Large output events disappear silently ✗ Dismissed
Description
parseOpenCodeStream skips an NDJSON line that exceeds its reader buffer without incrementing
malformedLines. If a text or tool event exceeds 1 MiB but other events complete a turn, Run can
accept an exit-zero stream while the normalized event and its content are missing.
Code

internal/runtime/opencode_progress.go[R139-145]

			break
		}
		if err != nil {
-			return sessionID, err
+			return sessionID, malformedLines, err
		}
		// Skip lines exceeding the buffer (same pattern as parseClaudeStream).
		if isPrefix {
Evidence
The parser consumes oversized lines without changing its malformed count, while the exit-zero
failure check uses that count. A parser test confirms skipping oversized input, and the fixture
shows tool events carry output content.

internal/runtime/opencode_progress.go[133-159]
internal/runtime/opencode_run.go[575-580]
internal/runtime/opencode_progress_test.go[383-396]
internal/runtime/testdata/opencode/basic_run.ndjson[1-4]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Oversized OpenCode events are dropped without setting the corruption signal checked by `Run`.
## Fix Focus Areas
- internal/runtime/opencode_progress.go[133-159]
- internal/runtime/opencode_run.go[575-580]
- internal/runtime/opencode_progress_test.go[383-396]
## Recommended Fix
Count an oversized line as malformed, or return an explicit size error. Cover an oversized event followed by a valid completed turn and verify the run cannot succeed.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


View medium (8)
9. Agent model choices are ignored ✗ Dismissed
Description
translateOpenCodeModel converts an empty RunParams.Model to opus, and the run command always
passes that result as --model. When an agent specifies a model only in its frontmatter, the CLI
reads it separately but passes only the harness model to Run, so the explicit command-line model
overrides the translated agent definition.
Code

internal/runtime/opencode_run.go[R63-76]

+	model = strings.TrimSpace(model)
+	if model == "" {
+		model = openCodeDefaultModel
+	}
+	// Resolve the alias first, then check for provider/model passthrough:
+	// an alias may map to a provider/id spec (config.ValidateModelAliases
+	// accepts it), and checking "/" before alias resolution would miss it.
+	if id, ok := mergedOpenCodeModelAliases(configAliases)[model]; ok {
+		model = id
+	}
+	if strings.Contains(model, "/") {
+		return model
+	}
+	return provider + "/" + model
Evidence
The CLI obtains the definition model but passes only h.Model into RunParams; the new runtime
turns an empty value into opus and always supplies it on the command line. The shared model helper
and pi runtime demonstrate the otherwise-used precedence.

internal/cli/run.go[1009-1010]
internal/cli/run.go[2569-2573]
internal/runtime/opencode_run.go[58-76]
internal/runtime/opencode_run.go[263-268]
internal/runtime/model.go[7-23]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
An agent's frontmatter-only model loses to OpenCode's unconditional `opus` command-line fallback.
## Fix Focus Areas
- internal/runtime/opencode_run.go[58-76]
- internal/runtime/opencode_run.go[263-268]
- internal/cli/run.go[1009-1010]
- internal/cli/run.go[2569-2573]
## Recommended Fix
Apply the shared model precedence to the harness and agent-definition models before constructing `--model`, then use that resolved value for execution and metrics.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


10. Debug runs skip the default-agent fallback check ✓ Resolved
Description
When params.Debug is set, buildOpenCodeRunCommand appends
2>>/sandbox/workspace/opencode-debug.log to the opencode invocation. That sends OpenCode's stderr
to a file, so openCodeFallbackWatcher, which reads the exec stderr stream for `Falling back to
default agent, never sees the marker. In --debug` runs, an iteration whose translated agent was
deleted or broken (for example by the agent-writable .env sourced after Run re-uploads the file)
runs under OpenCode's default agent with every tool allowed, and its result is accepted instead of
rejected.
Code

internal/runtime/opencode_run.go[R284-286]

+	// The validation loop replaces the prompt on a retry iteration to inject
+	// the previous failure (#1050/#6494); every runtime must honour it, or
+	// feedback_mode silently degrades to a blind retry.
Evidence
Run passes fallback := &openCodeFallbackWatcher{w: os.Stderr} as the stderr sink of
ExecStreamReader and refuses the result only when fallback.fellBack is true. In debug mode the
command redirects opencode's fd 2 to the debug log inside the sandbox, so nothing from opencode
reaches that watcher. The watcher looks for the marker on stderr (opencode_integrity.go), and the
bootstrap test emits it with >&2.

internal/runtime/opencode_run.go[276-287]
internal/runtime/opencode_run.go[491-497]
internal/runtime/opencode_run.go[561-563]
internal/runtime/opencode_integrity.go[129-156]
internal/runtime/opencode_bootstrap_test.go[485-500]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
In debug mode opencode's stderr goes to `opencode-debug.log` inside the sandbox, so `openCodeFallbackWatcher` never sees `Falling back to default agent`. The default-agent fallback guard therefore does not work in `--debug` runs.

## Fix Focus Areas
- internal/runtime/opencode_run.go[276-287]
- internal/runtime/opencode_run.go[561-563]

## Recommended Fix
In debug mode, pipe stderr through `tee -a` (using the pinned `$FULLSEND_OPENCODE_TEE_BIN`) into the debug log, so it still reaches the exec stderr, e.g. `2> >(...)`. That syntax is not POSIX, so use a fifo or a `{ ...; } 2>&1 1>&3 | tee -a log >&2` fd-swap. Alternatively, after the run, grep the debug log for the marker before accepting the result. Add a test that sets `Debug` and asserts the fallback is still rejected.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


11. Agents can redirect Vertex requests ✗ Dismissed
Description
buildOpenCodeRunCommand sources the agent-writable .env and restores the config and credential
path, but derives the Vertex project and region from variables that were not restored. If an agent
changes those variables between iterations, OpenCode receives the changed project or region despite
using the runner-pinned credentials.
Code

internal/runtime/opencode_run.go[R231-232]

+		`&& export GOOGLE_CLOUD_PROJECT="${ANTHROPIC_VERTEX_PROJECT_ID:-$GOOGLE_CLOUD_PROJECT}"`,
+		"&& "+openCodeCloudLocationExport,
Evidence
The run prelude sources .env and restores only selected trusted values. Its project and location
exports then read unpinned variables; the trusted-environment record does not contain either routing
value.

internal/runtime/opencode_run.go[213-233]
internal/runtime/opencode_run.go[336-341]
internal/runtime/opencode_run.go[383-406]
internal/runtime/opencode_integrity.go[15-23]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Agent-writable environment values determine OpenCode's Vertex project and region after trusted settings are restored.
## Fix Focus Areas
- internal/runtime/opencode_integrity.go[15-23]
- internal/runtime/opencode_run.go[213-233]
- internal/runtime/opencode_run.go[336-341]
## Recommended Fix
Capture the trusted project and region before agent execution and restore those values after sourcing `.env`, alongside the already-pinned credential path.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


12. Coverage drops over one point can merge ✗ Dismissed
Description
The PR adds and modifies Go code while CI measures only the current branch's total coverage and
uploads it without computing a base-branch comparison. A total coverage regression greater than one
percentage point therefore does not fail or warn in the merge checks.
Code

internal/runtime/opencode_run.go[R18-24]

+// Model selection for OpenCode. The fleet's harnesses name Claude-style
+// aliases (opus, sonnet, ...), which are mapped onto OpenCode's provider/model
+// form here; a harness or agents: entry may also give provider/model
+// directly. The provider defaults to the Vertex-backed Anthropic provider the
+// injected OPENCODE_CONFIG_CONTENT registers. Both the provider and the final
+// model string can be overridden from the runner environment.
+const (
Evidence
The PR changes Go runtime code, activating the project-level coverage regression requirement. The
only coverage workflow step runs tests for the current checkout and uploads coverage.out; it does
not check out or measure the base branch and performs no regression comparison.

Rule 1062048: Enforce Go project test coverage regression limit (≤1% drop vs base)
internal/runtime/opencode_run.go[18-24]
.github/workflows/lint.yml[51-67]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The coverage workflow does not calculate base-branch coverage or compare it with the PR's total coverage. A regression greater than one percentage point can pass the current checks.

## Fix Focus Areas
- internal/runtime/opencode_run.go[18-24]
- .github/workflows/lint.yml[51-67]

## Recommended Fix
Compute total coverage for both the base branch and the PR using the same `go test ./... -coverprofile` command, then fail the job when base coverage minus current coverage exceeds 1.0 percentage point.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


13. Changed Go lines lack a patch coverage gate ✗ Dismissed
Description
The new OpenCode runtime logic is covered only by a whole-project coverage upload, with no check
that executable lines changed by this PR reach the required patch threshold. A change can therefore
merge with patch coverage below 75% because the workflow never computes or enforces changed-line
coverage.
Code

internal/runtime/opencode_run.go[R18-24]

+// Model selection for OpenCode. The fleet's harnesses name Claude-style
+// aliases (opus, sonnet, ...), which are mapped onto OpenCode's provider/model
+// form here; a harness or agents: entry may also give provider/model
+// directly. The provider defaults to the Vertex-backed Anthropic provider the
+// injected OPENCODE_CONFIG_CONTENT registers. Both the provider and the final
+// model string can be overridden from the runner environment.
+const (
Evidence
The PR adds new executable Go code in internal/runtime/opencode_run.go. CI runs `go test -race
-coverprofile=coverage.out ./...` and uploads the profile, but the workflow contains no changed-line
coverage calculation or 75% threshold enforcement.

Rule 1062047: Enforce minimum patch test coverage for changed Go lines
internal/runtime/opencode_run.go[18-24]
.github/workflows/lint.yml[51-67]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The PR adds substantial Go runtime logic, but CI only produces a whole-project coverage profile and uploads it. No patch coverage tool or threshold check prevents changed executable lines from falling below 75% coverage.

## Fix Focus Areas
- internal/runtime/opencode_run.go[18-24]
- .github/workflows/lint.yml[51-67]

## Recommended Fix
Add a patch coverage calculation for the PR's changed Go lines using the generated coverage profile, fail when patch coverage is below 75%, and report the result in CI.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


14. Users follow the wrong hook issue ✗ Dismissed
Description
docs/runtimes.md links the security-hook adapter limitation to issue #7824, while the dedicated
OpenCode page and implementation matrix identify #515 as the adapter tracker. A reader starting
from the runtime index is sent to the config-lockdown work item instead of the issue that tracks
missing hook support.
Code

docs/runtimes.md[R73-75]

+Choose `opencode` for an experimental open-source runtime backed by configurable providers; it is
+currently limited to read-only agents (`triage`, `prioritize`) until the security-hook adapter
+lands ([#7824](https://github.com/fullsend-ai/fullsend/issues/7824)).
Evidence
The documentation update introduces a runtime-index link to #7824 for the security-hook adapter,
but the dedicated OpenCode documentation identifies #515 as the adapter issue and describes
#7824 as the separate config-directory lockdown issue. This makes the updated user-facing runtime
documentation inconsistent and sends readers to the wrong tracker.

Rule 2748504: Update docs/ references when changing user-facing behavior
docs/runtimes.md[73-75]
docs/runtimes/opencode.md[13-22]
docs/runtimes/opencode.md[56-60]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The OpenCode runtime index points users to `#7824` for the security-hook adapter, but the adapter is tracked by `#515`; `#7824` covers config-directory lockdown.

## Fix Focus Areas
- docs/runtimes.md[73-75]
- docs/runtimes/opencode.md[13-22]

## Recommended Fix
Change the runtime index link from issue `#7824` to the security-hook adapter issue `#515`, keeping `#7824` only for configuration-directory lockdown documentation.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


15. Read-only agent pilots cannot run ✗ Dismissed
Description
buildHarness adds OpenCode’s environment mapping without changing the default-enabled security
setting, and OpenCodeRuntime.Run rejects the resulting nonempty HooksSettingsPath. The existing
read-only agents review and triage harnesses also omit a security override, so selecting OpenCode
for either—or using a generated read-only harness with that default—fails before the agent command
starts.
Code

internal/runtime/opencode_run.go[R480-482]

+	if params.HooksSettingsPath != "" && len(openCodeHooksExtensionBytes()) == 0 {
+		return -1, fmt.Errorf("opencode run: hooks adapter not yet available (tracked in unbound-force#515)")
+	}
Evidence
Security is enabled when its setting is omitted, causing the CLI to pass a hooks settings path that
OpenCodeRuntime.Run rejects before execution. Both cited read-only agents harnesses omit an
override, while buildHarness retains the same default for generated harnesses; the runtime guide
identifies the missing setting as a required manual change.

fullsend -> agents
internal/runtime/opencode_run.go[480-482]
internal/harness/harness.go[245-251]
internal/cli/run.go[2563-2568]
internal/agentnew/render.go[127-174]
internal/harness/harness.go[245-250]
internal/cli/run.go[2566-2579]
internal/runtime/opencode_run.go[460-481]
docs/runtimes/opencode.md[130-134]
External repo: fullsend-ai/agents, harness/review.yaml [12-16]
External repo: fullsend-ai/agents, harness/triage.yaml [12-16]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Existing and generated read-only OpenCode harnesses retain default-enabled security, which the runtime rejects before execution until its hooks adapter is available.

## Fix Focus Areas
- internal/runtime/opencode_run.go[480-482]
- /cross_repos/agents/harness/review.yaml[12-16]
- /cross_repos/agents/harness/triage.yaml[12-16]
- internal/agentnew/render.go[127-174]
- internal/agentnew/render_test.go[1-100]

## Recommended Fix
Before selecting OpenCode for the existing read-only `agents` review and triage harnesses, coordinate dedicated pilot settings that explicitly disable security for those harnesses, or defer selection until the hooks adapter is installed. For supported generated read-only OpenCode roles, emit `security.enabled: false` and test that setting. Do not disable security on write-capable harnesses; continue rejecting those roles until their hooks adapter exists.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


16. Corrupt transcripts can appear clean ✗ Dismissed
Description
parseOpenCodeTranscriptFile discards both the parser error and malformed-line count before using
the synthesized result as its verdict. A malformed event alongside a valid completed step can
consequently produce IsError: false for the transcript artifact, even though the live run
separately detects malformed lines.
Code

internal/runtime/opencode_transcript.go[127]

+	_, _, _ = parseOpenCodeStream(bytes.NewReader(data), func(evt AgentEvent) {
Evidence
Transcript replay ignores the parser's returned corruption signals. The parser counts malformed
events independently of the completed-turn result, so that result alone cannot establish a clean
artifact.

internal/runtime/opencode_transcript.go[117-140]
internal/runtime/opencode_progress.go[153-159]
internal/runtime/opencode_progress.go[238-244]
internal/cli/run.go[2645-2652]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Transcript replay ignores parse failures and malformed events when classifying an artifact.
## Fix Focus Areas
- internal/runtime/opencode_transcript.go[117-140]
- internal/runtime/opencode_progress.go[133-159]
## Recommended Fix
Retain the parser error and malformed-line count; return an error verdict when either is present, including when otherwise valid events produce a completed turn.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Informational

17. Agent-check failures give no reason ✗ Dismissed
Description
openCodeVerifyAgent runs opencode debug agent ... 2>/dev/null, then on a non-zero exit builds
its error from stderr, which is therefore always empty. When Bootstrap's agent verification fails,
for example because of a frontmatter parse error or a missing provider config, the operator sees
only exited N: with no diagnostic.
Code

internal/runtime/opencode_bootstrap.go[R414-426]

+		shellQuote(r.ConfigDir()),
+		shellQuote(openCodeValidatedArg(agentName)))
+	stdout, stderr, exitCode, err := sandbox.Exec(sandboxName, cmd, 30*time.Second)
+	if err != nil {
+		return fmt.Errorf("verifying opencode agent %q: %w", agentName, err)
+	}
+	if exitCode != 0 {
+		return fmt.Errorf("opencode debug agent %q exited %d: %s", agentName, exitCode, strings.TrimSpace(sanitizeOutput(stderr)))
+	}
+	out := strings.TrimSpace(sanitizeOutput(stdout))
+	if !strings.Contains(out, `"mode":"primary"`) && !strings.Contains(out, `"mode": "primary"`) {
+		return fmt.Errorf("opencode agent %q did not load as mode:primary (got: %s); OpenCode may have fallen back to its default agent", agentName, out)
+	}
Evidence
The command string redirects stderr to /dev/null, but the exit-code branch formats
sanitizeOutput(stderr) into the error. That value cannot contain anything.

internal/runtime/opencode_bootstrap.go[413-431]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`openCodeVerifyAgent` throws away stderr with `2>/dev/null` but then reports the empty stderr when the command fails.

## Fix Focus Areas
- internal/runtime/opencode_bootstrap.go[413-431]

## Recommended Fix
Remove `2>/dev/null` from the command so `sandbox.Exec` captures stderr separately. Keep parsing stdout for the mode check, and include the sanitized stderr in the non-zero-exit error.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


18. Image header says musl, install is glibc ✓ Resolved
Description
The Containerfile header comment says OpenCode is installed as a 'SHA256-verified static musl
build'. The install block below fetches the glibc tarballs and says the musl builds cannot run in
the Debian base image. Someone bumping OPENCODE_VERSION from the header comment could pick the
musl artifact and checksum, which would break the image.
Code

images/sandbox/Containerfile[R13-15]

+#   - OpenCode (GitHub release, SHA256-verified static musl build via
+#     OPENCODE_VERSION + per-arch checksum ARGs; opt-in runtime, see
+#     unbound-force#510)
Evidence
Lines 13-15 say 'static musl build', while lines 333-335 say glibc builds are used because the musl
tarballs dynamically link libc.musl.

images/sandbox/Containerfile[13-15]
images/sandbox/Containerfile[332-347]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The Containerfile header comment calls the OpenCode install a static musl build, but the install block uses glibc release tarballs.

## Fix Focus Areas
- images/sandbox/Containerfile[13-15]

## Recommended Fix
Change the header to 'OpenCode (GitHub release, SHA256-verified glibc build via OPENCODE_VERSION + per-arch checksum ARGs; opt-in runtime, see unbound-force#510)'.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Context sources
✅ Compliance rules (platform): 96 rules
✅ Skills: 5 invoked
  writing-user-docs
  writing-adrs
  check-patch-coverage
  cutting-releases
  adr-corner
✅ Cross-repo context — repo relationships
  Explored: repo: fullsend-ai/.fullsend (sha: 7c163cad) — View relationship
  Explored: repo: fullsend-ai/agents (sha: a159f388) — View relationship
  Explored: repo: fullsend-ai/mlflow-assessments (sha: 2fdb0120) — View relationship
Review mode: Auto: 🧠 Deep: Large runtime integration spans security, permissions, execution, configuration, and transcripts.

Grey Divider

Tip of the day
💡 Did you know, you can pick a display mode instead of tweaking every Display option by hand

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

Comment thread internal/cli/run.go Resolved
Comment thread internal/runtime/opencode_run.go Resolved
Comment thread internal/runtime/opencode_run.go Resolved
Comment thread docs/runtimes/opencode.md Resolved
Comment thread docs/runtimes.md Resolved
Comment thread internal/runtime/opencode_run.go Resolved
Comment thread internal/runtime/opencode_bootstrap.go Resolved
Comment thread images/sandbox/Containerfile Resolved
Comment thread internal/runtime/opencode_integrity.go Resolved
Comment thread internal/runtime/opencode_run.go Resolved
@github-actions

github-actions Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Site preview

Preview: https://00e98998-site.fullsend-ai.workers.dev

Commit: a638f511f47926665a6d81a7cd9053e608f28ce4

@codecov

codecov Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

@fullsend-ai-review fullsend-ai-review Bot added the risk/moderate PR risk: moderate label Oct 15, 2026
@fullsend-ai-review

fullsend-ai-review Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Risk Assessment: moderate (2/5)

Details

Large additive runtime implementation touching one protected path (Containerfile) with moderate churn in existing docs and config, mitigated by opt-in configuration safety, solid test coverage, and established author history.

Previous run

Risk Assessment: moderate (2/5)

Details

Large additive runtime implementation touching one protected path (Containerfile) with moderate churn in existing docs and config, mitigated by opt-in configuration safety, solid test coverage, and established author history; incremental update of ~127 lines across 5 files preserves the moderate risk profile.

Previous run (2)

Risk Assessment: moderate (2/5)

Details

Large additive runtime implementation touching one protected path (Containerfile) with moderate churn in existing docs and config, mitigated by opt-in configuration safety, solid test coverage, and established author history.

Previous run (3)

Risk Assessment: moderate (2/5)

Details

Large additive runtime implementation touching one protected path (Containerfile) with moderate churn in existing docs and config, mitigated by opt-in configuration safety, solid test coverage, and established author history.

Previous run (4)

Risk Assessment: moderate (2/5)

Details

Large additive runtime implementation touching one protected path (Containerfile) with moderate churn in existing docs and config, mitigated by opt-in configuration safety, solid test coverage, and established author history.

Previous run (5)

Risk Assessment: moderate (2/5)

Details

Large additive runtime implementation touching one protected path (Containerfile) with moderate churn in existing docs and config, mitigated by opt-in configuration safety, solid test coverage, and established author history.

@fullsend-ai-review

fullsend-ai-review Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Review

Findings

High

  • [permission-expansion] internal/runtime/opencode_bootstrap.go:139 — An agent declaring Bash(gh,jq) receives the unrestricted bash permission, with only a warning that its command allowlist is not enforced. The trusted OPENCODE_CONFIG_CONTENT policy is intersected with the agent's tool permissions, but it need not contain equivalent command restrictions, so an agent's explicit command restriction can become arbitrary shell execution. The hook adapter tracked in feat(runtime/opencode): implement hook adapter plugin for sandbox security enforcement #7824 is not installed by this change.
    Remediation: Reject agents with non-empty BashAllowlist until equivalent command restrictions can be enforced, or translate and enforce those restrictions without widening them.

Medium

  • [secret-exposure] internal/runtime/opencode_run.go:424 — The OpenCode stream is copied directly into the host OutputPath without credential redaction. The sandbox transcript tee and downloaded debug log are also unredacted. Tool titles, tool errors and provider error messages receive redactSummary protection when parsed for display, but that does not cover these persisted artifacts. Tracked separately in fix(runtime): add credential redaction to OpenCode and pi output artifact streams #7320.
    Remediation: Apply the shared secret redactor before persisting the host output stream, extracted transcripts, and debug logs, with tests covering credentials in each artifact path.
  • [stale-doc] docs/guides/user/running-agents-locally.md:324 — Section states Fullsend 'also has two opt-in runtimes — pi and codex', omitting the newly introduced opencode opt-in runtime.
    Remediation: Update the count and list of opt-in runtimes to include opencode alongside pi and codex.
  • [stale-doc] docs/guides/getting-started/configuring-gitlab.md:341 — Choosing-a-runtime text states 'claude is the stable default; pi and codex are experimental', omitting opencode.
    Remediation: Update the sentence to include opencode among experimental runtimes.
  • [stale-doc] docs/contributing/sandbox-topology.md:15 — Table of additions in fullsend-sandbox lists Claude Code, pi and Codex but not OpenCode, which images/sandbox/Containerfile installs in this change.
    Remediation: Update the 'Key additions over parent' column for fullsend-sandbox to mention OpenCode (pinned; opt-in runtime).
  • [missing-doc] docs/guides/user/bring-your-own-agent.md:90 — The 'Pick a route' table lists agent creation routes for Claude, codex and pi but not routes using the new opencode runtime supported by 'fullsend agent new --runtime opencode'.
    Remediation: Add row(s) to the table covering OpenCode routes with required credentials and flags.
  • [protected-path] images/sandbox/Containerfile — The PR modifies a protected path: images/sandbox/Containerfile (under the protected images/ prefix; adds the pinned, SHA-256 verified OpenCode install). The PR links related issue Track opencode as a supported agent runtime #1260 and explains the rationale, so context is sufficient, but human approval is always required for protected-path changes regardless of context.

Low

  • [edge-case] internal/runtime/opencode_run.go:404 — The per-iteration agent restoration runs before the context-aware execution and does not receive ctx. Its cleanup, upload and verification use sandbox operations backed by context.Background(), so cancelling Run still lets them continue until their independent timeouts expire; this preparation also falls outside params.Timeout.
    Remediation: Thread the run context and iteration deadline through agent restoration, upload and verification using context-aware sandbox operations. Add a cancellation test with a stalled restoration command.
  • [logic-error] internal/runtime/opencode_bootstrap.go:330 — trustedRulesFor stops parsing a trusted rule's pattern map at the first token or decode error (break) and skips a rule whose value is neither a string nor an object (continue), so a malformed trusted rule is silently dropped rather than rejected.
  • [permission-expansion] internal/scaffold/fullsend-repo/profiles/fullsend-vertex-ai.yaml:25 — The Vertex inference profile now admits processes matching **/opencode in addition to its existing runtime binaries. This intentionally expands access to the existing Anthropic and Google API endpoints for the OpenCode runtime requested by Track opencode as a supported agent runtime #1260; endpoint scope and credential-inspection settings are unchanged. An exact installed-binary path would be narrower than the basename glob.
  • [backward-incompatible] internal/scaffold/fullsend-repo/profiles/fullsend-vertex-ai.yaml:25 — The scaffolded fullsend-vertex-ai profile now allows **/opencode in binaries:. The scaffold test comment says the profile must stay in sync with the fullsend-ai/agents copy, a cross-repo contract. Adopters who already scaffolded the profile, and that agents-repo copy, lack the entry until synced, so OpenCode runs on them would hit policy_denied on the first model call. Only an allowance is added; existing runtimes are unaffected.
    Remediation: Mirror the **/opencode entry in the fullsend-ai/agents profile copy and note the required profile update in release notes or the upgrade guide.
  • [stale-doc] docs/guides/infrastructure/distributed-tracing.md:507 — Telemetry docs say the runner writes TRACEPARENT into iteration.env 'so local runtimes (claude, pi, codex) can attach their telemetry to that span', omitting opencode.
    Remediation: Include opencode in the list of local runtimes, or clarify runtime telemetry support for opencode.
  • [stale-doc] docs/guides/dev/behaviour-testing.md:94 — The runtime-specific behaviour testing guide enumerates agent definition steps for pi, codex and claude, but omits the new step 'And an opencode agent "" defined as:'.
    Remediation: Add that step to the list of runtime agent definition steps.

Earlier findings

  • f_61ee0fae47b59adc — resolved_by_change: the latest commit adds opencode.json to openCodeOverridePaths, so the previous iteration's agent-writable config is cleared before opencode debug agent runs (opencode_run.go, opencode_test.go).
  • f_343b6d2e289f1863 — reclassified (info): intersectPermissionRecord keeps the agent's own action for a tool that no trusted rule matches; missing, empty and malformed global permission policies are rejected at bootstrap, so the unmatched-tool case is the only remaining pass-through.
  • f_2b419ce1f4189acb — reclassified (info): openCodeValidatedArg follows the private-helper naming used in internal/runtime/; informational only.
  • f_3beaaf8459ef6596 — reclassified (info): An unmapped effort is reported with fmt.Fprintf(os.Stderr, ...) because the printer is not threaded through the command builder helpers; informational only.
  • f_53a51dae07978b52 — reclassified (info): Run tests live in opencode_bootstrap_test.go, mirroring pi_bootstrap_test.go; informational only.

Labels: The PR adds a new opt-in agent runtime, which is a feature.


Next steps:

  • /fs-fix — agent addresses review findings automatically
  • /fs-fix <your instruction> — agent fixes with your specific guidance
  • Push commits directly — review re-runs automatically on push
  • /fs-fix-stop — disable automatic fix runs for this PR
Previous run

Review

Findings

High

  • [permission-expansion] internal/runtime/opencode_bootstrap.go:139 — Agents declaring a restricted Bash allowlist (e.g. Bash(gh,jq)) are accepted with only a warning; the per-command restriction is dropped and Bash is mapped to a bare bash: allow. The only remaining cap is the trusted OPENCODE_CONFIG_CONTENT policy, and with no hook adapter nothing enforces the restriction later.
    Remediation: Reject agents with Bash argument restrictions until they can be enforced, or translate them into an OpenCode bash pattern map that does not broaden access.

Medium

  • [secret-exposure] internal/runtime/opencode_run.go:424 — The host output file receives the raw stream through io.TeeReader before parsing or redaction; the sandbox transcript tee and debug log also keep raw content. OpenCode requires security.enabled:false, which also skips the runner's post-agent output scan, so credentials in tool output can remain in collected artifacts.
    Remediation: Redact output.jsonl, extracted transcripts and debug logs regardless of whether the sandbox hook is enabled, including on failure paths.
  • [privilege-escalation] internal/runtime/opencode_run.go:551 — restoreOpenCodeAgent runs opencode debug agent before the runner rewrites opencode.json. The reset now also removes plugin/, plugins/ and skill/, but not the agent-writable opencode.json from the previous iteration, and verification runs without the trusted OPENCODE_CONFIG_CONTENT.
    Remediation: Remove or restore opencode.json before invoking opencode debug agent, run verification with the runner-held trusted environment, and add a regression test.
  • [protected-path] images/sandbox/Containerfile — The PR modifies a protected path (installs the pinned, SHA-256-verified OpenCode binary). The PR links Track opencode as a supported agent runtime #1260 and explains the rationale, but human approval is always required for protected-path changes regardless of context.
  • [stale-doc] docs/guides/user/running-agents-locally.md:324 — 'Choosing the runtime' lists only pi and codex as opt-in runtimes and omits OpenCode.
    Remediation: List OpenCode alongside pi and codex and link docs/runtimes/opencode.md#run-it-locally.
  • [stale-doc] docs/guides/getting-started/configuring-gitlab.md:341 — 'Choosing a runtime' says pi and codex are experimental, omitting opencode (the GitHub guide was updated).
    Remediation: State that pi, codex and opencode are experimental opt-in runtimes.
  • [stale-doc] docs/contributing/sandbox-topology.md:15 — The fullsend-sandbox key additions omit OpenCode, now installed by the Containerfile.
    Remediation: Add OpenCode to the key additions.
  • [missing-doc] docs/guides/user/bring-your-own-agent.md:90 — The 'Pick a route' table has no OpenCode on Vertex row.
    Remediation: Add a row documenting --runtime opencode, the vertex-ai provider and the required env vars, including OPENCODE_CONFIG_CONTENT.

Low

  • [edge-case] internal/runtime/opencode_run.go:404 — Per-iteration agent restoration takes no ctx and runs outside the iteration timeout (fixed sandbox.Exec timeouts), so its time is added on top of params.Timeout and cancellation cannot interrupt it.
    Remediation: Set the iteration deadline before restoration, propagate ctx, and give the streaming execution only the remaining budget.
  • [permission-expansion] internal/scaffold/fullsend-repo/profiles/fullsend-vertex-ai.yaml:25 — **/opencode grants inference-endpoint access to any executable with that basename; the list already allows **/node, **/claude and **/pi with the same scope, so exposure added is small.
    Remediation: Consider pinning /usr/local/bin/opencode (and tightening the sibling entries consistently).
  • [backward-incompatible] internal/scaffold/fullsend-repo/profiles/fullsend-vertex-ai.yaml:25 — Additive, but repos with a customized copy of this profile will not get the **/opencode entry and OpenCode runs on Vertex there will be blocked.
    Remediation: Mention the profile update in release notes or upgrade docs.
  • [stale-doc] docs/guides/infrastructure/distributed-tracing.md:507 — Runtime list for .fullsend/iteration.env omits opencode.
    Remediation: Include opencode in the list.
  • [stale-doc] docs/guides/dev/behaviour-testing.md:94 — 'Runtime steps' omits the new opencode agent step and opencode.feature.
    Remediation: Document the opencode step and reference features/runtime/opencode.feature.

Earlier findings

  • f_94cb64863c927b5f — resolved_by_change: validateOpenCodePermissionPolicy now rejects duplicate permission keys (openCodeDuplicateKey, with test) in commit e310a78.
  • f_c3254dcb2646d99a — reclassified to low: only purely numeric pattern keys in an operator-written policy diverge from OpenCode's ordering.
  • f_343b6d2e289f1863 — reclassified (info): code unchanged; behaviour is documented and bounded by the operator-owned policy.
  • f_3beaaf8459ef6596 — reclassified (info): pi and codex runtimes emit such warnings directly to os.Stderr too.
  • f_2b419ce1f4189acb — reclassified (info): naming is cosmetic; the doc comment states the behaviour.
  • f_53a51dae07978b52 — reclassified (info): no *_run_test.go convention exists in internal/runtime.

Next steps:

  • /fs-fix — agent addresses review findings automatically
  • /fs-fix <your instruction> — agent fixes with your specific guidance
  • Push commits directly — review re-runs automatically on push
  • /fs-fix-stop — disable automatic fix runs for this PR
Previous run (2)

Review

Findings

High

  • [permission-expansion] internal/runtime/opencode_bootstrap.go:139 — Bootstrap continues after discarding Bash argument restrictions (it only prints a warning). For example, Bash(gh,jq) becomes unrestricted bash whenever the trusted policy allows bash generally, so an agent described as read-only can run arbitrary commands, including filesystem writes, even though edit/write are denied. The trusted-policy intersection protects explicit global restrictions but does not preserve this separate agent restriction. Unchanged in the latest push.
    Remediation: Reject agents with BashAllowlist restrictions until they can be enforced, or translate them and enforce their intersection with the trusted command policy. A warning alone should not authorize the broader capability.

Medium

  • [secret-exposure] internal/runtime/opencode_run.go:424 — The host output artifact receives the raw OpenCode stream before parsing or redaction, and the sandbox transcript and debug log are persisted/downloaded without redaction. OpenCode currently requires security.enabled:false, which also skips the runner's post-run output scan, so credentials echoed by a read-only tool or the model can remain in uploaded artifacts.
    Remediation: Apply host-side secret filtering, independent of sandbox-hook availability, to output.jsonl, extracted transcripts, debug logs and emitted text/reasoning.

  • [privilege-escalation] internal/runtime/opencode_run.go:538 — The iteration reset removes agent/tool/config overrides but leaves plugin/ and plugins/ in the agent-writable config dir. A plugin left by a previous iteration can execute when restoreOpenCodeAgent runs opencode debug agent during verification, before the run prelude's checks.
    Remediation: Disable local plugin discovery, or remove untrusted plugin directories before any OpenCode invocation; load only runner-held, integrity-verified plugins from a protected directory once supported.

  • [logic-error] internal/runtime/opencode_bootstrap.go:305 — New in this push. Duplicate pattern keys inside one trusted pattern map change permission semantics during translation. The validated policy {"bash":{"*":"allow","rm ":"deny","":"allow"}} becomes {"rm ":"deny","":"allow"}: JavaScript JSON.parse keeps a duplicate key's original position with the last value, so OpenCode's global policy denies rm *, but trustedRulesFor's add deletes the earlier entry and appends the duplicate, moving the wildcard last. The translated agent rule then allows rm * and, since agent rules are evaluated after global ones, widens the trusted policy. validateOpenCodePermissionPolicy decodes into a map and silently accepts duplicates. Reachable only through an operator-authored policy with duplicate keys, but the effect silently weakens an explicit deny.
    Remediation: Reject duplicate argument-pattern keys (and duplicate tool keys) during validation, e.g. with a token-stream duplicate check in validateOpenCodePermissionPolicy, or apply JS duplicate-property semantics (first position, last value) inside each object before flattening. Add a regression test comparing effective decisions rather than JSON equality.

  • [permission-expansion] internal/runtime/opencode_bootstrap.go:308 — New in this push. trustedRulesFor aggregates every matching tool key, including duplicate tool keys that last-key-wins JSON decoding discards. {"permission":{"*":"deny","bash":{"curl *":"allow"},"bash":{"ls *":"allow"}}} passes validation (map decode keeps only the final bash), but parseTrustedPermissionPolicy keeps both entries and the agent bash map ends up allowing both curl and ls. OpenCode's own global policy keeps only ls *, so the overwritten curl allowance is resurrected through the agent record. The previous trustedRuleFor (last match only) agreed with JS, so this is a regression from the rewrite. Reachable only through an operator-authored trusted policy (OPENCODE_CONFIG_CONTENT is pinned and restored by the runner), so it is an accidental widening of operator intent rather than an externally exploitable escalation.
    Remediation: Reject duplicate permission keys during validation, or normalize duplicate keys to runtime semantics before aggregating. Add a regression test with duplicate bash objects carrying disjoint allow patterns.

  • [protected-path] images/sandbox/Containerfile — This PR modifies a protected path (images/sandbox/Containerfile: installs the pinned, SHA-256 verified OpenCode binary). The description links the tracking issue (Track opencode as a supported agent runtime #1260) and explains the rationale, but human approval is always required for protected-path changes regardless of context.

  • [stale-doc] docs/guides/user/running-agents-locally.md:324 — 'Choosing the runtime' still says Fullsend has 'two opt-in runtimes — pi and codex', omitting OpenCode (runtime: opencode).
    Remediation: Mention OpenCode alongside pi and codex.

  • [stale-doc] docs/guides/getting-started/configuring-gitlab.md:341 — The runtime sentence ('claude is the stable default; pi and codex are experimental') omits opencode.
    Remediation: Add opencode to the experimental runtimes.

  • [stale-doc] docs/contributing/sandbox-topology.md:15 — The fullsend-sandbox row lists Claude Code, pi and Codex but omits OpenCode, which images/sandbox/Containerfile now installs.
    Remediation: Add OpenCode (pinned; opt-in runtime) to the row.

  • [missing-doc] docs/guides/user/bring-your-own-agent.md:90 — The 'Pick a route' table has Claude, Codex and Pi rows but no OpenCode-on-Vertex-AI row.
    Remediation: Add a row for OpenCode on Vertex AI (--runtime opencode) with its provider requirements and environment variables.

Low

  • [edge-case] internal/runtime/opencode_run.go:404 — Agent restoration (restoreOpenCodeAgent) runs before the context-aware execution timeout starts and does not receive the caller's context; sandbox.Exec and the upload use background contexts. A cancelled run still performs restoration and a stalled restoration can exceed params.Timeout.
    Remediation: Establish the iteration deadline before restoration and pass its context through restoration and verification.

  • [error-handling-idiom] internal/runtime/opencode_run.go:223 — buildOpenCodeRunCommand writes the unsupported-effort warning with fmt.Fprintf(os.Stderr, ...) instead of the ui.Printer StepWarn + sanitizeOutput idiom used by sibling runtimes (codex_run.go:570, pi_run.go:1076).
    Remediation: Use the printer warning idiom with sanitizeOutput as in codex_run.go / pi_run.go.

  • [naming-convention] internal/runtime/opencode_run.go:341 — openCodeValidatedArg strips disallowed runes rather than validating; a verb-phrase name such as openCodeSanitizeArg matches repository idiom (sanitizeOutput).
    Remediation: Rename to openCodeSanitizeArg.

  • [stale-doc] docs/guides/infrastructure/distributed-tracing.md:507 — Lists local runtimes '(claude, pi, codex)' that get TRACEPARENT in iteration.env, omitting opencode (docs/cli/run.md lists it).
    Remediation: Update the list to (claude, pi, codex, opencode).

  • [stale-doc] docs/guides/dev/behaviour-testing.md:94 — Runtime steps list only pi, codex and claude agent steps; opencode and features/runtime/opencode.feature are not mentioned.
    Remediation: Reference opencode and its capability tag/feature file.

  • [backward-incompatible] internal/scaffold/fullsend-repo/profiles/fullsend-vertex-ai.yaml:25 — The scaffold Vertex profile now allows **/opencode in binaries. The fleet copy in fullsend-ai/agents is separate (TestScaffoldVertexProfile_BinaryAllowlist notes they must stay in sync); until it has the entry, an OpenCode run using the fleet profile may fail with policy_denied. Unverified from this repo.
    Remediation: Land the matching entry in fullsend-ai/agents or note the dependency in the PR description.

Earlier findings

  • f_2d973c49f7132d8f — resolved_by_change: trustedRuleFor replaced by trustedRulesFor, which keeps earlier fallback rules for a partial pattern map (opencode_bootstrap.go, regression case in opencode_test.go). See the new duplicate-key findings above for a regression in the rewrite.
  • f_343b6d2e289f1863 — reclassified low → info: absent/malformed trusted policy is rejected before the intersection (opencode_integrity.go).

Next steps:

  • /fs-fix — agent addresses review findings automatically
  • /fs-fix <your instruction> — agent fixes with your specific guidance
  • Push commits directly — review re-runs automatically on push
  • /fs-fix-stop — disable automatic fix runs for this PR
Previous run (3)

Review

Findings

High

  • [permission-expansion] internal/runtime/opencode_bootstrap.go:138 — A command-restricted Bash allowlist still produces only a warning and becomes unrestricted bash unless the operator separately supplies an equivalent trusted pattern policy. For example, an agent limited to Bash(gh,jq) gains arbitrary shell execution when the trusted policy permits bash. Intersecting with the global policy does not preserve the agent's narrower command restriction.
    Remediation: Reject agents with BashAllowlist restrictions until those restrictions can be enforced, or translate and enforce their command restrictions in addition to the trusted policy.

Medium

  • [secret-exposure] internal/runtime/opencode_run.go:424 — The host output file receives the raw NDJSON stream through io.TeeReader. Tool titles and errors are redacted only after this copy is written; text, reasoning, other tool-state fields, the separately downloaded transcript, and the debug log are not protected by that parser redaction. The required security.enabled:false workaround also skips the runner's subsequent scanOutputFiles pass, leaving credentials contained in these artifacts unredacted.
    Remediation: Apply secret redaction independently to stored stream, transcript, and debug artifacts without requiring sandbox hooks or security.enabled:true.
  • [privilege-escalation] internal/runtime/opencode_run.go:537 — The iteration reset removes tool, command, config, model-cache, and auth overrides and checks the selected agent file after sourcing .env. However, plugin/ and plugins/ remain writable and outside the reset/integrity checks (the code comment says they stay writable until feat(runtime/opencode): implement hook adapter plugin for sandbox security enforcement #7824). A previous iteration or agent-written .env can leave executable OpenCode plugins there; verifying only the selected agent Markdown does not prevent those plugins from executing on subsequent OpenCode invocations and circumventing its tool-permission policy.
    Remediation: Remove untrusted plugin directories before every OpenCode invocation, or make plugin discovery runner-owned and verify an explicit immutable plugin inventory.
  • [logic-error] internal/runtime/opencode_bootstrap.go:296 — trustedRuleFor selects the last matching tool key without considering the argument patterns inside its value. OpenCode selects the last rule matching both the tool and the argument, so earlier matching tool rules can still apply. For example, with permission {"*":"allow","bash":{"rm *":"deny"}}, an agent declaring Bash should retain permission for ls. This code copies only the partial bash map into the agent record; the agent's own wildcard deny then rejects ls. Valid policies with partial pattern overrides consequently lose allowed tool operations (fails closed, but incorrect).
    Remediation: Build each declared tool's effective pattern policy from all matching trusted tool rules, preserving their evaluation order and earlier fallback rules. Add tests for partial pattern maps following flat wildcard rules and overlapping tool globs.
  • [stale-doc] docs/guides/user/running-agents-locally.md:324 — Section 'Choosing the runtime' says Fullsend 'has two opt-in runtimes — pi and codex', but OpenCode is now an additional opt-in runtime (--runtime opencode). The file is not modified by this PR.
    Remediation: Update lines 324–350 to mention OpenCode alongside pi and codex, add an example invocation (--runtime opencode), and cross-reference docs/runtimes/opencode.md.
  • [stale-doc] docs/guides/getting-started/configuring-gitlab.md:340 — Section 'Choosing a runtime' says 'claude is the stable default; pi and codex are experimental', omitting opencode, which is now a valid experimental runtime in config.ValidRuntimes(). The PR updated the matching sentence in configuring-github.md but not this one.
    Remediation: Update the parenthetical on line 340 to include opencode among the experimental runtimes.
  • [stale-doc] docs/contributing/sandbox-topology.md:15 — The Sandbox Image Topology table lists 'Claude Code, pi (pinned; opt-in runtime, Track pi (earendil-works/pi) as a supported agent runtime #6464), Codex (pinned; opt-in runtime, Track Codex (openai/codex) as a supported agent runtime — same secretless GPT path as pi, pinned in the sandbox image #6920)' as key additions over parent for fullsend-sandbox, but images/sandbox/Containerfile now installs OpenCode as well.
    Remediation: Update the 'Key additions over parent' column for fullsend-sandbox on line 15 to include OpenCode.
  • [missing-doc] docs/guides/user/bring-your-own-agent.md:90 — The 'Pick a route' table documents agent creation flags, providers, and environment variables for Claude, Codex, and Pi, but has no entry for OpenCode on Vertex AI (--runtime opencode), which agent new / internal/agentnew now support.
    Remediation: Add an 'OpenCode on Vertex' row documenting --runtime opencode, the harness providers, and the Vertex AI environment variables.
  • [protected-path] images/sandbox/Containerfile — This PR modifies a protected path (images/sandbox/Containerfile, covered by the images/ prefix) to install a pinned, SHA-256 verified OpenCode. The PR links related issue Track opencode as a supported agent runtime #1260 and explains the rationale, but human approval is always required for protected-path changes regardless of context.

Low

  • [edge-case] internal/runtime/opencode_run.go:404 — Agent restoration runs before the context-aware execution step without receiving ctx or the iteration timeout. Its cleanup and verification use sandbox.Exec with fixed timeouts, and the upload is likewise independent of ctx. Cancelling a run can leave it performing sandbox operations until their individual timeouts expire; restoration also adds time outside params.Timeout.
    Remediation: Propagate the run context and remaining iteration budget through restoration, upload, and verification, and stop immediately when the context is cancelled.
  • [fail-open] internal/runtime/opencode_bootstrap.go:326 — A missing trusted rule for a tool preserves the agent's allow action. Whole-config absence, empty permission objects, and invalid actions are rejected by validateOpenCodeTrustedEnv, but omission of an individual tool rule is not fail-closed: with an agent declaring Bash and a trusted policy of {"read":"allow"}, bash:"allow" is emitted. The omission can only come from operator misconfiguration and grants nothing beyond OpenCode's built-in defaults, so this is defense-in-depth hardening.
    Remediation: Deny agent allow actions when no trusted rule matches, or require an explicit "*" default in the trusted policy; add a test covering a policy that omits a tool rule.
  • [error-handling-idiom] internal/runtime/opencode_run.go:222 — buildOpenCodeRunCommand writes a warning directly to os.Stderr via fmt.Fprintf when params.Effort has no --variant equivalent. Sibling runtimes (codex_run.go, pi_run.go) report this through printer.StepWarn with sanitizeOutput inside Run(), keeping command builders pure and warning output consistent.
    Remediation: Validate params.Effort in OpenCodeRuntime.Run using printer.StepWarn and sanitizeOutput(params.Effort), and remove the direct fmt.Fprintf side effect from buildOpenCodeRunCommand.
  • [naming-convention] internal/runtime/opencode_run.go:340 — openCodeValidatedArg strips disallowed characters from model/effort/agent names and returns a mutated string. Repo convention uses sanitize*/clean* for transform-and-strip helpers (sanitizeOutput, sanitizeDetail, sanitizeCodeLanguage) and validate* for functions returning bool/error.
    Remediation: Rename openCodeValidatedArg to openCodeSanitizedArg or sanitizeOpenCodeArg.
  • [stale-doc] docs/guides/infrastructure/distributed-tracing.md:507 — The guide says the runner writes TRACEPARENT into .fullsend/iteration.env 'so local runtimes (claude, pi, codex) can attach their telemetry to that span', omitting opencode.
    Remediation: Add opencode to the runtime list on line 507.
  • [stale-doc] docs/guides/dev/behaviour-testing.md:94 — The 'Runtime steps' section lists the pi, codex and claude agent steps but omits the new And an opencode agent "<name>" defined as: step, features/runtime/opencode.feature and the runtime-opencode capability.
    Remediation: Update line 94 to mention the opencode agent step, the feature file and the runtime-opencode capability.
  • [backward-incompatible] internal/scaffold/fullsend-repo/profiles/fullsend-vertex-ai.yaml:25 — The shared Vertex inference profile now allows **/opencode in its binaries: list, so every harness importing this embedded profile gets the wider allowlist whether or not it uses the opencode runtime. The profile is mirrored in fullsend-ai/agents, which must change too for opencode to work there.
    Remediation: Note the allowlist growth in release notes, sync the fullsend-ai/agents copy, and optionally move the opencode glob into an opencode-specific profile.

Earlier findings

  • f_4414f9627c5ebad7 — resolved_by_change: opencode_bootstrap.go:264-299 now applies trusted rules in config order with glob matching (last match wins). A separate partial-pattern composition issue is reported above as a new finding.
  • f_aa844693070eee5c — resolved_by_change: opencode_run.go:242-247 replaced the long inline comment with a concise one.
  • f_53a51dae07978b52 — reclassified (low → info): the cited sibling convention does not exist; no *_run_test.go files exist in internal/runtime, and pi keeps its Run tests in pi_bootstrap_test.go.

Labels: PR adds a new runtime with substantial documentation changes alongside the sandbox/runner code.


Next steps:

  • /fs-fix — agent addresses review findings automatically
  • /fs-fix <your instruction> — agent fixes with your specific guidance
  • Push commits directly — review re-runs automatically on push
  • /fs-fix-stop — disable automatic fix runs for this PR

fullsend-ai-review[bot]

This comment was marked as outdated.

fullsend-ai-review[bot]

This comment was marked as outdated.

Bootstrap/Run/ExtractTranscripts/ConfigDir for the OpenCode agent runtime,
mirroring the pi runtime pattern. Flip config.ValidRuntimes() to include
"opencode" so org/per-repo/per-agent config can select it.

What lands in this PR
- sandbox.SandboxOpenCodeConfig (/sandbox/opencode-config) — runner-owned
  config dir, off the agent-writable workspace. Path convention pinned by
  unbound-force#515 (hook adapter also lives here under plugins/).
- opencode.go: ConfigDir → SandboxOpenCodeConfig; EnvExports exports
  OPENCODE_CONFIG_DIR (runner-owned dir pointer), OPENCODE_CONFIG_CONTENT
  (Vertex provider + permission-deny config, merges last in opencode's config
  stack so it wins over any repo config), and GOOGLE_APPLICATION_CREDENTIALS;
  implements DebugLogNamer.
- opencode_bootstrap.go: Bootstrap() creates agent/, skills/, plugins/ under
  ConfigDir; translates the Claude-style agent .md to OpenCode's
  {agent,agents}/**/*.md layout with JSON frontmatter (mode: primary, tools
  as {toolID: bool}); uploads harness skills; preflights opencode --version.
  No ClaudeHooksBootstrap — hook adapter is unbound-force#515; plugin path
  reserved at ConfigDir/plugins/fullsend-hooks.ts with sha256 fail-closed
  guard shape (exit 97, before .env) for #515 to populate.
- opencode_run.go: buildOpenCodeRunCommand renders "opencode run --format json
  --model <provider/model> --variant <effort> --agent <name> <prompt>
  </dev/null"; honors RunParams.Prompt (feedback_mode); shell-escapes all
  interpolated values (sh -c boundary); emits InitEvent from RunParams.Model
  (wire format carries no model metadata); captures ResultEvent metrics;
  overrides exit 0 when the stream reports an error (same as pi).
- opencode_transcript.go: ExtractTranscripts downloads the tee'd output.jsonl
  (interim approach; full redesign → unbound-force#513); ParseTranscriptFile
  replays ndjson through parseOpenCodeStream for the exit-0 override;
  ExtractDebugLog downloads opencode-debug.log.
- config.ValidRuntimes(): adds "opencode"; all call sites that hardcoded
  "opencode" as a rejected stub updated to accept it or use "nonexistent"
  for the invalid-name coverage.
- docs/contributing/runtime-implementation.md: security matrix OpenCode
  column filled in (hooks: not wired / #515; transcripts: interim tee;
  host-side scans: runtime-agnostic). docs/runtimes.md: config-key table
  OpenCode column added; runtime table entry updated from "Stub" to
  "Implemented".
- 44 new tests; patch coverage on new opencode production files ≈ 82%.

What does NOT land (owned by unbound-force#515)
- Hook plugin adapter (tool.execute.before/after) — path reserved.
- SandboxHooksBootstrap type-assert in Bootstrap.
- ContextBridger: omitted — opencode reads AGENTS.md natively.

Phase 0 (opencode headless in sandbox) confirmed via unbound-force#509.
ConfigDir path + sha256 convention pinned per unbound-force#515 comment.

Signed-off-by: Yvonne Devlin <[email protected]>
… mechanics

Address PR #7103 review feedback from @waynesun09 and @qodo-code-review:

Security:
- Add OPENCODE_DISABLE_PROJECT_CONFIG=true to EnvExports (H1)
- Re-pin runner-owned env vars after .env source, mirroring pi/codex (H6)
- Migrate tools: to permission: field matching upstream schema (H3/H5)
- Fix LS tool mapping from "list" to "read" (H2)
- Add agent name validation in Bootstrap to prevent fallback (H7)

Run mechanics:
- Add clearStrayProcesses to ClearIterationArtifacts (H4)
- Move rc file under output/ so it is cleaned between iterations (H8)
- Make final exit conditional on prelude success (H8)
- Add --print-logs --log-level DEBUG when Debug is set (H9)
- Propagate stream parseErr to adjust exit code (B6)

Assisted-by: claude-opus
Signed-off-by: Yvonne Devlin <[email protected]>
Address PR #7103 review feedback from @waynesun09 and @qodo-code-review:

Docs:
- Add opencode to architecture.md runtime selection diagram (H11)
- Add opencode to layered-config-reference.md valid values (H11)
- Tick runtime-implementation.md checklist boxes (H11)
- Change "Experimental" to "Planned" callout for deferred features (B2)
- Fix "opt-in per org" to "opt-in per repo" per ADR 0044 (H10)
- Update tools: references to permission: in opencode.md (H3)

Config:
- Restore ADR 0044 deprecation guard in TestOrgConfigValidateRuntime (H10)
- Add write-agent note to ValidRuntimes doc comment (B14)

Image:
- Add OpenCode binary to base sandbox Containerfile (B12)

Assisted-by: claude-opus
Signed-off-by: Yvonne Devlin <[email protected]>
…ap, docs

- translateOpenCodeModel now consults RunParams.ModelAliases via
  mergedOpenCodeModelAliases(), matching pi's per-repo override pattern
- Add 'Agent' (current name) to openCodeToolForClaude map alongside
  legacy 'Task' alias so sub-agent dispatch is not silently dropped
- Add stderr warning when BashAllowlist is non-empty, matching
  codex_bootstrap.go pattern for operator visibility
- Remove stale 'list' from doc comment in opencode.go (LS maps to read)
- Fix opencode.md debug-log description to reflect --print-logs behavior
- Add tests for config alias merging and Agent tool mapping

Signed-off-by: Yvonne Devlin <[email protected]>
Add tests targeting uncovered error paths identified by Codecov patch
coverage analysis. Coverage now exceeds the 80% threshold for all
functions across the three flagged files.

Bootstrap tests:
- Agent name fallback from frontmatter/path when input name is empty
- Body-only agent (no frontmatter fences)
- Agent name sanitization failure
- Duplicate skill name detection (distinct paths, same basename)
- Empty skill path skip

Run tests:
- Debug mode (--print-logs, --log-level DEBUG)
- Fallback models warning
- Default handler when OnEvent is nil
- Error subtype in empty-message case

Transcript tests:
- Debug log download when debug is set
- ParseTranscriptErrors with non-existent dir
- ParseTranscriptErrors skips dirs and non-jsonl
- ExtractTranscripts probe exec error
- ExtractTranscripts path-traversal rejection

Signed-off-by: Yvonne Devlin <[email protected]>
- Permission record: resolve nil-vs-empty doc contradiction — both
  produce `"permission": {}` which OpenCode treats as "use defaults";
  doc now explains why this is acceptable (harness policy is the
  authoritative gate)
- Validated arg: narrow fallback claim for --agent — empty agent name
  uses default agent instead of bootstrap-generated one; callers
  should treat empty result as error
- InitEvent handler: add forward-compatibility comment explaining the
  branch is currently unreachable but guards against future wire-format
  revisions
- Debug log test: replace coverage-only `_ =` with real assertions
  (require.NoError + file content check)

Signed-off-by: Yvonne Devlin <[email protected]>
…penCode

- openCodePermissionRecord now initializes all 12 tool IDs as deny then
  overwrites allowed tools to allow, closing the widen-only gap (thread 5b)
- Run prelude writes runner-owned opencode.json to ConfigDir with
  config.instructions pointing at workspace AGENTS.md as an absolute path,
  bypassing OPENCODE_DISABLE_PROJECT_CONFIG discovery gate (thread 11)
- Doc comment at opencode.go corrected: re-exported so prelude inherits
  them, not asserted present (thread 13)
- openCodeConfigFile constant and openCodeInstructionsConfig helper added
  with tests

Signed-off-by: Yvonne Devlin <[email protected]>
OpenCode's built-in provider registry names the Vertex-backed Anthropic
provider "google-vertex-anthropic", not "anthropic-vertex". The latter
is Pi-specific (registered by its vendored pi-anthropic-vertex extension).
The OpenCode runtime copied the Pi constant, causing a
ProviderModelNotFoundError at startup.

Fixes #7103

Signed-off-by: Yvonne Devlin <[email protected]>
Addresses PR #7103 review feedback from @waynesun09 and @rh-hemartin.

Assisted-by: gpt-5.6-sol
Signed-off-by: Yvonne Devlin <[email protected]>
Addresses review-council findings for PR #7103.

Assisted-by: gpt-5.6-sol
Signed-off-by: Yvonne Devlin <[email protected]>
@fullsend-ai-review

fullsend-ai-review Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

🤖 Finished Review · ✅ Success · Started 10:50 PM UTC · Completed 11:04 PM UTC

Commit: cea91fd · View workflow run →

Runtime: pi · Model: sonnet → claude-sonnet-5-5 · Effort: high · Cost: $4.22

fullsend-ai-review[bot]

This comment was marked as outdated.

@fullsend-ai-review fullsend-ai-review Bot added the component/docs User-facing documentation label Oct 15, 2026
OpenCode matches both the tool and the argument pattern, so with
{"*":"allow","bash":{"rm *":"deny"}} it still allows ls. Copying
only the bash map let the agent's own "*": "deny" reject ls. Give a
declared tool every trusted rule that applies to it, in order.

Assisted-by: Claude
Signed-off-by: Wayne Sun <[email protected]>
@fullsend-ai-review

fullsend-ai-review Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

🤖 Finished Review · ✅ Success · Started 11:14 PM UTC · Completed 11:27 PM UTC

Commit: 1ebeacd · View workflow run →

Runtime: pi · Model: sonnet → claude-sonnet-5-5 · Effort: high · Cost: $3.29

fullsend-ai-review[bot]

This comment was marked as outdated.

… dirs

Go's ordered parse and OpenCode's JSON.parse read a permission object
with a repeated key differently, so the translated agent record could
widen the trusted policy. Reject duplicate keys in the trusted policy.

The runner installs no OpenCode plugins yet, so the per-iteration reset
now also clears plugin/, plugins/ and skill/. Only skills/, which holds
the runner's skills, stays writable until #7824.

Assisted-by: Claude
Signed-off-by: Wayne Sun <[email protected]>
@fullsend-ai-review

fullsend-ai-review Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

🤖 Finished Review · ✅ Success · Started 11:38 PM UTC · Completed 11:52 PM UTC

Commit: e310a78 · View workflow run →

Runtime: pi · Model: sonnet → claude-sonnet-5-5 · Effort: high · Cost: $4.32

fullsend-ai-review[bot]

This comment was marked as outdated.

…gent

opencode debug agent ran with the previous iteration's agent-writable
opencode.json. Clear it with the other overrides; the run prelude
writes the runner's copy after the reset.

Assisted-by: Claude
Signed-off-by: Wayne Sun <[email protected]>
@fullsend-ai-review

fullsend-ai-review Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

🤖 Finished Review · ✅ Success · Started 12:02 AM UTC · Completed 12:14 AM UTC

Commit: a638f51 · View workflow run →

Runtime: pi · Model: sonnet → claude-sonnet-5-5 · Effort: high · Cost: $2.99

@fullsend-ai-review fullsend-ai-review 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.

See the review comment for full details.

Comment thread internal/runtime/opencode_bootstrap.go Resolved
Comment thread internal/runtime/opencode_run.go Resolved
Comment thread internal/runtime/opencode_run.go Resolved
Comment thread internal/runtime/opencode_bootstrap.go Resolved
@fullsend-ai-review fullsend-ai-review Bot added the type/feature New capability request label Oct 16, 2026
@waynesun09

Copy link
Copy Markdown
Member Author

Moved back to #7103: its branch now has this exact head (a638f51), so it can be approved and merged there. Fix summary and test results are in a comment on #7103.

This branch was successfully deployed

1 active deployment
dev — a638f511 Deployed Oct 16, 2026 by waynesun09 via run / behaviour #4697
site-preview — a638f511 Deployed Oct 16, 2026 by github-actions[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component/docs User-facing documentation component/runner Agent runner behavior and lifecycle component/sandbox OpenShell sandbox environment fullsend-no-fix Skip bot-triggered fix agent runs risk/moderate PR risk: moderate type/feature New capability request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants