Repository navigation
Add OpenCode agent adapter - #63
Merged
Merged
Conversation
This was referenced Nov 10, 2026
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Closes #49
Adds an adapter for OpenCode (
opencode run), tested against opencode 1.18.34 (recorded in the module docstring). Follows PR #27 (Droid/Devin).What changed
src/secfoo/agents/opencode.py: newOpenCodeAdapter(build_command,extract_report,extract_usage)registry.pyand theAgentIdenum incli.py(secfoo run --agent opencode);-mmodel flag added to the model-selection test tabledocs/REFERENCE.mdsupported-agent listsbase.py: one small optional hook,extra_env(class attribute, empty by default).envis passed toPopenonly when non-empty, so existing adapters are unaffected.tests/test_agents/test_opencode.py: fake-binary tests, no real API callsCommand
opencode run --pure --format json --dir <workdir> [-m provider/model], prompt on stdin.Requirements from the issue
--autois not used. Because opencode's default agent allows bash/edit even without--auto, the adapter also setsOPENCODE_PERMISSIONandOPENCODE_CONFIG_CONTENTto denybash,editandwebfetch. Both are set so an inheritedOPENCODE_PERMISSIONor a projectopencode.jsonthat allows them cannot widen access. Manually verified withopencode debug agent build, and with a live run (free model) asked to create a file and run a shell command: both were refused and no file was created.--auto, assert both deny env vars reach the subprocess, assert other adapters still launch without anenvkwarg.Verification
pytest tests/test_agents: 124 passedtext,step_finishtokens/cost).Known limits
pytest testson my Windows machine (aftersecfoo vendor mermaidand installing the PDF/DOCX deps): 1002 passed, 4 failed, all unrelated to this change and Windows-specific: 3 POSIX file-permission-mode assertions (0600is not representable on Windows) and 1 symlink test (needs symlink privilege).ruff check .reports pre-existing violations on main; the new files add none.