-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Agent Workflow Metrics via GitHub Labels #33986
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,171 @@ | ||||||
| # Agent Workflow Labels | ||||||
|
|
||||||
| GitHub labels for tracking outcomes of the AI agent PR review workflow (`Review-PR.ps1`). | ||||||
|
|
||||||
| All labels use the **`s/agent-*`** prefix for easy querying on GitHub. | ||||||
|
|
||||||
| --- | ||||||
|
|
||||||
| ## Label Categories | ||||||
|
|
||||||
| ### Outcome Labels | ||||||
|
|
||||||
| Mutually exclusive β exactly **one** is applied per PR review run. | ||||||
|
|
||||||
| | Label | Color | Description | Applied When | | ||||||
| |-------|-------|-------------|--------------| | ||||||
| | `s/agent-approved` | π’ `#2E7D32` | AI agent recommends approval β PR fix is correct and optimal | Report phase recommends APPROVE | | ||||||
| | `s/agent-changes-requested` | π `#E65100` | AI agent recommends changes β found a better alternative or issues | Report phase recommends REQUEST CHANGES | | ||||||
| | `s/agent-review-incomplete` | π΄ `#B71C1C` | AI agent could not complete all phases (blocker, timeout, error) | Agent exits without completing all phases | | ||||||
|
|
||||||
| When a new outcome label is applied, any previously applied outcome label is automatically removed. | ||||||
|
|
||||||
| ### Signal Labels | ||||||
|
|
||||||
| Additive β **multiple** can coexist on a single PR. | ||||||
|
|
||||||
| | Label | Color | Description | Applied When | | ||||||
| |-------|-------|-------------|--------------| | ||||||
| | `s/agent-gate-passed` | π’ `#4CAF50` | AI verified tests catch the bug (fail without fix, pass with fix) | Gate phase passes | | ||||||
| | `s/agent-gate-failed` | π `#FF9800` | AI could not verify tests catch the bug | Gate phase fails | | ||||||
| | `s/agent-fix-win` | π’ `#66BB6A` | AI found a better alternative fix than the PR | Fix phase: alternative selected over PR's fix | | ||||||
| | `s/agent-fix-pr-picked` | π `#FF7043` | AI could not beat the PR fix β PR is the best among all candidates | Fix phase: PR selected as best after comparison | | ||||||
|
|
||||||
| Gate labels (`gate-passed`/`gate-failed`) are mutually exclusive with each other. Fix labels (`fix-win`/`fix-lose`) are mutually exclusive with each other. | ||||||
|
|
||||||
| ### Tracking Label | ||||||
|
|
||||||
| Always applied on every completed agent run. | ||||||
|
|
||||||
| | Label | Color | Description | Applied When | | ||||||
| |-------|-------|-------------|--------------| | ||||||
| | `s/agent-reviewed` | π΅ `#1565C0` | PR was reviewed by AI agent workflow (full 4-phase review) | Every completed agent run | | ||||||
|
|
||||||
| ### Manual Label | ||||||
|
|
||||||
| Applied by MAUI maintainers, not by automation. | ||||||
|
|
||||||
| | Label | Color | Description | Applied When | | ||||||
| |-------|-------|-------------|--------------| | ||||||
| | `s/agent-fix-implemented` | π£ `#7B1FA2` | PR author implemented the agent's suggested fix | Maintainer applies when PR author adopts agent's recommendation | | ||||||
|
|
||||||
| --- | ||||||
|
|
||||||
| ## How It Works | ||||||
|
|
||||||
| ### Architecture | ||||||
|
|
||||||
| ``` | ||||||
| Review-PR.ps1 | ||||||
| βββ Phase 1: PR Agent Review (Copilot CLI) | ||||||
| β βββ Pre-Flight β writes content.md | ||||||
| β βββ Gate β writes content.md | ||||||
| β βββ Fix β writes content.md | ||||||
| β βββ Report β writes content.md | ||||||
| βββ Phase 2: PR Finalize (optional) | ||||||
| βββ Phase 3: Post Comments (optional) | ||||||
| βββ Phase 4: Apply Labels β labels are applied here | ||||||
| βββ Parse content.md files | ||||||
| βββ Determine outcome + signal labels | ||||||
| βββ Apply via GitHub REST API | ||||||
| βββ Non-fatal: errors warn but don't fail the workflow | ||||||
| ``` | ||||||
|
|
||||||
| Labels are applied exclusively from `Review-PR.ps1` Phase 4. No other script applies agent labels. This single-source design avoids label conflicts and simplifies debugging. | ||||||
|
|
||||||
| ### How Labels Are Parsed | ||||||
|
|
||||||
| The `Parse-PhaseOutcomes` function in `Update-AgentLabels.ps1` reads `content.md` files from each phase directory: | ||||||
|
|
||||||
| | Source File | What's Parsed | Resulting Label | | ||||||
| |-------------|---------------|-----------------| | ||||||
| | `gate/content.md` | `**Result:** β PASSED` | `s/agent-gate-passed` | | ||||||
| | `gate/content.md` | `**Result:** β FAILED` | `s/agent-gate-failed` | | ||||||
| | `try-fix/content.md` | `**Selected Fix:** Candidate ...` | `s/agent-fix-win` | | ||||||
| | `try-fix/content.md` | `**Selected Fix:** PR ...` | `s/agent-fix-pr-picked` | | ||||||
| | `report/content.md` | `Final Recommendation: APPROVE` | `s/agent-approved` | | ||||||
| | `report/content.md` | `Final Recommendation: REQUEST CHANGES` | `s/agent-changes-requested` | | ||||||
| | *(missing report)* | No report file exists | `s/agent-review-incomplete` | | ||||||
|
|
||||||
| ### Self-Bootstrapping | ||||||
|
|
||||||
| Labels are created automatically on first use via `Ensure-LabelExists`. No manual setup required. If a label already exists but has a stale description or color, it is updated. | ||||||
|
|
||||||
| --- | ||||||
|
|
||||||
| ## Querying Labels | ||||||
|
|
||||||
| All labels use the `s/agent-*` prefix, making them easy to filter on GitHub. | ||||||
|
|
||||||
| ### Common Queries | ||||||
|
|
||||||
| ``` | ||||||
| # PRs the agent approved | ||||||
| is:pr label:s/agent-approved | ||||||
|
|
||||||
| # PRs where agent found a better fix | ||||||
|
||||||
| # PRs where agent found a better fix | |
| # PRs where agent could NOT beat the PR fix (PR fix was best) |
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.
The label name
s/agent-fix-pr-pickedin the code does not match the documentation which refers to it ass/agent-fix-lose.In the documentation at line 34, the table mentions "Fix labels (
fix-win/fix-lose)" suggesting the label should be calleds/agent-fix-lose, but the actual label defined in Update-AgentLabels.ps1 line 35 iss/agent-fix-pr-picked.Either the code should use
s/agent-fix-loseto match the documentation's naming pattern, or the documentation should be updated to consistently uses/agent-fix-pr-picked. The current mismatch could cause confusion when users try to query these labels.