This repository was archived by the owner on Sep 2, 2026. It is now read-only.
Repository navigation
fix(opencode): enable YOLO permission mode via OPENCODE_CONFIG_CONTENT - #90
Merged
Merged
Conversation
opencode models permissions through its JSON config, not a CLI bypass
flag, and its Claude-style flag is already stripped as unsupported.
Deliver an allow-all permission block via OPENCODE_CONFIG_CONTENT (the
agent's own inline-config env var) on the existing YOLO_TUI_AGENT_ENV
path, so it rides the same endpoint-agnostic agentEnv delivery already
used for goose's GOOSE_MODE — no code path needs to know local vs WSL
vs SSH.
Verified against the installed opencode 1.18.23:
OPENCODE_CONFIG_CONTENT='{"permission":"allow"}' opencode debug config
resolves permission to {"*":"allow"}.
Refs #85
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
YOLO permission mode had no effect on OpenCode launches: opencode was absent from
YOLO_TUI_AGENT_ARGS, and its one Claude-style bypass flag (--dangerously-skip-permissions) is already stripped as unsupported intui-agent-launch-defaults.ts. OpenCode models permissions in its own JSON config, not via a CLI flag, so the fix delivers an allow-all permission block through opencode's own inline-config env var,OPENCODE_CONFIG_CONTENT, added to the existingYOLO_TUI_AGENT_ENVmap (the same mechanism already used for goose'sGOOSE_MODE).Closes #85
Mechanism
Researched against the installed opencode CLI (1.18.23) rather than guessing:
opencode --helpshows no--configflag on the default/TUI command, and no bare--dangerously-skip-permissions-equivalent that opencode's own launch mode supports without also disabling other approvals.https://opencode.ai/config.json) documents a top-levelpermissionfield accepting either"allow"or a per-tool{ "*": "allow" }object.OPENCODE_CONFIG_CONTENTas an inline-JSON config override — one of its documented config sources, applied after global/project/.opencodeconfig, before only managed/system config.OPENCODE_CONFIG_CONTENT='{"permission":"allow"}' opencode debug configresolves the mergedpermissionfield to{"*":"allow"}— confirmed with and without an existing projectopencode.jsonpresent.This lands as an env var, not a config file write, so it needs no
path.join, no WSL argv handling, and no local/SSH branching:agentEnvalready flows throughsrc/shared/tui-agent-startup.tsinto the generic PTY spawn env used uniformly for local, WSL, and SSH-remote launches (the same path goose'sGOOSE_MODEalready relies on). The payload never appears in the visible launch command — it rides the invisible spawn env only (asserted in tests).Problem -> Resolution
--configflag or a generated project/global config file) would require host-local file writes and platform-specific path handling, breaking on SSH-remote opencode launches where Orca's main process cannot write to the execution host's filesystem. -> Resolution: useOPENCODE_CONFIG_CONTENT, an inline-JSON env var that opencode itself already supports, riding the existing cross-hostagentEnvdelivery path with zero new host-specific code.--autoCLI flag ("auto-approve permissions that are not explicitly denied") that superficially resembles a YOLO bypass. -> Resolution: not used — the issue explicitly rules out a CLI-flag shape for opencode, and the config-basedpermission: allowmechanism is documented, verified, and endpoint-agnostic, so it was preferred over the CLI flag."bash": "ask"), YOLO's"*":"allow"doesn't override that explicit key. -> Resolution: accepted as opencode's own merge semantics (verified), consistent with how other agents' custom configuration outside Orca's launch layer is respected rather than overridden.Acceptance Criteria
OPENCODE_CONFIG_CONTENTset to{"permission":"allow"}; verified live against opencode 1.18.23 that this resolves topermission: {"*":"allow"}viaopencode debug configYOLO_TUI_AGENT_ENV;applyAgentPermissionMode({mode:'manual', ...})resetsagentDefaultEnv.opencodeto{}, so no env var is set — test:src/shared/tui-agent-permissions.test.ts("turns opencode yolo off back to an empty env")YOLO_TUI_AGENT_ARGS(onlyYOLO_TUI_AGENT_ENV), so customagentArgs(e.g.--agent build) pass through untouched alongside the YOLO env var — test:src/shared/tui-agent-startup-opencode-permission.test.ts("keeps a custom opencode agent flag alongside the YOLO permission env var")Files changed
src/shared/tui-agent-permissions.ts— addopencode: { OPENCODE_CONFIG_CONTENT }toYOLO_TUI_AGENT_ENVsrc/shared/tui-agent-permissions.test.ts— opencode-specific permission-mode resolution testssrc/shared/tui-agent-startup-opencode-permission.test.ts(new) — startup-plan plumbing tests: env delivered, custom args preserved, payload never leaks into the visible launch command, YOLO-off omits the var entirelyQA Plan
./node_modules/.bin/vitest run --config config/vitest.config.ts src/shared/tui-agent-permissions.test.ts src/shared/tui-agent-startup.test.ts src/shared/tui-agent-startup-opencode-permission.test.ts— 84 tests passedpnpm run typecheck— passedrtk proxy pnpm run lint— passed (oxlint, type-aware audit, reliability gates, max-lines ratchet, localization checks all green)sync:localization-catalogwas not neededOPENCODE_CONFIG_CONTENTactually resolves to an allow-all permission config, both with and without a competing projectopencode.json