Skip to content

fix(review-pr): re-run flaky CI on bot-authored PRs - #1540

Merged
max-sixty merged 3 commits into
mainfrom
hourly/review-23112830864
Mar 15, 2026
Merged

max-sixty merged 3 commits into
mainfrom
hourly/review-23112830864

Conversation

@worktrunk-bot

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

Copy link
Copy Markdown
Collaborator

Summary

  • Add explicit guidance to the review-pr skill's CI monitoring step: when a CI failure is a transient flake, trigger gh run rerun --failed on any PR (bot or human-authored)
  • After re-running, report the flake to the tracking issue (e.g., investigate: recurring macOS shell_wrapper test flakes on CI #1528) with context — PR number, platform, error snippet, run link — rate-limited to ~1 comment/day per test

Evidence

Run 23107689220 (claude-review on PR #1538, chore/renovate-20260315):

The review bot spent 35 tool calls investigating a macOS test_switch_with_execute_through_wrapper flake on bot-authored PR #1538. It correctly diagnosed the failure as transient (unrelated to the Rust 1.90→1.94 bump), but then took no action — no re-run, no comment. Someone else eventually triggered attempt 2 manually, which passed.

This pattern was also seen in run 23109051326 reviewing PR #1539, where the bot posted a COMMENT about the flake but didn't trigger a re-run.

Root cause: Step 5 of review-pr has no guidance for the "flake detected" case — only "related to PR" (dismiss approval + comment) and "all passed" (done). The bot falls through to silence.

Test plan

🤖 Generated with Claude Code

…g silent

In run 23107689220, the review bot spent 35 tool calls investigating a
macOS flake on bot-authored PR #1538, correctly diagnosed it as transient,
but took no action — no re-run, no comment. Someone else eventually re-ran
it manually.

Add explicit guidance to step 5: when a CI failure is a transient flake,
trigger `gh run rerun --failed` rather than just reporting it. For bot PRs,
always re-run (no human author to do it). For human PRs, suggest a re-run
in a COMMENT review.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@worktrunk-bot worktrunk-bot added the claude-behavior Issues with Claude CI bot behavior label Mar 15, 2026
@max-sixty

Copy link
Copy Markdown
Owner

I think this is fine but also really important we stamp out flaky tests: the bot can rerun tests if it finds any flakiness on any PR. it must also find the issue where we discuss the flaky test (open or closed) and add a comment (or edit one if there was a recent comment) giving the context around that instance. generally aim for about one comment /day.

…ng issues

Per review feedback: the bot should rerun failed flaky jobs on any PR
(not just bot-authored), and also find/update the tracking issue for
each flaky test with context (~1 comment/day rate limit).

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

Copy link
Copy Markdown
Collaborator Author

Good call — updated. The bot now:

  1. Re-runs flaky jobs on any PR (removed the bot-only vs human distinction for re-runs)
  2. Reports flakes to tracking issues — searches for an open issue about the specific test (e.g., investigate: recurring macOS shell_wrapper test flakes on CI #1528 for the shell wrapper flakes), adds a comment with context (PR, platform, error, run link), rate-limited to ~1 comment/day per test. Opens a new issue if none exists.

Comment thread .claude/skills/review-pr/SKILL.md Outdated
gh issue view <issue-number> --json comments \
--jq '[.comments[] | select(.author.login == "worktrunk-bot")] | last | .createdAt'
```
Skip the comment if the bot already commented today.

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.

"Edit the existing comment, or skip, if the bot..."

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 call — updated to edit the existing bot comment (appending new flake instances) instead of posting a new one each time. 8b3b26c

Address review feedback: when reporting flakes to tracking issues, edit
the existing bot comment to append new instances rather than posting a
new comment each time. This keeps issues tidy.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@max-sixty
max-sixty merged commit 209bc29 into main Mar 15, 2026
24 checks passed
@max-sixty
max-sixty deleted the hourly/review-23112830864 branch March 15, 2026 18:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

claude-behavior Issues with Claude CI bot behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants