Skip to content

fix(opencode): add OpenCode 2 compatibility - #5

Open
NidAll wants to merge 1 commit into
benja:mainfrom
NidAll:fix/opencode-v2
Open

NidAll wants to merge 1 commit into
benja:mainfrom
NidAll:fix/opencode-v2

Conversation

@NidAll

@NidAll NidAll commented Sep 18, 2026

Copy link
Copy Markdown

Summary

Update the OpenCode harness for OpenCode 2 compatibility.

OpenCode 2 removed the --pure flag and changed the custom agent configuration schema, causing current Ask releases to fail with:

Unrecognized flag: --pure in command opencode

This updates the harness to use the OpenCode 2 CLI and configuration format while preserving Ask's read-only behavior.

Changes

  • replace opencode --pure run with the OpenCode 2 run --standalone flow
  • replace opencode --pure models with opencode models
  • migrate custom agent configuration from agent to agents
  • migrate agent instructions from prompt to system
  • migrate the old permission object to OpenCode 2 ordered permissions
  • preserve the read-only default-deny policy
  • keep .env files protected while allowing .env.example
  • update OpenCode harness tests for the V2 configuration and CLI
  • preserve session continuation and JSON event parsing

Testing

Tested locally with OpenCode 2 using Ask end-to-end.

running 85 tests
test result: ok. 85 passed; 0 failed

Also verified:

  • one-shot questions work through OpenCode 2
  • model selection works through ask --settings
  • OpenCode model discovery works
  • session continuation works
  • read-only agent configuration is injected correctly

The upstream OpenCode 1-style harness failed before this change because OpenCode 2 no longer recognizes --pure.

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