Skip to content

Add AI-powered issue triage system with correction tracking#951

Open
MackinnonBuck wants to merge 5 commits intomainfrom
mackinnonbuck/issue-triage-agent
Open

Add AI-powered issue triage system with correction tracking#951
MackinnonBuck wants to merge 5 commits intomainfrom
mackinnonbuck/issue-triage-agent

Conversation

@MackinnonBuck
Copy link
Copy Markdown
Collaborator

Summary

Adds an end-to-end AI-powered issue triage pipeline using GitHub Agentic Workflows. When an issue is created, an AI classifier routes it to a type-specific handler agent that investigates the issue, applies a label, and leaves a comment. Humans can submit corrections via a slash command, which are collected into tracking issues and eventually fed back to improve the agents — creating a continuous improvement loop.

How the flow works

1. Automated triage (on issue create)

A classifier agent reads newly opened issues and routes them to one of four handler workflows based on the issue type: handle-bug, handle-enhancement, handle-question, or handle-documentation.

Each handler is an independent agentic workflow with its own instructions and scope. Some are simple (e.g., the enhancement handler just adds a label), while others do deeper investigation. For example, the bug handler reads the issue, analyzes the relevant source code, attempts to determine whether the behavior is actually a bug or working as designed, and may reclassify the issue if appropriate. Some handlers leave a comment explaining their reasoning.

Handlers run in per-issue concurrency groups so multiple issues can be triaged in parallel without blocking each other.

2. Human correction (on demand)

If the agent's classification was wrong, a human can run the /triage_feedback slash command on the issue. This opens a modal dialog where the user can describe what the agent got wrong and what the correct action should have been. Submitting the form dispatches a repository_dispatch event that triggers the correction collection pipeline.

3. Correction collection (automated)

The collect-corrections workflow:

  1. Parses the slash command payload
  2. Finds (or creates) an open tracking issue labeled triage-agent-tracking
  3. Appends a row to the tracking issue's markdown table with the issue link, feedback, submitter, and date
  4. When the correction count reaches a configurable threshold, auto-assigns Copilot to the tracking issue

4. Addressing corrections (Copilot)

When Copilot is assigned to the tracking issue, it:

  1. Reads each linked correction and the original issues for context
  2. Identifies patterns in misclassifications
  3. Opens a PR with targeted improvements to the agentic workflow instructions
  4. The tracking issue is closed when the PR merges, and a new one is created for future corrections

This creates a flywheel: triage → corrections → improvements → better triage.

What changed

Agentic Workflows

  • Re-initialized gh-aw to the latest version (new agent file, updated lock format)
  • Added 5 agentic workflows: issue-classification.md (classifier) + 4 handlers (handle-bug, handle-enhancement, handle-question, handle-documentation)
  • Fixed 2 existing workflows (issue-triage.md, sdk-consistency-review.md) for new gh-aw syntax (roles: moved under on:)
  • Each handler uses job-discriminator: ${{ inputs.issue_number }} for per-issue concurrency

Correction pipeline

  • Added /triage_feedback slash command (.github/commands/triage_feedback.yml)
  • Added collect-corrections workflow triggered by repository_dispatch
  • Added scripts/corrections/collect-corrections.js — the core collection logic with full JSDoc type annotations (@actions/github types, zero tsc errors)
  • 28 vitest tests covering pure functions and mocked Octokit integration

CI & tooling

  • Added corrections-tests.yml — runs tests on push/PR to scripts/corrections/
  • Added verify-compiled.yml — ensures gh aw compile is run when agentic workflow frontmatter changes
  • Added install-corrections and test-corrections recipes to the justfile, wired into top-level install and test

Implements a delegator-based triage agent using GitHub Agentic Workflows,
a slash-command-driven correction feedback loop, and automated correction
collection with CCA integration.

Key changes:
- Re-initialize gh-aw to latest version
- Add issue classification workflow with 4 type-specific handlers
- Add /triage_feedback slash command and correction collection pipeline
- Add corrections test suite (vitest, 28 tests)
- Add verify-compiled CI check for gh-aw frontmatter changes
- Add corrections-tests CI workflow
- Update justfile with install/test recipes for corrections
- Fix existing workflows for new gh-aw syntax (roles: under on:)
@MackinnonBuck MackinnonBuck requested a review from a team as a code owner March 27, 2026 22:20
Copilot AI review requested due to automatic review settings March 27, 2026 22:20
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds an end-to-end AI-driven GitHub Issue triage + human feedback/correction loop using GitHub Agentic Workflows, plus a small Node-based correction-collector script with tests and CI to keep the pipeline reliable.

Changes:

  • Added an issue classifier workflow and per-type handler workflows (bug/enhancement/question/documentation) using gh-aw compiled lockfiles.
  • Added a /triage_feedback slash command and a repository_dispatch-triggered correction collection workflow backed by scripts/corrections/collect-corrections.js (with Vitest tests).
  • Updated repo automation/tooling: just recipes for installing/testing corrections, and a workflow to verify .lock.yml files are up-to-date.

Reviewed changes

Copilot reviewed 31 out of 35 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
scripts/corrections/collect-corrections.js Implements correction tracking issue discovery/creation, table row appending, and Copilot auto-assignment threshold logic.
scripts/corrections/test/collect-corrections.test.ts Adds unit tests for correction collector helpers and Octokit interactions.
scripts/corrections/package.json / scripts/corrections/tsconfig.json / .gitignore Sets up the corrections script package/tooling for tests and typechecking.
.github/workflows/collect-corrections.yml Runs the correction collector on repository_dispatch events from the slash command.
.github/commands/triage_feedback.yml Defines the /triage_feedback command (modal form) that dispatches correction events.
.github/workflows/issue-classification.md + handler workflows/lockfiles Adds the classifier + handler workflow set for automated issue triage.
.github/workflows/verify-compiled.yml Adds a CI check to ensure gh-aw compilation outputs are committed.
.github/workflows/corrections-tests.yml Adds CI coverage for the corrections script tests.
justfile Integrates corrections install/test into top-level just install and just test.
.github/aw/actions-lock.json and .github/agents/* Updates gh-aw configuration/agent files to the newer gh-aw structure.
Files not reviewed (1)
  • scripts/corrections/package-lock.json: Language not supported

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants