Skip to content

fix(bin): read owned PRs in bounded batches in fm-pr-health - #8434

Closed
Azd325 wants to merge 3 commits into
kunchenguid:mainfrom
Azd325:fm/fm-stopped-worker-rebase-sweep
Closed

Azd325 wants to merge 3 commits into
kunchenguid:mainfrom
Azd325:fm/fm-stopped-worker-rebase-sweep

Conversation

@Azd325

@Azd325 Azd325 commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Contract-class: restore

This restores the intended behavior that every owned PR is read within a bounded number of passes, with no new config key. Starting a due rebase stays a supervisor action under the standing rebase rule; this change adds no rebase trigger.

What Changed

  • bin/fm-pr-health.sh reads at most 20 owned PRs per pass (default READ_BATCH, overridable for tests via FM_PR_HEALTH_BATCH). Invalid, empty or zero values fall back to 20, and a leading-zero value is parsed as decimal.
  • PRs beyond the cap are stored as deferred and written back to notifications.pending. Pending PRs are ordered first on the next pass, so a large backlog is read in full over a bounded number of passes instead of every read timing out at once.
  • docs/configuration.md and the script header comment describe the 20-PR cap. tests/fm-pr-health.test.sh is extended with batch and override coverage.

Risk Assessment

✅ Low: The change is bounded to poll(). It caps each read wave at 20 PRs and carries deferred PRs to the front of the next pass. I traced the full-sweep, event, unsettled and persistently-unsettled cases, and each one rotates fairly with no duplicate or lost URLs. The batch override is a normalized test-only seam, the user already declined a finding to remove it, and the docs add no config key. The change adds no rebase text and no auto-rebase, so it matches the intent.

Testing

I ran the PR health test file, which drives the real fm-pr-health.sh against a fake forge. The new backlog-rotation and leading-zero tests passed. The one-wave concurrency test failed once in the full run, possibly because other test processes were running at the same time. It passed on both solo reruns. I did not rerun it on the base commit, so the cause is unconfirmed. The change has no rebase trigger and no user-facing config key. The batch override is documented in the script header as test-only.

  • Live validation: ✅ go - 3 of 3 scenarios driven live against the product
Scenario Result Live Evidence
Backlog of 7 conflicting PRs with batch cap 3: each PR's conflict is surfaced within three passes, at most 3 per pass, and wakes once ✅ pass live test_backlog_beyond_one_batch_is_read_by_later_passes: 'ok - a backlog larger than one batch is read in full by later passes'
Batch override with a leading zero (FM_PR_HEALTH_BATCH=08) does not abort the poll and still reports the conflict ✅ pass live test_leading_zero_batch_override_still_polls: 'ok - a leading-zero batch size does not abort the poll'
Eight owned PRs, default cap: all reads start in one wave and all 8 conflicts are reported ✅ pass live The test failed once in the full-file run (empty output), possibly because other test processes were running at the same time. It passed on both solo reruns. I did not rerun it on the base commit.

Pipeline

Updates from git push no-mistakes

✅ **Intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

✅ **Review** - passed

✅ No issues found.

✅ **Test** - passed

✅ No issues found.

  • Live validation: ✅ go - 3 of 3 scenarios driven live against the product
Scenario Result Live Evidence
Backlog of 7 conflicting PRs with batch cap 3: each PR's conflict is surfaced within three passes, at most 3 per pass, and wakes once ✅ pass live test_backlog_beyond_one_batch_is_read_by_later_passes: 'ok - a backlog larger than one batch is read in full by later passes'
Batch override with a leading zero (FM_PR_HEALTH_BATCH=08) does not abort the poll and still reports the conflict ✅ pass live test_leading_zero_batch_override_still_polls: 'ok - a leading-zero batch size does not abort the poll'
Eight owned PRs, default cap: all reads start in one wave and all 8 conflicts are reported ✅ pass live The test failed once in the full-file run (empty output), possibly because other test processes were running at the same time. It passed on both solo reruns. I did not rerun it on the base commit.
  • bash tests/fm-pr-health.test.sh (full file)
  • test_all_owned_pr_reads_start_in_one_wave run alone twice via a temporary trimmed copy of the test script (since removed)
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

Reading every selected PR in one wave timed out the tail of a large
backlog, so PRs stayed pending across passes. Cap each wave and carry
the deferred PRs first into the next pass.
FM_PR_HEALTH_BATCH=08 aborted every poll in the batch arithmetic.
Normalize it as base 10 and keep it a test-only seam.
@greptile-apps

greptile-apps Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; both previous findings are addressed.

Reviews (2) · Last reviewed commit: "no-mistakes(ci): Keep pending order on d..." · Reviewed by Greptile

Comment thread bin/fm-pr-health.sh Resolved
Comment thread tests/fm-pr-health.test.sh Resolved
@Azd325

Azd325 commented Nov 22, 2026

Copy link
Copy Markdown
Contributor Author

Closing in favour of #8646, which bounds the same owned-PR reads (at most 4 at a time, with a 3-pass backoff for a timed-out read) and has been reviewed. Thanks for flagging the overlap.

@Azd325 Azd325 closed this Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant