GeezerVison is showing github.com — core: simplify triage workflow to focus on issue ownership · yangg/opencode@a08e4c9
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboard +7-19Lines changed: 7 additions & 19 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | --- | 2 | 2 | mode: primary | 3 | 3 | hidden: true | 4 | | -model: opencode/qwen3.6-plus | | 4 | +model: opencode/gpt-5.4-nano | 5 | 5 | color: "#44BA81" | 6 | 6 | tools: | 7 | 7 | "*": false | @@ -14,42 +14,30 @@ Use your github-triage tool to triage issues. | 14 | 14 |
| 15 | 15 | This file is the source of truth for ownership/routing rules. | 16 | 16 |
| 17 | | -Assign issues by choosing the team with the strongest overlap, then assign a member from that team at random. | | 17 | +Assign issues by choosing the team with the strongest overlap. The github-triage tool will assign a random member from that team. | | 18 | + | | 19 | +Do not add labels to issues. Only assign an owner. | | 20 | + | | 21 | +When calling github-triage, pass one of these team values: tui, desktop_web, core, inference, windows. | 18 | 22 |
| 19 | 23 | ## Teams | 20 | 24 |
| 21 | 25 | ### TUI | 22 | 26 |
| 23 | 27 | Terminal UI issues, including rendering, keybindings, scrolling, terminal compatibility, SSH behavior, crashes in the TUI, and low-level TUI performance. | 24 | 28 |
| 25 | | -- kommander | 26 | | -- simonklee | 27 | | - | 28 | 29 | ### Desktop / Web | 29 | 30 |
| 30 | 31 | Desktop application and browser-based app issues, including `opencode web`, desktop-specific UI behavior, packaging, and web view problems. | 31 | 32 |
| 32 | | -- Hona | 33 | | -- Brendonovich | 34 | | - | 35 | 33 | ### Core | 36 | 34 |
| 37 | | -Core opencode server and harness issues, including sqlite, snapshots, memory, API behavior, agent context construction, tool execution, provider integrations, model behavior, and larger architectural features. | 38 | | - | 39 | | -- jlongster | 40 | | -- rekram1-node | 41 | | -- nexxeln | 42 | | -- kitlangton | | 35 | +Core opencode server and harness issues, including sqlite, snapshots, memory, API behavior, agent context construction, tool execution, provider integrations, model behavior, documentation, and larger architectural features. | 43 | 36 |
| 44 | 37 | ### Inference | 45 | 38 |
| 46 | 39 | OpenCode Zen, OpenCode Go, and billing issues. | 47 | 40 |
| 48 | | -- fwang | 49 | | -- MrMushrooooom | 50 | | - | 51 | 41 | ### Windows | 52 | 42 |
| 53 | 43 | Windows-specific issues, including native Windows behavior, WSL interactions, path handling, shell compatibility, and installation or runtime problems that only happen on Windows. | 54 | | - | 55 | | -- Hona |
Collapse file Copy file name to clipboard +10-68Lines changed: 10 additions & 68 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | /// <reference path="../env.d.ts" /> | 2 | 2 | import { tool } from "@opencode-ai/plugin" | | 3 | + | 3 | 4 | const TEAM = { | 4 | | - desktop: ["adamdotdevin", "iamdavidhill", "Brendonovich", "nexxeln"], | 5 | | - zen: ["fwang", "MrMushrooooom"], | 6 | | - tui: ["kommander", "rekram1-node", "simonklee"], | 7 | | - core: ["kitlangton", "rekram1-node", "jlongster"], | 8 | | - docs: ["R44VC0RP"], | | 5 | + tui: ["kommander", "simonklee"], | | 6 | + desktop_web: ["Hona", "Brendonovich"], | | 7 | + core: ["jlongster", "rekram1-node", "nexxeln", "kitlangton"], | | 8 | + inference: ["fwang", "MrMushrooooom"], | 9 | 9 | windows: ["Hona"], | 10 | 10 | } as const | 11 | 11 |
| 12 | | -const ASSIGNEES = [...new Set(Object.values(TEAM).flat())] | 13 | | - | 14 | 12 | function pick<T>(items: readonly T[]) { | 15 | 13 | return items[Math.floor(Math.random() * items.length)]! | 16 | 14 | } | @@ -38,79 +36,23 @@ async function githubFetch(endpoint: string, options: RequestInit = {}) { | 38 | 36 | } | 39 | 37 |
| 40 | 38 | export default tool({ | 41 | | - description: `Use this tool to assign and/or label a GitHub issue. | | 39 | + description: `Use this tool to assign a GitHub issue. | 42 | 40 |
| 43 | | -Choose labels and assignee using the current triage policy and ownership rules. | 44 | | -Pick the most fitting labels for the issue and assign one owner. | 45 | | -
| 46 | | -If unsure, choose the team/section with the most overlap with the issue and assign a member from that team at random.`, | | 41 | +Provide the team that should own the issue. This tool picks a random assignee from that team and does not apply labels.`, | 47 | 42 | args: { | 48 | | - assignee: tool.schema | 49 | | - .enum(ASSIGNEES as [string, ...string[]]) | 50 | | - .describe("The username of the assignee") | 51 | | - .default("rekram1-node"), | 52 | | - labels: tool.schema | 53 | | - .array(tool.schema.enum(["nix", "opentui", "perf", "web", "desktop", "zen", "docs", "windows", "core"])) | 54 | | - .describe("The labels(s) to add to the issue") | 55 | | - .default([]), | | 43 | + team: tool.schema.enum(Object.keys(TEAM) as [keyof typeof TEAM, ...(keyof typeof TEAM)[]]).describe("The owning team"), | 56 | 44 | }, | 57 | 45 | async execute(args) { | 58 | 46 | const issue = getIssueNumber() | 59 | 47 | const owner = "anomalyco" | 60 | 48 | const repo = "opencode" | 61 | | - | 62 | | - const results: string[] = [] | 63 | | - let labels = [...new Set(args.labels.map((x) => (x === "desktop" ? "web" : x)))] | 64 | | - const web = labels.includes("web") | 65 | | - const text = `${process.env.ISSUE_TITLE ?? ""}\n${process.env.ISSUE_BODY ?? ""}`.toLowerCase() | 66 | | - const zen = /\bzen\b/.test(text) || text.includes("opencode black") | 67 | | - const nix = /\bnix(os)?\b/.test(text) | 68 | | - | 69 | | - if (labels.includes("nix") && !nix) { | 70 | | - labels = labels.filter((x) => x !== "nix") | 71 | | - results.push("Dropped label: nix (issue does not mention nix)") | 72 | | - } | 73 | | - | 74 | | - const assignee = nix ? "rekram1-node" : web ? pick(TEAM.desktop) : args.assignee | 75 | | - | 76 | | - if (labels.includes("zen") && !zen) { | 77 | | - throw new Error("Only add the zen label when issue title/body contains 'zen'") | 78 | | - } | 79 | | - | 80 | | - if (web && !nix && !(TEAM.desktop as readonly string[]).includes(assignee)) { | 81 | | - throw new Error("Web issues must be assigned to adamdotdevin, iamdavidhill, Brendonovich, or nexxeln") | 82 | | - } | 83 | | - | 84 | | - if ((TEAM.zen as readonly string[]).includes(assignee) && !labels.includes("zen")) { | 85 | | - throw new Error("Only zen issues should be assigned to fwang or MrMushrooooom") | 86 | | - } | 87 | | - | 88 | | - if (assignee === "Hona" && !labels.includes("windows")) { | 89 | | - throw new Error("Only windows issues should be assigned to Hona") | 90 | | - } | 91 | | - | 92 | | - if (assignee === "R44VC0RP" && !labels.includes("docs")) { | 93 | | - throw new Error("Only docs issues should be assigned to R44VC0RP") | 94 | | - } | 95 | | - | 96 | | - if (assignee === "kommander" && !labels.includes("opentui")) { | 97 | | - throw new Error("Only opentui issues should be assigned to kommander") | 98 | | - } | | 49 | + const assignee = pick(TEAM[args.team]) | 99 | 50 |
| 100 | 51 | await githubFetch(`/repos/${owner}/${repo}/issues/${issue}/assignees`, { | 101 | 52 | method: "POST", | 102 | 53 | body: JSON.stringify({ assignees: [assignee] }), | 103 | 54 | }) | 104 | | - results.push(`Assigned @${assignee} to issue #${issue}`) | 105 | | - | 106 | | - if (labels.length > 0) { | 107 | | - await githubFetch(`/repos/${owner}/${repo}/issues/${issue}/labels`, { | 108 | | - method: "POST", | 109 | | - body: JSON.stringify({ labels }), | 110 | | - }) | 111 | | - results.push(`Added labels: ${labels.join(", ")}`) | 112 | | - } | 113 | 55 |
| 114 | | - return results.join("\n") | | 56 | + return `Assigned @${assignee} from ${args.team} to issue #${issue}` | 115 | 57 | }, | 116 | 58 | }) |
Collapse file Copy file name to clipboard +129Lines changed: 129 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +#!/usr/bin/env bun | | 2 | + | | 3 | +import { parseArgs } from "util" | | 4 | + | | 5 | +async function run(command: string, args: string[], options: Bun.SpawnOptions.OptionsObject = {}) { | | 6 | + const process = Bun.spawn([command, ...args], options) | | 7 | + const status = await process.exited | | 8 | + if (status !== 0) throw new Error(`${command} ${args.join(" ")} exited with ${status}`) | | 9 | + return process | | 10 | +} | | 11 | + | | 12 | +async function text(command: string, args: string[]) { | | 13 | + const process = await run(command, args, { stdout: "pipe", stderr: "inherit" }) | | 14 | + return new Response(process.stdout).text() | | 15 | +} | | 16 | + | | 17 | +async function main() { | | 18 | + const { values } = parseArgs({ | | 19 | + args: Bun.argv.slice(2), | | 20 | + options: { | | 21 | + days: { type: "string", short: "d", default: "30" }, | | 22 | + limit: { type: "string", short: "l", default: "200" }, | | 23 | + "dry-run": { type: "boolean", default: false }, | | 24 | + help: { type: "boolean", short: "h", default: false }, | | 25 | + }, | | 26 | + }) | | 27 | + | | 28 | + if (values.help) { | | 29 | + console.log(` | | 30 | +Usage: bun script/triage-unassigned.ts [options] | | 31 | +
| | 32 | +Triage open GitHub issues created in the last 30 days with no assignee. | | 33 | +
| | 34 | +Options: | | 35 | + -d, --days <days> Look back this many days (default: 30) | | 36 | + -l, --limit <count> Maximum issues to process (default: 200) | | 37 | + --dry-run Print matching issues without running triage | | 38 | + -h, --help Show this help message | | 39 | +
| | 40 | +Examples: | | 41 | + bun script/triage-unassigned.ts | | 42 | + bun script/triage-unassigned.ts --limit 3 | | 43 | + bun script/triage-unassigned.ts --dry-run | | 44 | +`) | | 45 | + process.exit(0) | | 46 | + } | | 47 | + | | 48 | + const days = Number(values.days) | | 49 | + const limit = Number(values.limit) | | 50 | + if (!Number.isInteger(days) || days < 1) throw new Error("--days must be a positive integer") | | 51 | + if (!Number.isInteger(limit) || limit < 1) throw new Error("--limit must be a positive integer") | | 52 | + | | 53 | + const created = new Date(Date.now() - days * 24 * 60 * 60 * 1000).toISOString().slice(0, 10) | | 54 | + const query = `no:assignee created:>=${created}` | | 55 | + const issues = JSON.parse( | | 56 | + await text("gh", [ | | 57 | + "issue", | | 58 | + "list", | | 59 | + "--state", | | 60 | + "open", | | 61 | + "--search", | | 62 | + query, | | 63 | + "--limit", | | 64 | + String(limit), | | 65 | + "--json", | | 66 | + "number,title,body", | | 67 | + ]), | | 68 | + ) as Array<{ number: number; title: string; body?: string | null }> | | 69 | + | | 70 | + console.log(`Found ${issues.length} open unassigned issues created since ${created}`) | | 71 | + if (issues.length === 0) return | | 72 | + | | 73 | + if (values["dry-run"]) { | | 74 | + for (const issue of issues) console.log(`#${issue.number} ${issue.title}`) | | 75 | + return | | 76 | + } | | 77 | + | | 78 | + const githubToken = process.env.GITHUB_TOKEN || (await text("gh", ["auth", "token"])).trim() | | 79 | + const failures: Array<{ issue: number; error: string }> = [] | | 80 | + | | 81 | + for (const [index, issue] of issues.entries()) { | | 82 | + console.log(`\n[${index + 1}/${issues.length}] Triaging #${issue.number} ${issue.title}`) | | 83 | + const result = Bun.spawn( | | 84 | + [ | | 85 | + "opencode", | | 86 | + "run", | | 87 | + "--agent", | | 88 | + "triage", | | 89 | + `The following issue was just opened, triage it: | | 90 | +
| | 91 | +Issue: #${issue.number} | | 92 | +Title: ${issue.title} | | 93 | +
| | 94 | +Body: | | 95 | +${issue.body ?? ""}`, | | 96 | + ], | | 97 | + { | | 98 | + env: { | | 99 | + ...process.env, | | 100 | + GITHUB_TOKEN: githubToken, | | 101 | + ISSUE_NUMBER: String(issue.number), | | 102 | + ISSUE_TITLE: issue.title, | | 103 | + ISSUE_BODY: issue.body ?? "", | | 104 | + }, | | 105 | + stdin: "inherit", | | 106 | + stdout: "inherit", | | 107 | + stderr: "inherit", | | 108 | + }, | | 109 | + ) | | 110 | + const status = await result.exited | | 111 | + | | 112 | + if (status === 0) { | | 113 | + console.log(`[${index + 1}/${issues.length}] Done #${issue.number}`) | | 114 | + continue | | 115 | + } | | 116 | + | | 117 | + failures.push({ issue: issue.number, error: `opencode exited with ${status}` }) | | 118 | + console.error(`[${index + 1}/${issues.length}] Failed #${issue.number}: opencode exited with ${status}`) | | 119 | + } | | 120 | + | | 121 | + console.log(`\nFinished triaging ${issues.length - failures.length}/${issues.length} issues`) | | 122 | + if (failures.length === 0) return | | 123 | + | | 124 | + console.error("Failures:") | | 125 | + for (const failure of failures) console.error(`#${failure.issue}: ${failure.error}`) | | 126 | + process.exit(1) | | 127 | +} | | 128 | + | | 129 | +void main() |
|