Skip to content

fix: opencode run works — 3 critical fixes - #433

Merged
MichielDean merged 1 commit into
mainfrom
fix/opencode-run-session-bug
Apr 13, 2026
Merged

MichielDean merged 1 commit into
mainfrom
fix/opencode-run-session-bug

Conversation

@MichielDean

Copy link
Copy Markdown
Owner

Summary

Fixes three critical bugs that prevented Cistern from spawning opencode agents.

  1. PromptPositional: opencode takes the prompt as a positional argument after run, not via a flag. The old code used PromptFlag: "" with NonInteractive.PromptFlag: "-p", but -p is --password in opencode, not a prompt flag. Added PromptPositional: true to the opencode preset. When set, the short prompt is appended as a positional argument after all flags, and the full prompt is written to AGENTS.md via PromptFileTemplate.

  2. --dangerously-skip-permissions: Added to the opencode preset Args. Cistern agents must run without permission prompts to function autonomously.

  3. Unset OPENCODE_SERVER_* env vars: CodeNomad sets OPENCODE_SERVER_USERNAME and OPENCODE_SERVER_PASSWORD in the environment. When these are set, opencode run tries to connect to an authenticated server instead of starting a fresh session, causing "Session not found" errors. The fix explicitly unsets OPENCODE_SERVER_USERNAME, OPENCODE_SERVER_PASSWORD, OPENCODE_PID, and OPENCODE in every spawned tmux session. See: opencode run fails with 'Session not found' (1.1.16) anomalyco/opencode#8502

1. PromptPositional: opencode takes prompt as positional arg, not a flag.
   The -p flag is --password, not --prompt. Added PromptPositional to the
   preset config so the short prompt is appended after flags, not passed
   via -p.

2. --dangerously-skip-permissions: added to opencode preset Args. Cistern
   agents must run without permission prompts.

3. Unset OPENCODE_SERVER_* env vars in spawned sessions. These vars cause
   'opencode run' to fail with 'Session not found' because it tries to
   connect to an authenticated server instead of starting fresh.
   See: anomalyco/opencode#8502
@MichielDean
MichielDean enabled auto-merge (squash) April 13, 2026 17:00
@MichielDean
MichielDean merged commit 92ec93e into main Apr 13, 2026
3 checks passed
@MichielDean
MichielDean deleted the fix/opencode-run-session-bug branch April 13, 2026 17:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant