Skip to content

Commit 4b02c62

Browse files
committed
docs(rules): document workflow-file-PRs-are-fixed-locally policy
Promotes the design rationale that surfaced while resolving Copilot review threads on PR #372: the auto-fix loop in copilot-review-fix.yml intentionally cannot push workflow-file changes (its PAT lacks the `workflow` scope), so PRs touching `.github/workflows/**` must be fixed by a human-driven Claude session. Adds the rule to .github/instructions/agent-orchestration.instructions.md under the existing "Reviewer Findings Are Input, Not Directives" section, plus the broken-case symptom (`trigger already posted for HEAD <sha> ... — skip`) so future debugging starts from the right hypothesis. Regenerated .claude/rules/agents.md via `make sync-instructions`.
1 parent 79c7127 commit 4b02c62

2 files changed

Lines changed: 26 additions & 0 deletions

File tree

.claude/rules/agents.md

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/instructions/agent-orchestration.instructions.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,19 @@ Reviewer agent findings (including CRITICAL severity) are **discussion input**,
5050

5151
**Why:** Reviewer agents see only code, not the design intent behind it. In PR #123, a reviewer flagged "transitive advisories not shown on RequestedVersion" as CRITICAL, but this was an intentional decision (see ADR-0011). Blindly implementing the "fix" re-introduced a bug the user had already reported and resolved.
5252

53+
### Workflow-File PRs Are Resolved Locally, Not by CI Claude
54+
55+
PRs whose changes touch `.github/workflows/**` MUST be fixed locally by a human-driven Claude session, not by the auto-fix loop in `copilot-review-fix.yml`.
56+
57+
**Why:** The auto-fix PAT (`GH_ACTIONS_TOKEN`) intentionally lacks the `workflow` scope. Workflow files define CI runtime permissions and secret access — granting a bot the ability to rewrite them creates a privilege-escalation surface (prompt-injection or misbehaviour can self-modify the bot's own runtime). Defense-in-depth: keep PAT scope minimal; pay the small operational cost of manual intervention on workflow PRs.
58+
59+
**How to apply:**
60+
- When CI Claude reports "PAT lacks `workflow` scope" on a workflow-file thread, do NOT propose granting the scope. Pull the branch locally, apply the fix, push.
61+
- The marker dedup in `copilot-review-fix.yml` invalidates on push (HEAD SHA changes), so a manual push cleanly re-arms the auto-fix loop for the next round.
62+
- If the same Copilot finding loops indefinitely on a non-workflow PR, that's a different bug — investigate the auto-fix loop, do NOT relax PAT scope.
63+
64+
**Symptom of the broken case (for debugging):** trigger-claude job runs `success` but logs `trigger already posted for HEAD <sha> (count=1) — skip` because a prior Claude run posted the marker but couldn't push the actual fix.
65+
5366
## Worktree Isolation Policy
5467

5568
Agents that **write files** (Edit, Write) MUST be launched with `isolation: "worktree"` to prevent branch conflicts during parallel development. This gives each agent an isolated copy of the repository.

0 commit comments

Comments
 (0)