fix(#1037): add re-review anchoring and coherence check to risk assessment - #1038
Conversation
…sment The risk assessment sub-agent produced inconsistent scores across consecutive runs on the same PR when deterministic Tier 1 signals were unchanged. The rationale described the same low-risk characteristics but the score drifted (e.g., 1 → 2) because: (1) the sub-agent evaluated each run independently with no anchoring to prior scores, and (2) no coherence check validated that the rationale justified the assigned score. Changes: - Orchestrator (pr-review/SKILL.md step 3c-2): fetch the prior risk assessment sticky comment on re-reviews and pass it to the sub-agent as context for anchoring. - Sub-agent (risk-assessment.md): add re-review anchoring rules that preserve the prior score when Tier 1 signals are unchanged, and require the rationale to explain any score delta. Add a score-rationale coherence check before returning. - Scoring model (pr-risk-assessment/SKILL.md): add a coherence verification step (step 8) that cross-checks the rationale against the scoring guidance tables and anchoring examples, flagging cases where described characteristics map to a different score. Closes #1037
|
🤖 Finished Review · ✅ Success · Started 8:11 AM UTC · Completed 8:32 AM UTC Commit: Runtime: claude · Model: opus → claude-opus-4-6 · Effort: high · Cost: $5.27 |
|
Risk Assessment: moderate (2/5) DetailsSmall prompt-only change (3 markdown files, 100 lines) by a bot author with clear issue alignment, offset by high protected-path count (skills/) and elevated churn/regression history on SKILL.md; overall risk is moderate. Previous runRisk Assessment: moderate (2/5) DetailsSmall, well-scoped docs/config-only PR (3 files, 116 lines) by a known bot author with no security-sensitive, CI, or dependency changes; elevated protected path count (3) is the primary Tier 1 risk driver, and high churn on skills/pr-review/SKILL.md (20 commits in 30d, 10 distinct authors) elevates Tier 2, offset by low Tier 3 issue risk (well-scoped bug fix, no unresolved discussions). Re-review anchoring: signals unchanged from prior assessment — score preserved at 2. Previous run (2)Risk Assessment: moderate (2/5) DetailsSmall, well-scoped docs/config-only PR (3 files, 108 lines) by a known bot author with no security-sensitive, CI, or dependency changes; elevated protected path count (3) is the primary Tier 1 risk driver, and high churn on skills/pr-review/SKILL.md elevates Tier 2, offset by low Tier 3 issue risk. Previous run (3)Risk Assessment: moderate (2/5) DetailsSmall, well-scoped docs/config-only PR by a known bot author that adds anchoring and coherence check mechanisms to the risk assessment sub-agent; elevated git history signals (high churn and multi-author contention on these skill files) are offset by low metadata and issue risk, yielding moderate overall risk. |
ReviewFindingsMedium
Low
Previous runReviewFindingsMedium
Low
Previous run (2)ReviewFindingsMedium
Low
Previous run (3)ReviewFindingsHigh
Medium
Low
Next steps:
|
|
🤖 Finished Fix · ✅ Success · Started 8:34 AM UTC · Completed 8:39 AM UTC Commit: Runtime: claude · Model: opus → claude-opus-4-6 · Effort: high · Cost: $1.30 |
…on in risk assessment - Fix dangling "parts 1–4" reference to "parts 1–3" (prior risk assessment is a subsection of Part 3, not a separate Part 4) - Update documented comment format to match actual post-review.sh output (blank lines between elements, multi-line details/summary tags) - Add --paginate to gh api call for fetching prior risk comment, consistent with existing patterns in pre-review.sh and other scripts Addresses review feedback on #1038
🔧 Fix agent — iteration 1 (bot-triggered)Addressed 3 of 4 review findings with code fixes. The protected-path finding is informational (human approval required) and needs no code change. Fixed: dangling parts 1–4 cross-reference, comment format mismatch with post-review.sh output, and missing --paginate on gh api call. Fixed (3):
Disagreed (1):
Tests: passedNext steps:
|
|
🤖 Finished Review · ✅ Success · Started 8:41 AM UTC · Completed 9:02 AM UTC Commit: Runtime: claude · Model: opus → claude-opus-4-6 · Effort: high · Cost: $4.80 |
Superseded by updated review
|
/fs-fix fix the review's from the reviewer, reply on the opened threads that are addressed and resolve them |
|
🤖 Finished Fix · ✅ Success · Started 9:07 AM UTC · Completed 9:12 AM UTC Commit: Runtime: claude · Model: opus → claude-opus-4-6 · Effort: high · Cost: $1.32 |
…o procedure - Remove "off by ≥2" qualifier from SKILL.md step 8 coherence check to align with sub-agent's "any difference" threshold, preventing the 1-point drift scenario described in #1037. - Add explicit steps 5-6 to sub-agent procedure referencing the Re-review anchoring and Score-rationale coherence sections. Addresses review feedback on #1038
🔧 Fix agent — iteration 2 (human-triggered)Addressed both review findings: (1) aligned the coherence reconciliation threshold across SKILL.md and risk-assessment.md by removing the >=2 qualifier so any score-rationale mismatch triggers reconciliation, and (2) integrated the new Re-review anchoring and Score-rationale coherence sections into the sub-agent's numbered Procedure as steps 5 and 6. Fixed (2):
Tests: passedNext steps:
|
|
🤖 Finished Review · ✅ Success · Started 9:14 AM UTC · Completed 9:34 AM UTC Commit: Runtime: claude · Model: opus → claude-opus-4-6 · Effort: high · Cost: $5.40 |
|
/fs-fix In Replace the restated coherence procedure in the sub-agent definition with a deferral to the linked skill's step 8, matching the pattern where Procedure step 4 already defers to the linked skill for the scoring model. For example: "Apply the score-rationale coherence check defined in the linked skill's step 8." Also integrate references to "Re-review anchoring" and "Score-rationale coherence" into the numbered Procedure steps (between steps 4 and 5), so the sequencing is explicit. For example: "4a. If prior risk data is provided, apply the Re-review anchoring rules below. 4b. Verify score-rationale coherence before returning." |
|
🤖 Finished Fix · ✅ Success · Started 9:51 AM UTC · Completed 9:56 AM UTC Commit: Runtime: claude · Model: opus → claude-opus-4-6 · Effort: high · Cost: $1.41 |
…nto procedure steps Replace the restated score-rationale coherence procedure in the risk-assessment sub-agent definition with a deferral to the linked skill's step 8, eliminating the redundancy the spawned agent sees when it receives both Part 1 and Part 2. Restructure Procedure steps 5-7 into sub-steps 4a (re-review anchoring) and 4b (coherence check) under step 4, making the sequencing between score computation and verification explicit. Addresses review feedback on #1038
🔧 Fix agent — iteration 3 (human-triggered)Addressed both parts of the human instruction: (1) replaced the restated coherence procedure in the sub-agent definition with a deferral to the linked skill's step 8, and (2) integrated Re-review anchoring and Score-rationale coherence as sub-steps 4a/4b in the Procedure, making sequencing explicit. Fixed (2):
Tests: passedNext steps:
|
|
🤖 Finished Review · ✅ Success · Started 9:58 AM UTC · Completed 10:19 AM UTC Commit: Runtime: claude · Model: opus → claude-opus-4-6 · Effort: high · Cost: $5.85 |
|
🤖 Finished Retro · ✅ Success · Started 12:11 PM UTC · Completed 12:23 PM UTC Commit: Runtime: claude · Model: opus → claude-opus-4-6 · Effort: high · Cost: $4.64 |
|
PR #1038 added re-review anchoring and coherence checking to the risk assessment sub-agent, fixing the score drift reported in issue #1037. The code agent produced the initial PR in ~10 minutes ($3.56), but the PR required 4 review iterations and 3 fix iterations before merging, with two human interventions providing architectural guidance. Total agent cost: ~$25. What went well:
Primary rework driver: The code agent added the same coherence-check procedure to both the sub-agent definition ( Autonomy note: The human reviewer added clear value identifying the deferral-vs-restatement architectural pattern that the review agent missed. For prompt-engineering changes to agent definitions, human review remains essential for design-level decisions. Existing issues with new supporting evidence:
Proposals filed |
Summary
The risk assessment sub-agent produced inconsistent scores across consecutive re-reviews on the same PR when the underlying risk signals hadn't changed. Both rationales described identical low-risk characteristics, but the score drifted (1 → 2) because: (1) the sub-agent evaluated each run independently with no anchoring to prior scores, and (2) no coherence check validated that the rationale actually justified the assigned score.
This PR adds three changes:
Testing
risk-tier1-test.sh— all 42 tests pass (Tier 1 script unchanged)validate-output-schema-test.sh— all schema validation tests pass (risk_assessment schema unchanged)post-review-test.sh— all post-processing tests pass (risk label/comment logic unchanged)Closes #1037
Post-script verification
agent/1037-risk-score-anchoring)b7ef57f8a1a18326cfdcab9056187f1607b60c59..HEAD)