Repository navigation
Description
👤 User Story
As a
FullSend and uf contributor
I want to
FullSend's runtime registry to support OpenCode (opencode run) with a format-neutral transcript parser
So that
uf can run as the agent runtime instead of being locked to Claude Code, and PSDev can reuse the same upstream path
⚠️ Scope note (2026-08-27): This is a cross-org tracking/coordination story. All implementation lands infullsend-ai/fullsend(internal/runtime/); no code lands inunbound-force/unbound-force. The acceptance criteria and implementation notes below have been reconciled againstfullsendmain — the original body (stub runtime, ndjson parser,System()→anthropic, in-tree.opencode/ConfigDir) is superseded. See the "Original description (superseded)" comment below for the pre-reconcile text and rationale.
🎯 Acceptance Criteria
-
Comment on fullsend#1935 offering— done (em-redhat's comment, 2026-08-11); align on fullsend#1260 (still open, the tracking epic)parseOpenCodeStream+OpenCodeRuntime -
Bootstrap()implemented ininternal/runtime/opencode.go, mirroringpi_bootstrap.go -
Run()implemented, mirroringpi_run.go; callsopencode run --format jsonand streams viaparseOpenCodeStream() -
ExtractTranscripts()/ExtractDebugLog()implemented (interimoutput.jsonltee approach; full-fidelity redesign deferred to #513) -
ConfigDir()moved off the agent-writable/sandbox/workspace/.opencodeto a runner-owned directory (source comment atopencode.go:33says to do exactly this) - A ConfigDir sha256 checksum mismatch MUST fail closed (abort the run). Pin [Story] Close the OpenCode security-hook gap before write-capable agents #515's runner-owned ConfigDir path + sha256 integrity convention before coding the move.
-
config.ValidRuntimes()flipped to include"opencode"(currently["claude","pi","dummy"]) — without this, config validation rejects it (fullsend#6471) and runs fail fast (fullsend#6509) -
Run()emitsInitEventwith model fromRunParams.Model(the opencode ndjson wire format does not carry model/version) - Honor the required
RunParams.Prompt/validation_loop.feedback_modecontract (seedocs/runtimes.md; skipping it makesfeedback_mode: appenda silent no-op, fullsend#1050) - Unit tests: registry resolution, ndjson mapping (
text→ TextEvent, session start/end,step_finish→ ResultEvent),Bootstrap/Runhappy-path,ConfigDirpath assertion,ValidRuntimesflip (config_test.go:678-688) -
opencode_test.go: assertSystem() == "opencode"(multi-provider convention, matching pi'sSystem()=="pi") - Upstream PR lands (or is review-ready) in
fullsend-ai/fullsend— no long-lived fork
✅ Already merged upstream — do NOT re-implement
Verified against fullsend main (90ee8d6f):
- Stub runtime
internal/runtime/opencode.go+ registry case — fullsend#6035 - ndjson stream parser
opencode_progress.go(parseOpenCodeStream,--format json) — fullsend#6147 (fully tested; secret redaction already wired)
🚫 Out of Scope
- Per-harness runtime override (runtime is per-repo today)
- Claude-equivalent PreToolUse/PostToolUse hooks — owned by #515 (hook adapter + integrity gate)
- Dewey/Ollama in the sandbox
- uf BYOA harnesses themselves
- Full-fidelity
TranscriptHandlerredesign /TraceRecordIR design — deferred to #513; this story ships the interimoutput.jsonltee approach only ContextBridger— omit; OpenCode readsAGENTS.mdnatively (like pi)
🔗 Boundary with #515
- [Story] Contribute OpenCodeRuntime to FullSend #510 owns the runtime:
Bootstrap/Run/ExtractTranscripts, theConfigDirmove to a runner-owned dir, and the finalValidRuntimes()flip. - [Story] Close the OpenCode security-hook gap before write-capable agents #515 owns the hook contract + sha256 integrity gate + hook plugin adapter + nested sub-agent (Task) call coverage.
- Sequencing: [Story] Close the OpenCode security-hook gap before write-capable agents #515's runner-owned ConfigDir path convention + sha256 integrity convention MUST be pinned before [Story] Contribute OpenCodeRuntime to FullSend #510 codes the ConfigDir move (to avoid rework). [Story] Close the OpenCode security-hook gap before write-capable agents #515's full implementation still lands after [Story] Contribute OpenCodeRuntime to FullSend #510; only the convention is fixed first. No reordering — [Story] Contribute OpenCodeRuntime to FullSend #510 stays the keystone.
Dependencies
- Phase 0 GO on
opencode runin sandbox (gating prerequisite — do not start until confirmed) - [Story] Close the OpenCode security-hook gap before write-capable agents #515 ConfigDir path + sha256 convention pinned (see Boundary above)
Upstream PR 1. Comparable to Unbound Force #253 (council-review-action) and the spec-010 graphthulhu upstream contribution: new subsystem, cross-org, contracts.
🏁 Definition of Done — 🛠️ Quality & Testing
- Code has been peer-reviewed for bugs and vulnerabilities.
- Proper testing has been completed and passes (Unit, Integration, E2E via GitHub Actions).
- The feature has been demonstrated/validated successfully in the target environment.
🏁 Definition of Done — 📝 Architecture & Docs
-
docs/runtimes.md(PR2): fill in the OpenCode column in the security matrix; document sandbox layout for.opencode/; update the "stub" note to "implemented". - Usage documentation or changelog updated (if user-facing changes introduced). A user-facing new runtime requires a website issue per the org Cross-Repo Documentation rule.
- Local ADR written and verified by Tech Lead if technical architecture deviated.
- Any newly introduced technical debt has been logged as a GitHub issue.
Context
- Source RFC: https://github.com/orgs/unbound-force/discussions/437
- Execution plan (Jay / @jflowers): https://github.com/orgs/unbound-force/discussions/437#discussioncomment-14559914
- Locked approach: A — OpenCode + uf as the agent runtime; FullSend is infrastructure (sandbox, WIF, dispatch)
- Size: L (comparative T-shirt; same scale as ComplyTime / Agentic-SSDLC / Unbound Force planning)
- Upstream tracking epic: fullsend#1260
- Precedent to mirror: the
piruntime onfullsendmain —pi.go,pi_bootstrap.go,pi_run.go,pi_transcript.go,pi_agent.go,pi_progress.go(+ tests), enabled in fullsend#6464. Followdocs/contributing/runtime-implementation.md.
Implementation Plan (reconciled — mirror the pi runtime)
A1. Bootstrap(BootstrapInput) — replace the "not yet implemented" stub, mirroring pi_bootstrap.go:
- Create the agent/skill layout the runtime expects; upload agent def + skill dirs via
sandbox.UploadFile/sandbox.Upload - Inject
opencode.jsonwith Vertex provider config + permission denials (fromOPENCODE_CONFIG_CONTENT) - Do NOT implement
ClaudeHooksBootstrap— opencode has no PreToolUse/PostToolUse hooks; the type-assert inrun.goskips hook installation gracefully. Hook adapter is [Story] Close the OpenCode security-hook gap before write-capable agents #515. - ConfigDir: move off the agent-writable
/sandbox/workspace/.opencodeto a runner-owned dir (see AC + [Story] Close the OpenCode security-hook gap before write-capable agents #515 convention). Fail closed on sha256 mismatch.
A2. System() — return "opencode" (multi-provider convention, matching pi's System()=="pi"). (The original "fix to anthropic" note was incorrect and is superseded.)
A3. Run(ctx, RunParams, printer, start, metrics) — mirror pi_run.go:
- Build the command and exec via
sandbox.ExecStreamReader(ctx, params.SandboxName, cmd, params.Timeout, os.Stderr) - Tee stdout to
params.OutputPathif set (io.TeeReader) - Wrap
params.OnEventto capture metrics (InitEvent.Model, ResultEvent tokens/cost, ToolUseEvent count) - Call
parseOpenCodeStream(reader, handler)(already merged) - Emit
InitEventwith model fromRunParams.Model(not carried in the wire format) - Model handling: copy pi's pattern — bare
model:+ a provider env var + atranslatePiModel()-style normalizer (pi_run.go). ThevalidModelNameslash-regex change is optional.
A4. Transcripts (interim output.jsonl tee):
ExtractTranscripts: downloadoutput.jsonl(tee'd during Run) from sandbox to localiterTranscriptDirParseTranscriptErrors: scan for laststep_finishwith error state, orerrortype eventsParseTranscriptFile: find last result-like event in the ndjsonExtractDebugLog: if--debugis passed, download stderr capture
A5. EnvExports() — return env vars opencode needs:
func (OpenCodeRuntime) EnvExports() []string {
return []string{
"OPENCODE_CONFIG_CONTENT", // Vertex provider + permissions (merges with, not replaces, project config)
"GOOGLE_APPLICATION_CREDENTIALS", // WIF credential file
}
}A6. ValidRuntimes() + tests:
- Add
"opencode"toconfig.go:193ValidRuntimes()return slice - Update
opencode_test.go: assertSystem() == "opencode", add Bootstrap/Run happy-path tests, add registry resolution test - Update
config_test.go:678-688to expect opencode as valid
PR2 (A7): docs/runtimes.md — see DoD Architecture & Docs.
Security: command-construction hardening
The Run() command builder MUST shell-escape all interpolated values before assembling the sh -c command string, mirroring the established pattern in claude.go / pi_run.go:
// Model — single-quote + escape embedded quotes with the classic '\'' sequence
if params.Model != "" {
parts = append(parts, fmt.Sprintf("--model '%s'", strings.ReplaceAll(params.Model, "'", "'\\''")))
}
// Effort
if params.Effort != "" {
parts = append(parts, fmt.Sprintf("--effort '%s'", strings.ReplaceAll(params.Effort, "'", "'\\''")))
}
// AgentBaseName
safe := strings.ReplaceAll(params.AgentBaseName, "'", "'\\''")
parts = append(parts, fmt.Sprintf("--agent '%s'", safe))Why not exec.Command with argv separation? The sandbox boundary is sandbox.ExecStreamReader() → openshell sandbox exec -- sh -c <command> (sandbox.go:684-693). The in-sandbox process receives a single shell string, not an argv array. Shell-escaping + input validation is the correct mitigation at this boundary. (This rebuts the earlier "use exec.Command" review note, which is a false premise for the sh -c boundary.)
Input validation: Constrain Model, Effort, and AgentBaseName to a safe charset (alphanumeric + -_./@ ) before escaping, and reject values with control characters or shell metacharacters. Validate against the actual downstream sink (path/agent-name consumer), not only against shell metacharacters. Ensure the escaping handles embedded single quotes ('\'').
Revision history
- 2026-08-27 — Body reconciled against
fullsendmain. Superseded: original stub-runtime/ndjson-parser ACs (already merged upstream, fullsend#6035/#6147),System()→anthropic(corrected toSystem()==opencode), in-tree.opencode/ConfigDir (moved to runner-owned dir), ContextBridger (omitted). Added [Story] Close the OpenCode security-hook gap before write-capable agents #515 boundary, sha256 fail-closed AC, and cross-org tracking note. Original stale Implementation Notes A1–A7 replaced with the reconciled plan above. Pre-reconcile text preserved in the "Original description (superseded)" comment.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsIn Progress 📋
Activity
yvonnedevlinrh commentedon Aug 18, 2026
Review feedback
The triage panel flagged a repository scope mismatch that needs resolution before this story can move forward:
All file paths (
internal/runtime/opencode.go), PRs (#6035, #6147), and test locations (opencode_test.go:19,config_test.go:678-688) referencefullsend-ai/fullsend, not this repository. There is nointernal/runtime/package inunbound-force/unbound-force.Questions:
fullsend-ai/fullsend?Additionally, the shell command construction via
fmt.Sprintf("cd %s && . %s && opencode run --model %s ...")was flagged HIGH by 3/5 triage agents as a shell injection vector. All three interpolated parameters could contain shell metacharacters. The implementationmust use
exec.Commandwith argument separation per Go convention SC-003 and Constitution Principle V.jflowers commentedon Aug 24, 2026
Re-scope: mirror the
piruntime (now a complete precedent)internal/runtime/on fullsendmainhas a full working non-Claude runtime to copy from:pi.go,pi_bootstrap.go,pi_run.go,pi_transcript.go,pi_agent.go,pi_progress.go,pi_extension/fullsend-hooks.js(+ tests). Enabled in fullsend-ai/fullsend#6464.Current OpenCode state:
opencode.goBootstrap()/Run()still return "opencode runtime is not yet implemented"; onlyopencode_progress.go(parseOpenCodeStream, ndjson from--format json) is done (fullsend-ai/fullsend#6147).Updated ACs:
Bootstrap/Runmirroringpi_bootstrap.go/pi_run.goopencodetoconfig.ValidRuntimes()(currently["claude","pi","dummy"]) — without this, config validation rejects it (Config-driven runtime selection doesn't validate against ValidRuntimes() before sandbox bootstrap fullsend-ai/fullsend#6471) and runs fail fast (Move runtime resolution above sandbox creation to fail fast on invalid runtime config fullsend-ai/fullsend#6509)RunParams.Prompt/validation_loop.feedback_modecontract (seedocs/runtimes.md; skipping it makesfeedback_mode: appenda silent no-op, Implement validation loop feedback so agents can self-correct fullsend-ai/fullsend#1050)yvonnedevlinrh commentedon Aug 26, 2026
Scope refresh (verified against fullsend main 90ee8d6f)
Good news: this is already partly done upstream, so the remaining scope is narrower than the body implies.
Already merged — do NOT re-implement:
internal/runtime/opencode.go+ registry case (fullsend#6035)opencode_progress.go(fullsend#6147) — fully tested, secret redaction already wiredActual remaining scope:
Bootstrap()+Run()ExtractTranscripts()/ExtractDebugLog()ValidRuntimes()to includeopencode(currentlyclaude,pi,dummy)ConfigDir()off the agent-writable/sandbox/workspace/.opencodeto a runner-owned dir (the source comment atopencode.go:33says to do exactly this). This is a code change inopencode.go= this story's file, so [Story] Contribute OpenCodeRuntime to FullSend #510 owns the dir move; [Story] Close the OpenCode security-hook gap before write-capable agents #515 owns the integrity gate + adapter.Corrections to earlier notes:
System() == "opencode"is the correct multi-provider convention (pi doesSystem()=="pi"), not a bug to fix.DebugLogNameForsplit-backend bug is already fixed upstream (variadic now).validModelNameslash-regex change is optional. Copy pi's pattern instead: baremodel:+ a provider env var + atranslatePiModel()-style normalizer (pi_run.go).docs/contributing/runtime-implementation.mdcontract. OpenCode reads AGENTS.md natively (like pi), so omit ContextBridger.yvonnedevlinrh commentedon Aug 27, 2026
Hook plugin adapter and nested sub-agent (Task) call coverage are tracked in #515 — #510 owns the runtime (Bootstrap/Run, ConfigDir move to a runner-owned dir, and the ValidRuntimes final flip), not the hook contract. Coordinate the ConfigDir path + sha256 convention with #515 before coding the ConfigDir move to avoid rework.
yvonnedevlinrh commentedon Aug 27, 2026
Sequencing note: pin #515's ConfigDir contract before coding the move
Two clarifications on the
ConfigDir()move (this story owns the dir move; #515 owns the integrity gate + adapter):1. Supersedes the A1 implementation note. The Implementation Notes above (A1, Aug 2026) say to "rely on the repo's in-tree
.opencode/... ConfigDir =/sandbox/workspace/.opencode". That is now stale — per the Scope refresh comment,ConfigDir()must move off the agent-writable/sandbox/workspace/.opencodeto a runner-owned dir (source comment atopencode.go:33says exactly this). Treat the Scope-refresh direction as authoritative.2. Pin the convention before coding the move. #515 owns the integrity gate + hook adapter, which depend on where ConfigDir lives and how it's integrity-checked. To avoid rework, the runner-owned path convention + sha256 integrity convention (already described in #515's "Reframed" comment) should be pinned before #510 writes the dir move. #515's full implementation still lands after #510; only the convention needs to be fixed first. No reordering — #510 stays the keystone.
yvonnedevlinrh commentedon Sep 2, 2026
Original description (superseded 2026-08-27)
Preserving the pre-reconcile issue description for provenance. This text is superseded — see the current issue description and the triage comment above.
Why it was changed: The body had drifted out of sync with the resolved scope in the comment thread. Specifically: (1) it asked to implement a stub runtime and ndjson parser that were already merged upstream (fullsend#6035, fullsend#6147); (2) it instructed
System()→anthropic, which a later comment corrected toSystem()==opencode(the multi-provider convention per pi) — a contradiction that would have made tests assert the wrong contract; (3) the A1 design note pinnedConfigDirto the agent-writable in-tree/sandbox/workspace/.opencode, which was superseded by the direction to move it to a runner-owned dir; and (4) it did not reflect that this is a cross-org tracking story (implementation lands infullsend-ai/fullsend, not here). Leaving the stale body risked an implementer working from contradicted instructions.Original description (click to expand)
yvonnedevlinrh commentedon Sep 2, 2026
Triage: NEEDS-CLARIFICATION → resolved via body reconcile
The Divisor review panel (5 agents) assessed this story as NEEDS-CLARIFICATION (3/5), category feature, objective. Two agents dissented VALID (architect, sre), considering the defects mechanical/fixable. The intent is sound and well-governed (traces to RFC #437, epic #508, Composability First); the blockers were artifact-hygiene issues, not scope or feasibility problems.
The issue description has now been updated to resolve these. Summary of what changed and why:
1. Reconciled the stale body. Implementation Notes A1 and several acceptance criteria were superseded by the 2026-08-24/08-26/08-27 comments (stub runtime + ndjson parser already merged upstream; scope now =
Bootstrap(),Run(),ExtractTranscripts, flipValidRuntimes, ConfigDir move). The comment-resolved scope is now promoted into the body as the single source of truth, so an implementer no longer follows stale notes.2. Fixed the
System()contradiction. The old body said fixSystem()toanthropic, but a later comment establishedSystem()==opencodeas the correct multi-provider convention (per the pi precedent). These were mutually exclusive test targets. The body now setsSystem() == "opencode"as canonical.3. Confirmed cross-org scope/labeling. All file paths, PRs, and tests reference
fullsend-ai/fullsend; there is nointernal/runtime/in this repo. The body now carries an explicit cross-org tracking note — implementation lands upstream; no code lands inunbound-force/unbound-force.4. Pinned the ConfigDir integrity contract. Added an explicit acceptance criterion that a ConfigDir sha256 checksum mismatch MUST fail closed (abort the run), and to pin #515's runner-owned ConfigDir + sha256 convention before coding the move.
Security note: The body's rebuttal to the earlier "use
exec.Commandargv separation" feedback is technically correct for thesh -csandbox boundary — shell-escaping ('\'') + charset validation is the right mitigation there. Please confirm the escaping handles embedded single quotes and validates against the actual sink.Reliability follow-ups (candidate child issues, not yet filed):
Run()(behavior when the run is killed before a terminalResultEvent)The full pre-reconcile description is preserved in a separate comment below for provenance.
This triage was performed by the Divisor review panel.
yvonnedevlinrh commentedon Sep 8, 2026
Created fullsend-ai/fullsend#7103 in fullsend and am waiting on review
yvonnedevlinrh commentedon Oct 19, 2026
Implemented by and merged in fullsend-ai/fullsend#7103 on October 16, 2026.
The PR delivers the OpenCode runtime, bootstrap/run/transcript handling, runner-owned configuration, runtime registration and CLI/config support, model and permission handling, sandbox image support, documentation, and focused unit/integration coverage. It also enforces the read-only rollout, fail-closed configuration and agent verification, environment re-pinning, permission intersection, and checksum protections.
The local OpenCode triage run passed. The gated behavior test will run after the updated sandbox image containing OpenCode is published.
The hook adapter, credential redaction, Renovate version management, Vertex
@defaulthandling, and model fallback chain remain tracked separately.Closing as completed by #7103.