Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
124 changes: 72 additions & 52 deletions .github/workflows/opencode-triage.yml
Original file line number Diff line number Diff line change
@@ -1,52 +1,72 @@
name: OpenCode Daily Triage

on:
schedule:
- cron: "0 6 * * *" # 1:00 AM EST (6:00 AM UTC) daily
workflow_dispatch:

jobs:
triage:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: write
issues: write
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false

- uses: anomalyco/opencode/github@latest
env:
OPENCODE_API_KEY: ${{ secrets.OPENCODE_API_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
model: opencode/big-pickle
use_github_token: true
prompt: |
You are a triage agent. Triaging open GitHub issues in this repo.

1. Use `gh issue list --state open --json number,title,body,labels,createdAt` to list open issues.
2. Skip any issue that already has a state label (ready-for-agent, ready-for-human, go:needs-research, go:no, wontfix).
3. For each unlabeled issue, read it with `gh issue view <number>`.
4. Classify as `type:bug` or `type:feature`.
5. Assign a state:
- `go:needs-research` — needs more info or investigation
- `ready-for-agent` — well-specified, agent-implementable
- `ready-for-human` — needs human judgment or design decisions
- `wontfix` — out of scope or not actionable (close it)
6. Apply labels with `gh issue edit <number> --add-label`.
7. Post a triage comment with `gh issue comment <number>`. Every comment MUST start with:
> *This was generated by AI during triage.*

For `go:needs-research`: post "Triage Notes" with what you established and specific questions for the reporter.
For `ready-for-agent`: post an "Agent Brief" with category, summary, current/desired behavior, key interfaces, acceptance criteria, and out-of-scope.
For `ready-for-human`: same as agent brief but note why it can't be delegated.
For `wontfix`: post a polite explanation and close with `gh issue close <number> --reason not-planned`.

Rules:
- Never re-triage an issue that already has a state label.
- Never modify closed issues.
- When in doubt, use `go:needs-research`.
- Keep briefs behavioral (what, not how). No file paths or line numbers.
name: OpenCode Daily Triage

on:
schedule:
- cron: "0 6 * * *" # 1:00 AM EST (6:00 AM UTC) daily
workflow_dispatch:

jobs:
triage:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: write
issues: write
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false

- name: Get opencode version
id: version
run: |
VERSION=$(curl -sf https://api.github.com/repos/anomalyco/opencode/releases/latest | grep -o '"tag_name": *"[^"]*"' | cut -d'"' -f4)
echo "version=${VERSION:-latest}" >> $GITHUB_OUTPUT

- name: Cache opencode
id: cache
uses: actions/cache@v5
with:
path: ~/.opencode/bin
key: opencode-${{ runner.os }}-${{ runner.arch }}-${{ steps.version.outputs.version }}

- name: Install opencode
if: steps.cache.outputs.cache-hit != 'true'
run: curl -fsSL https://opencode.ai/install | bash

- name: Add opencode to PATH
run: echo "$HOME/.opencode/bin" >> $GITHUB_PATH

- name: Run opencode
run: opencode github run
env:
OPENCODE_API_KEY: ${{ secrets.OPENCODE_API_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
MODEL: opencode/big-pickle
USE_GITHUB_TOKEN: "true"
PROMPT: |
You are a triage agent. Triaging open GitHub issues in this repo.

1. Use `gh issue list --state open --json number,title,body,labels,createdAt` to list open issues.
2. Skip any issue that already has a state label (ready-for-agent, ready-for-human, go:needs-research, go:no, wontfix).
3. For each unlabeled issue, read it with `gh issue view <number>`.
4. Classify as `type:bug` or `type:feature`.
5. Assign a state:
- `go:needs-research` — needs more info or investigation
- `ready-for-agent` — well-specified, agent-implementable
- `ready-for-human` — needs human judgment or design decisions
- `wontfix` — out of scope or not actionable (close it)
6. Apply labels with `gh issue edit <number> --add-label`.
7. Post a triage comment with `gh issue comment <number>`. Every comment MUST start with:
> *This was generated by AI during triage.*

For `go:needs-research`: post "Triage Notes" with what you established and specific questions for the reporter.
For `ready-for-agent`: post an "Agent Brief" with category, summary, current/desired behavior, key interfaces, acceptance criteria, and out-of-scope.
For `ready-for-human`: same as agent brief but note why it can't be delegated.
For `wontfix`: post a polite explanation and close with `gh issue close <number> --reason not-planned`.

Rules:
- Never re-triage an issue that already has a state label.
- Never modify closed issues.
- When in doubt, use `go:needs-research`.
- Keep briefs behavioral (what, not how). No file paths or line numbers.
Loading