Refactor PR code quality reviewer to use grumpy sub-agent and strict A2A triage#34555
Merged
Conversation
Co-authored-by: pelikhan <[email protected]>
…r triage Co-authored-by: pelikhan <[email protected]>
Co-authored-by: pelikhan <[email protected]>
Co-authored-by: pelikhan <[email protected]>
Copilot created this pull request from a session on behalf of
pelikhan
May 25, 2026 02:59
View session
Collaborator
|
@copilot merge main and recompile |
Contributor
There was a problem hiding this comment.
Pull request overview
Refactors the Copilot-driven “PR Code Quality Reviewer” workflow prompt to use an inline grumpy-coder sub-agent and a stricter triage/escalation model aimed at producing more merge-gating reviews.
Changes:
- Updated reviewer workflow prompt to invoke a
grumpy-codersub-agent, then adjudicate findings viaKEEP/HARDEN/DROPand stricterREQUEST_CHANGESrules. - Added an inline
grumpy-coderagent block with a strict JSONL findings contract. - Applied gofmt/indentation-only changes in two Go test files.
Show a summary per file
| File | Description |
|---|---|
| pkg/cli/forecast_test.go | Whitespace/gofmt-only reformatting within a test. |
| pkg/cli/compile_schedule_calendar_test.go | Whitespace/gofmt-only reformatting within an end-to-end fuzzy schedule test. |
| .github/workflows/pr-code-quality-reviewer.md | Reworked prompt to use a sub-agent + strict triage/escalation, and added the grumpy-coder agent definition. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 1/3 changed files
- Comments generated: 2
Comment on lines
+129
to
+135
| // Reproduce the λ calculation from forecastWorkflow. | ||
| const ( | ||
| historyDays = 30 | ||
| sampledRuns = 15 | ||
| projectedDays = 30 // "month" period | ||
| ) | ||
| observedRunsPerPeriod := float64(sampledRuns) / float64(historyDays) * float64(projectedDays) |
Comment on lines
+320
to
+332
| fuzzyExpressions := []struct { | ||
| fuzzyCron string | ||
| workflowID string | ||
| expectedHours int // how many distinct hour values we expect (1 for DAILY patterns) | ||
| }{ | ||
| {"FUZZY:DAILY * * *", "ci-doctor", 1}, | ||
| {"FUZZY:DAILY_WEEKDAYS * * *", "daily-planner", 1}, | ||
| {"FUZZY:DAILY_AROUND:14:0 * * *", "weekly-audit", 1}, | ||
| } | ||
|
|
||
| totalSlots := 0 | ||
| for _, day := range grid { | ||
| for _, count := range day { | ||
| totalSlots += count | ||
| } | ||
| } | ||
| assert.Greater(t, totalSlots, 0, | ||
| "grid should contain at least one scheduled slot for %s", scatteredCron) | ||
|
|
||
| // Step 4: displayScheduleCalendar should produce output referencing the hour. | ||
| oldStderr := os.Stderr | ||
| r, w, pipeErr := os.Pipe() | ||
| require.NoError(t, pipeErr) | ||
| os.Stderr = w | ||
|
|
||
| displayScheduleCalendar(statsList) | ||
|
|
||
| w.Close() | ||
| os.Stderr = oldStderr | ||
|
|
||
| var buf bytes.Buffer | ||
| _, _ = buf.ReadFrom(r) | ||
| output := buf.String() | ||
|
|
||
| assert.Contains(t, output, "Schedule Heatmap", | ||
| "output should contain Schedule Heatmap header") | ||
| // The hour from the scattered cron should appear in the output. | ||
| for _, h := range hours { | ||
| hourStr := fmt.Sprintf("%02d", h) | ||
| assert.Contains(t, output, hourStr, | ||
| "output should contain hour %s from scattered cron %s", hourStr, scatteredCron) | ||
| } | ||
| }) | ||
| } | ||
| for _, tt := range fuzzyExpressions { | ||
| t.Run(fmt.Sprintf("%s/%s", tt.fuzzyCron, tt.workflowID), func(t *testing.T) { | ||
| // Step 1: scatter the fuzzy expression to a real cron string. |
Co-authored-by: pelikhan <[email protected]>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The PR code quality reviewer was too friendly and low-signal. This change rewires it around a dedicated grumpy sub-agent and explicit agent-to-agent adjudication so reviews are materially more critical and merge-gating is more deterministic.
Prompt architecture
grumpy-coderto perform a hostile first-pass over changed lines.A2A adjudication model
KEEP,HARDEN,DROP.Decision policy hardening
REQUEST_CHANGES(severity/count/impact based), including fallback behavior when sub-agent output is malformed.Sub-agent contract tightening
grumpy-coderfindings.