refactor(foreman): iterative review loop + CI gate phases#78
Conversation
There was a problem hiding this comment.
Pull request overview
Refactors the GitHub Foreman agent workflow definition to move from a single-pass review process to an iterative review loop, add a CI-based gate, and renumber subsequent phases.
Changes:
- Replaces Phase 3 with an iterative “Code Review Loop” that waits for Copilot reviews, judges comments, and requests targeted
@copilotfixes until stabilized. - Replaces the previous QA Enforcer/human gate step with a CI check polling gate (Phase 4), looping back to Phase 3 on failures.
- Consolidates post-review activities into a single “Docs & Consistency” phase and renumbers Human Gate/Advance phases.
| - qa-enforcer | ||
| - go-developer | ||
| - prettify | ||
| - Explore |
There was a problem hiding this comment.
The agents: list includes Explore, but there is no corresponding .github/agents/Explore.agent.md (or any other agent definition) in the repo. This will fail when Foreman tries to invoke that subagent; either add the missing agent file or remove/rename this entry to a valid agent name.
| - Explore |
| ### Phase 3: Code Review Loop | ||
|
|
||
| When PRs are created by the coding agents: | ||
| This phase is iterative. It runs automatically and loops until Foreman judges there are no more actionable comments across all PRs. | ||
|
|
||
| 1. **Automated code review** — Use `mcp_github_request_copilot_review` on each PR. The Code Review Agent automatically applies guidance from `.github/copilot-instructions.md`. | ||
| 2. **Cross-PR consistency** (multi-PR waves only) — Run the **Wave Reviewer** subagent to check consistency across all PRs in the wave. | ||
| 3. **Quality check** — Run the **QA Enforcer** subagent to verify builds, tests, and coverage on each branch. | ||
| 4. **Documentation check** — Run the **Docs Writer** subagent to verify README and AGENTS.md are updated if the wave adds/changes commands. | ||
| 5. **Collect Code Review Agent comments** — Use `mcp_github_pull_request_read` with `method: "get_review_comments"` on each PR to pull in all review comments left by the Code Review Agent (and any other reviewers). Summarize findings by severity: | ||
| - **Blocking** — security issues, logic errors, broken tests | ||
| - **Suggestions** — style improvements, naming, refactoring opportunities | ||
| - **Informational** — notes, questions, minor observations | ||
| 6. **Synthesize results** — Compile findings from all checks into a summary for the human. Include the Code Review Agent's comments grouped by PR and severity. | ||
| 1. **Mark PRs ready for review** — Use `github/pull_request_write` to convert each draft PR to ready-for-review. The repo ruleset automatically triggers the Copilot Code Review Agent. If the ruleset fails to assign the agent within the polling window, use `github/request_copilot_review` as a fallback. |
There was a problem hiding this comment.
This PR claims all mcp_github_* tool references were updated to github/*, but the file still contains mcp_github_* usages (e.g., Phases 1/1b/2/2b). That’s inconsistent with the tools: list (which only declares github/*) and will cause the Foreman instructions to reference non-existent tools. Update the remaining mcp_github_* references to the corresponding github/* tool names for consistency.
…ub_ refs in phases 1/1b/2/2b
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.
Comments suppressed due to low confidence (2)
.github/agents/github-foreman.agent.md:183
- The instructions refer to a
todostool, but the frontmatter declares the tool astodo. This mismatch will cause the agent to look for a non-existent tool name; either update the text totodoor rename the tool entry totodosconsistently throughout the file.
This issue also appears on line 196 of the same file.
1. Update your wave tracking (`todos`) — mark all issues as merged
2. Identify the next unblocked wave
3. Return to Phase 1 for the next wave
.github/agents/github-foreman.agent.md:199
- The instructions refer to the
todostool here, but the frontmatter liststodo. Align the tool name (either change these references totodoor change the declared tool totodos) so the workflow is executable.
3. **Always complete the full review pipeline** before presenting for human review — don't skip the code review loop (Phase 3), CI gate (Phase 4), or docs check (Phase 5).
4. **Use `custom_instructions`** to give coding agents issue-specific context beyond the issue body — reference relevant skills, architecture decisions, and file locations.
5. **Track everything** with the `todos` tool — every issue should have a trackable status (planned → dispatched → PR created → reviewed → merged).
6. **Keep `.github/copilot-instructions.md` and `AGENTS.md` in sync** — when your wave changes CLI structure, ensure the Docs Writer updates both.
| agents: | ||
| - wave-reviewer | ||
| - docs-writer | ||
| - qa-enforcer | ||
| - go-developer | ||
| - prettify |
There was a problem hiding this comment.
PR description says "qa-enforcer removed from agents", but the repo still contains .github/agents/qa-enforcer.agent.md and .github/agents/references/foreman-workflows.md still models QA Enforcer as part of the workflow. Either delete/retire the qa-enforcer agent + update the reference doc, or adjust the PR description to clarify it's only removed from the Foreman’s agents: list (not removed from the repo).
| 2. **Wait for review completion** — Sleep **5 minutes** (`Start-Sleep -Seconds 300`), then poll in **2-minute** cycles (`Start-Sleep -Seconds 120`). Use `github/pull_request_read` with `method: "get_reviews"` on each PR until the Code Review Agent's review shows `status: completed` on all PRs. | ||
|
|
||
| 3. **Collect and judge comments** — Use `github/pull_request_read` with `method: "get_review_comments"` on each PR. Internally bucket all comments by severity — this summary is for Foreman's judgment only, not presented to the human yet: | ||
| - **Blocking** — security issues, logic errors, incorrect behaviour |
There was a problem hiding this comment.
Spelling is inconsistent with the rest of the repo docs (which use US English). Consider changing "behaviour" to "behavior" for consistency.
| - **Blocking** — security issues, logic errors, incorrect behaviour | |
| - **Blocking** — security issues, logic errors, incorrect behavior |
|
@copilot open a new pull request to apply changes based on the comments in this thread |
… diagrams (#80) * Initial plan * fix(foreman): behavior spelling, remove QA Enforcer from reference diagrams Co-authored-by: ewega <26189114+ewega@users.noreply.github.com> * fix(foreman): update remaining MCP: edge labels to github/* style Co-authored-by: ewega <26189114+ewega@users.noreply.github.com> * fix(foreman): accurate node label + github/pull_request_read CI gate step Co-authored-by: ewega <26189114+ewega@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: ewega <26189114+ewega@users.noreply.github.com>
| %% Foreman triggers code review | ||
| F -->|"MCP: request_copilot_review"| CRA | ||
| F -->|"github/request_copilot_review"| CRA | ||
| CRA -->|"review comments"| PR1 | ||
| CRA -->|"review comments"| PR2 | ||
| CRA -.->|"reads review guidance"| CI | ||
| CRA -.->|"reads review guidance"| INST |
There was a problem hiding this comment.
In the interaction diagram, Foreman is shown always triggering code review via github/request_copilot_review, but the updated workflow text describes the primary trigger as marking a PR ready-for-review (ruleset auto-assigns the Code Review Agent) with request_copilot_review only as fallback. Please update this arrow/label to reflect the ruleset-driven trigger to keep the diagram consistent with the new Phase 3 loop.
See below for a potential fix:
%% Code review is primarily triggered by PR ready-for-review ruleset
PR1 -->|"mark ready for review<br/>(ruleset assigns Code Review Agent)"| CRA
PR2 -->|"mark ready for review<br/>(ruleset assigns Code Review Agent)"| CRA
F -->|"github/request_copilot_review<br/>(fallback trigger)"| CRA
There was a problem hiding this comment.
@copilot open a new pull request to apply changes based on this feedback
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…#81) * Initial plan * Update interaction diagram to reflect ruleset-driven code review trigger Co-authored-by: ewega <26189114+ewega@users.noreply.github.com> * Update .github/agents/references/foreman-workflows.md Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: ewega <26189114+ewega@users.noreply.github.com> Co-authored-by: Eldrick Wega <ewega@github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Summary
Restructures the GitHub Foreman workflow from a single-pass review model to an iterative, automated pipeline:
Phase changes
Key changes
Validation