Repository navigation
ci: add an opencode v2 agent triggered by owner comments - #1129
Merged
Merged
Conversation
Runs OpenCode on a /oc or /opencode comment in an issue, a pull request or a line review, using OpenCode Go models. Only the repository owner's account id can trigger it, so other comments neither spend the subscription nor reach an agent holding a write token. The CLI is pinned to opencode-ai 1.19.5 instead of using anomalyco/opencode/github: that action is no longer published, installs the latest OpenCode at run time, and OpenCode v2 has no `github run` command. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0177LJQehsL7Fm3PciLfDcFL
…a free model Follows the newest v1 CLI (opencode-ai@1) instead of a fixed version, uses the latest Node LTS, runs on the one-vCPU ubuntu-slim runner with its 15-minute ceiling made explicit, and switches to the free opencode-go/beam-free model. Names the owner behind the trigger's user id. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0177LJQehsL7Fm3PciLfDcFL
OpenCode v2 dropped its GitHub integration, so the workflow now does that part itself: it runs `opencode run` headless with the latest @opencode/cli, then commits, pushes and replies with the repository bot's token, downscoped to contents, pull requests and issues. The agent step holds no GitHub credential. Fork pull requests and pull requests from main or next are refused. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0177LJQehsL7Fm3PciLfDcFL
The global-install pin rule rejected `@opencode/cli@latest`. The agent is meant to follow the newest OpenCode v2, so the workflow joins the rule's allowlist with that reason, the same way the claude-code probe does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0177LJQehsL7Fm3PciLfDcFL
…runs OpenCode v2 recommends explicit rules for CI, where nothing can answer a prompt. The agent now runs without --auto under a user-level config: shell denied except read-only git, no access outside the checkout, no subagents (the shipped explore agent re-allows shell and outside paths, and agent rules outrank config). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0177LJQehsL7Fm3PciLfDcFL
alexsoyes
enabled auto-merge
November 2, 2026 01:26
blafourcade
approved these changes
Nov 2, 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.
🎯 What & why
Lets the repository owner hand work to OpenCode v2 from a comment (
/ocor/opencode) on an issue, a pull request or a line review, on the freeopencode-go/beam-freemodel. Nobody else can trigger it.🛠️ How it works
OpenCode v2 has no GitHub integration anymore (no
github runcommand, and theanomalyco/opencode/githubaction is no longer published), so this workflow is the integration:comment.user.id, not the login, which can be renamed and reclaimed. The repo is public: without it any comment would spend the subscription and feed text to the agent.main/nextheads refused). On an issue,chore/opencode-issue-<n>fromnext, reused by later requests on the same issue.jqfrom the event payload into a file: issue or PR text, the review hunk if any, then the request. No comment text is interpolated into a shell command.opencode run --standalone --format jsonwith the latest@opencode/cli, no--auto. Per OpenCode's guidance for unattended runs, opencode.yml:119 writes explicit rules to the user config (outside the checkout, never committed): shell denied except read-only git, so CI tests the pushed commit; no access outside the checkout, which keepsOPENCODE_API_KEYout of reach; subagents denied, because the shippedexploreagent re-allows shell and outside paths and agent rules outrank config. Anything left ataskis rejected. The step holds no GitHub credential.aidd-bottoken downscoped to contents, pull requests and issues (same app the release workflows use, so its pushes trigger CI, whichGITHUB_TOKENpushes would not). Commits, pushes, opens a PR tonextfor issues, and replies with the agent's last message. On failure it replies with the run link.GITHUB_TOKENstayscontents: read+pull-requests: read. Runnerubuntu-slim, Nodelts/*, actions pinned by SHA,permissions: {}at the top.🧪 How to verify
main(issue_commentworkflows only run from the default branch):/oc fix the typo in READMEon a test issue. Expect a reply with a link to a new PR./ocon a PR from a branch of this repo: expect a commit on that branch and a reply.main. The prompt builder and reply extraction were dry-run locally on sample payloads; the v2runflags were read from the 2.2.1 source.@opencode/cli@latestis a deliberate exception to the global-install pin rule, declared in workflows-pin-global-installs.test.js with its reason. It floats on a CLI that ships several releases a week: a flag change breaks the run, and each release runs unreviewed. Pin a version to trade freshness back.beam-freeis free for a limited time; when it ends, changeMODEL.ubuntu-slimstops jobs at 15 minutes, install included.✅ I certify
https://claude.ai/code/session_0177LJQehsL7Fm3PciLfDcFL
Generated by Claude Code