fix(#297): add schema constraint rejecting approve with protected-path findings#303
Conversation
…h findings The review agent could output action=approve despite detecting protected-path modifications because the constraint was narrative only — no mechanical enforcement existed. The LLM would generate text about not being able to approve, then still emit approve in the structured output. Changes: - review-result.schema.json: add an allOf if/then/not rule that rejects action=approve when any finding has category "protected-path". This provides defense-in-depth at validation time — the harness now rejects the result before the post-script even runs. - SKILL.md (pr-review): strengthen the protected-path section to explicitly state that emitting a structured finding is mandatory and that the schema enforces the constraint, making it clear the finding object cannot be omitted. - validate-output-schema-test.sh: add 4 test cases covering the new constraint (approve+protected-path rejected, comment+ protected-path valid, request-changes+protected-path valid, approve without protected-path valid). Note: pre-commit could not run in sandbox (network restricted). Post-script runs authoritative pre-commit on the runner. Closes #297
|
/fs-review |
|
🤖 Finished Review · ✅ Success · Started 6:41 AM UTC · Completed 6:58 AM UTC |
ReviewFindingsMedium
Low
Labels: PR modifies review agent schema enforcement and skill documentation |
|
🤖 Finished Retro · ✅ Success · Started 7:23 AM UTC · Completed 7:35 AM UTC |
Retro: PR #303 — Schema constraint for protected-path approval enforcementTimeline
AssessmentThis was a well-executed end-to-end autonomous workflow. The retro agent identified a real governance bug on PR #195, the triage agent classified it correctly with a detailed root-cause hypothesis, and the code agent produced a clean fix in a single attempt — zero rework. The review agent verified correctness (zero findings from the opus correctness sub-agent) and correctly applied the The code agent's scope was appropriately limited to the 3 files the issue called for. The review agent's docs-currency sub-agent found two low-severity references in Evidence supporting existing issues
Autonomy signalThe review agent's correctness sub-agent (opus) verified the JSON Schema No new proposals — existing issues #351 and #304 cover the identified improvement opportunities. |
Summary
allOfif/then/not rule) inreview-result.schema.jsonthat rejectsaction: "approve"when any finding hascategory: "protected-path". This provides mechanical defense-in-depth — the harness validation now catches the violation before the post-script runs.skills/pr-review/SKILL.mdto explicitly require a structured finding object (not just narrative text) and reference the schema enforcement. The agent now sees that omitting the finding is the only way an approval can slip through.validate-output-schema-test.shcovering the new constraint: approve+protected-path rejected, comment+protected-path valid, request-changes+protected-path valid, approve without protected-path findings valid.Context
The review agent detected protected-path modifications and generated narrative text saying it cannot approve, but still emitted
action: "approve"in the structured output (observed on PR #195 and PR #37). The SKILL.md had rules against this, but they were narrative-only — no structured mechanism enforced them. This fix adds mechanical enforcement at the schema validation layer.Test plan
action=approve+category=protected-pathfinding → rejectedaction=comment+category=protected-pathfinding → validaction=request-changes+category=protected-pathfinding → validaction=approve+ non-protected-path findings → validCloses #297
Post-script verification
agent/297-enforce-protected-path-verdict)c65eba2a790ebfff571a2a00a06fd1ec3524e934..HEAD)