Skip to content

fix: add confidence gates and evidence accumulation to review-reviewers - #1598

Merged
max-sixty merged 5 commits into
mainfrom
fix/issue-1597
Mar 18, 2026
Merged

max-sixty merged 5 commits into
mainfrom
fix/issue-1597

Conversation

@worktrunk-bot

@worktrunk-bot worktrunk-bot commented Mar 17, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

The hourly review-reviewers workflow was creating too many PRs of insufficient quality (#1597). With 12 PRs in 2 days (many closed/rejected), the signal-to-noise ratio was too low now that the skill instructions have matured.

Solution

Two changes to raise the bar while keeping the hourly schedule:

  1. Confidence and magnitude gates — Findings must meet an evidence threshold before acting. Critical issues (wrong issue closed, data loss) need only 1 occurrence. Medium-confidence findings need 5+. Low/nitpick findings are skipped entirely. The size of the proposed change must also be proportionate to the evidence.

  2. Evidence accumulation via monthly tracking issues — Each hourly run reads prior below-threshold findings from a monthly GitHub tracking issue, adds matching historical occurrences to its tally, and records new below-threshold findings for future runs. This lets patterns emerge over days/weeks without needing to switch to nightly or change the lookback window.

Also caps output to 2 PRs per run max, with below-threshold findings recorded in the tracking issue.

Only file changed vs main: .claude/skills/review-reviewers/SKILL.md.

Testing

  • No Rust code changes — skill file only
  • cargo clippy passes
  • cargo test --lib --bins passes

Closes #1597 — automated triage

Switch review-reviewers from hourly to nightly schedule and add two gates
that findings must pass before a PR is created: a confidence gate (requiring
multiple occurrences for non-critical issues) and a magnitude gate (requiring
more evidence for larger changes). Also caps output to 2 PRs per run.

Closes #1597

Co-Authored-By: Claude <[email protected]>
@worktrunk-bot worktrunk-bot added the automated-fix Automated CI fix label Mar 17, 2026
worktrunk-bot added a commit that referenced this pull request Mar 18, 2026
All 3 review sessions in the past window shortcut the codecov step to a
single `grep 'codecov'` instead of using the prescribed 5-iteration
polling loop. This works only when codecov has already reported — a
faster run would report "done" with codecov still pending.

Evidence:
- Run 23222427261 (PR #1599): `gh pr checks | grep 'codecov'`
- Run 23221928911 (PR #1598): `gh pr checks | grep 'codecov/patch'`
- Run 23221490674 (PR #1593): `gh pr checks | grep -E 'codecov|...'`

Changes:
- running-in-ci: Add CRITICAL marker to codecov step, add anti-pattern
  example showing what NOT to do
- review-pr: Explicitly mention codecov polling loop in step 5 instead
  of relying on indirect delegation to running-in-ci

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@max-sixty

Copy link
Copy Markdown
Owner

this is overall good. Some changes:

  • mostly we want to retain the guidance in .claude/skills/review-reviewers/SKILL.md, this is great
  • we don't need to switch to nightly
  • we don't want to change the lookback window. Instead, when assessing whether there are cases from further back, the agent should
    • look at the reviewer outputs from past PRs / issues
      • we may need to redesign how these are done, if it's not easy to grab them — if we make a PR then I guess the are in the PR, but otherwise? Maybe we should make an issue-per-month whose comments get edited with each finding (we don't want a new issue each day / hour)? or is there a way to download lots of artifacts concurrently?
      • this could cause us to switch to nightly if it's too difficult to manage hourly.
    • find cases that might overlap the instance they are seeing
    • look into them if necessary
    • add them to their tally, which drives whether they should suggest the change

…g issues

Retain hourly schedule and default lookback window per review feedback.
Instead of switching to nightly for more data per run, accumulate evidence
across runs using a monthly GitHub tracking issue. Each run reads prior
findings from the tracking issue, adds them to its tally for gate evaluation,
and records below-threshold findings for future runs.

Also reverts unrelated nightly-cleaner change and list-recent-runs.sh
lookback window parameter.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@worktrunk-bot worktrunk-bot changed the title fix: reduce review-reviewers to nightly with confidence gates fix: add confidence gates and evidence accumulation to review-reviewers Mar 18, 2026
@worktrunk-bot

Copy link
Copy Markdown
Collaborator Author

Revised — thanks for the direction. Changes in the latest push:

  1. Kept hourly — reverted the nightly schedule, workflow rename, and list-recent-runs.sh lookback parameter
  2. Kept confidence/magnitude gates in SKILL.md
  3. Added evidence accumulation via monthly tracking issues — new "Evidence accumulation" section in SKILL.md that instructs the agent to:
    • Find or create a review-reviewers tracking: YYYY-MM issue (labeled review-reviewers-tracking)
    • Read prior comments from the tracking issue before applying gates, adding historical occurrences to the tally
    • Record below-threshold findings as structured comments for future runs to pick up

This avoids needing to download artifacts or change the lookback window — each run just reads/writes to a single GitHub issue. The monthly cadence keeps issues from growing unbounded while still carrying evidence forward.

Net diff vs main is now just SKILL.md.

@max-sixty

Copy link
Copy Markdown
Owner

to avoid getting notifications for comments to old issues; could it edit a single comment on the issue?

@worktrunk-bot worktrunk-bot left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unanswered feedback from max-sixty: the "Recording below-threshold findings" section still instructs posting a new comment each run. With hourly runs, that's up to 24 notification-generating comments per day on the tracking issue. The suggestion was to find-and-edit a single bot comment instead of appending new ones — see inline suggestion.

The gates and evidence accumulation design look solid otherwise.

… ones

Avoids notification spam from hourly runs by finding and editing the
bot's existing comment rather than appending a new comment each time.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@worktrunk-bot

Copy link
Copy Markdown
Collaborator Author

Good call — updated. Each run now finds and edits the bot's existing comment on the tracking issue instead of posting a new one. Only creates a comment on the first run; subsequent runs patch it in place via gh api ... -X PATCH.

```

Also check last month's tracking issue (if it exists) for recent carry-over.
Add matching historical occurrences to your tally when evaluating gates.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and it should investigate historical cases that look like they might be related; it's unlikely that there's sufficient context in the summary issue

(and the summary issue should contain links to the workflows, so this should be relatively simple to do, albeit laborious)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point — updated. The "Reading historical evidence" section now instructs the skill to download and investigate the actual session logs from linked workflow runs rather than relying on the tracking issue summary alone. Also added a Workflow URL field to the recording format so future runs have a direct link to follow.

When evaluating whether historical tracking entries match current findings,
download and inspect the actual workflow session logs rather than relying on
the summary text alone. Also adds workflow URL to the recording format for
easier access in future runs.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@max-sixty
max-sixty enabled auto-merge (squash) March 18, 2026 20:08
max-sixty pushed a commit that referenced this pull request Mar 18, 2026
…#1608)

## Summary

- Replaces the vague "minimize the range" instruction for multi-line
suggestions with a concrete 4-step verification checklist
- Addresses the root cause of #1607: the bot constructs suggestion
ranges that are wider than the replacement text, silently deleting
correct code when applied

## Root cause analysis

Investigated all three known cases:

1. **#1310** (PR #1309): `start_line: 18, line: 22` — 5-line range
replaced with fewer lines, deleting the `git-wt` fallback branch
2. **#1326** (PR #1322): `start_line: 289, line: 291` — range included a
closing ` ``` ` fence that GitHub consumed as the suggestion's own
delimiter
3. **#1598**: `start_line: 93, line: 127` — 35-line range replaced with
a shorter rewrite, deleting the `gh issue view` code block

Common thread: the bot sets a line range covering more content than it
intends to replace. The replacement text is shorter, so the surplus
lines are silently deleted. The existing instruction ("minimize the
range") didn't give the bot a way to verify correctness.

## Fix

The new checklist requires the bot to:
1. **Read the exact lines** in the range before posting
2. **Verify no silent deletions** — every line must appear in the
replacement or be intentionally removed
3. **Cap range at ~10 lines** — larger suggestions should be split or
pushed as commits
4. **Avoid spanning markdown fences** — prevents delimiter collision

## Test plan

- [ ] Review a PR with a multi-line suggestion opportunity and verify
the bot follows the checklist
- [ ] Verify the bot splits or commits changes larger than ~10 lines
instead of using a suggestion

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: worktrunk-bot <[email protected]>
Co-authored-by: Claude Opus 4.6 <[email protected]>
@max-sixty
max-sixty merged commit f23258b into main Mar 18, 2026
24 checks passed
@max-sixty
max-sixty deleted the fix/issue-1597 branch March 18, 2026 20:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automated-fix Automated CI fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bot] too many PRs

2 participants