-
Notifications
You must be signed in to change notification settings - Fork 8
Add PR/issue triage example for high-volume repos #357
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
gjkim42
wants to merge
1
commit into
main
Choose a base branch
from
resolve-openclaw
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| # 06 — PR & Issue Triage for High-Volume Repos | ||
|
|
||
| A TaskSpawner that automatically triages every PR and issue on a fast-moving | ||
| repo like [OpenClaw](https://github.com/openclaw/openclaw). Inspired by | ||
| [@steipete's problem](https://x.com/steipete/status/2023057089346580828): | ||
| hundreds of PRs per day, many duplicates, no way to keep up manually. | ||
|
|
||
| ## What It Does | ||
|
|
||
| For every new PR or issue, an agent: | ||
|
|
||
| 1. **De-duplicates** — searches all open PRs/issues for semantic overlap and | ||
| flags duplicates with links. | ||
| 2. **Reviews quality** (PRs) — reads the diff and rates code quality, test | ||
| coverage, scope, and description. | ||
| 3. **Checks vision alignment** — flags PRs that stray from the project's | ||
| core principles (open-source, privacy-first, self-hosted). | ||
| 4. **Posts a triage comment** — a structured report with a clear | ||
| recommendation (MERGE / REVISE / CLOSE AS DUPLICATE / NEEDS MAINTAINER REVIEW). | ||
|
|
||
| ## Resources | ||
|
|
||
| | File | Kind | Purpose | | ||
| |------|------|---------| | ||
| | `credentials-secret.yaml` | Secret | Claude OAuth token | | ||
| | `github-token-secret.yaml` | Secret | GitHub token for repo access and commenting | | ||
| | `workspace.yaml` | Workspace | Points to `openclaw/openclaw` | | ||
| | `taskspawner.yaml` | TaskSpawner | Polls PRs + issues, spawns triage agents | | ||
|
|
||
| ## Steps | ||
|
|
||
| 1. **Edit the secrets** — replace placeholders in both secret files. | ||
|
|
||
| 2. **Apply:** | ||
|
|
||
| ```bash | ||
| kubectl apply -f examples/06-openclaw-pr-triage/ | ||
| ``` | ||
|
|
||
| 3. **Watch it work:** | ||
|
|
||
| ```bash | ||
| kubectl get taskspawners -w | ||
| kubectl get tasks -w | ||
| ``` | ||
|
|
||
| 4. **Cleanup:** | ||
|
|
||
| ```bash | ||
| kubectl delete -f examples/06-openclaw-pr-triage/ | ||
| ``` | ||
|
|
||
| ## Tuning | ||
|
|
||
| - `pollInterval: 3m` — how often to check for new PRs/issues. | ||
| - `maxConcurrency: 5` — how many triage agents run in parallel. | ||
| - `ttlSecondsAfterFinished: 600` — completed tasks are cleaned up after 10 min | ||
| so the spawner can re-process if new activity appears. | ||
| - Edit the vision statement in `promptTemplate` to match your project's values. | ||
| - Add `excludeLabels: ["triaged"]` to skip already-processed items. |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| apiVersion: v1 | ||
| kind: Secret | ||
| metadata: | ||
| name: openclaw-claude-oauth | ||
| type: Opaque | ||
| stringData: | ||
| # TODO: Replace with your Claude OAuth token | ||
| CLAUDE_CODE_OAUTH_TOKEN: "REPLACE-ME" |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| apiVersion: v1 | ||
| kind: Secret | ||
| metadata: | ||
| name: openclaw-github-token | ||
| type: Opaque | ||
| stringData: | ||
| # TODO: Replace with your GitHub token | ||
| # Required permissions: repo, pull_requests (read/write for comments) | ||
| GITHUB_TOKEN: "ghp_REPLACE-ME" |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,84 @@ | ||
| apiVersion: axon.io/v1alpha1 | ||
| kind: TaskSpawner | ||
| metadata: | ||
| name: openclaw-pr-triage | ||
| spec: | ||
| when: | ||
| githubIssues: | ||
| types: | ||
| - pulls | ||
| - issues | ||
| state: open | ||
| taskTemplate: | ||
| type: claude-code | ||
| workspaceRef: | ||
| name: openclaw | ||
| credentials: | ||
| type: oauth | ||
| secretRef: | ||
| name: openclaw-claude-oauth | ||
| promptTemplate: | | ||
| You are a triage agent for the OpenClaw project (github.com/openclaw/openclaw). | ||
| Your job is to analyze the following {{.Kind}} and post a single triage comment using `gh`. | ||
|
|
||
| --- | ||
| {{.Kind}} #{{.Number}}: {{.Title}} | ||
| {{.Body}} | ||
| {{if .Comments}} | ||
| Comments: | ||
| {{.Comments}} | ||
| {{end}} | ||
| --- | ||
|
|
||
| ## Your tasks | ||
|
|
||
| ### 1. Duplicate detection | ||
| Search for other open PRs and issues that address the same thing: | ||
| - `gh pr list --state open --limit 100 --json number,title,body,labels` | ||
| - `gh issue list --state open --limit 100 --json number,title,body,labels` | ||
| Look for semantic overlap, not just title similarity. Two PRs that fix the | ||
| same bug in different ways are duplicates. Flag every duplicate you find with | ||
| its number and a one-line explanation of why they overlap. | ||
|
|
||
| ### 2. Quality signals (PRs only) | ||
| If this is a pull request, evaluate: | ||
| - **Code quality**: Read the diff with `gh pr diff {{.Number}}`. Look for | ||
| correctness, test coverage, error handling, and style consistency. | ||
| - **Description quality**: Is the problem clearly stated? Is the approach explained? | ||
| - **Scope**: Is it a focused change or does it bundle unrelated modifications? | ||
| - **Test coverage**: Does it add or update tests for the changed behavior? | ||
| - **Breaking changes**: Does it modify public APIs or config formats? | ||
| Rate the PR: STRONG / ACCEPTABLE / NEEDS WORK / REJECT. | ||
|
|
||
| ### 3. Vision alignment | ||
| OpenClaw's vision: a personal AI assistant that is open-source, privacy-first, | ||
| and runs on user-owned hardware. Any PR that undermines these principles | ||
| (e.g., adding telemetry, requiring a hosted service, removing self-host | ||
| capability) should be flagged as MISALIGNED with a clear explanation. | ||
|
|
||
| ## Output | ||
| Post exactly one comment on this {{.Kind}} using: | ||
| `gh {{if eq .Kind "pull_request"}}pr{{else}}issue{{end}} comment {{.Number}} --body "..."` | ||
|
|
||
| Format the comment as: | ||
|
|
||
| ``` | ||
| ## Axon Triage Report | ||
|
|
||
| **Duplicates found**: #X (reason), #Y (reason) — or "None found" | ||
|
|
||
| **Quality** (PRs only): STRONG / ACCEPTABLE / NEEDS WORK / REJECT | ||
| - Code: ... | ||
| - Tests: ... | ||
| - Scope: ... | ||
|
|
||
| **Vision alignment**: ALIGNED / MISALIGNED | ||
| - ... | ||
|
|
||
| **Recommendation**: MERGE / REVISE / CLOSE AS DUPLICATE / NEEDS MAINTAINER REVIEW | ||
| ``` | ||
|
|
||
| Do NOT open PRs, push code, or modify any files. Read-only analysis only. | ||
| ttlSecondsAfterFinished: 3600 | ||
| pollInterval: 3m | ||
| maxConcurrency: 5 | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| apiVersion: axon.io/v1alpha1 | ||
| kind: Workspace | ||
| metadata: | ||
| name: openclaw | ||
| spec: | ||
| repo: https://github.com/openclaw/openclaw.git | ||
| ref: main | ||
| secretRef: | ||
| name: openclaw-github-token |
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
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.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P2: TTL value inconsistent with README: the YAML sets
3600(1 hour), but the README documents600(10 min) and explicitly says "completed tasks are cleaned up after 10 min". One of them needs to be updated to match the other.Prompt for AI agents