Skip to content

fix(pr-health): bound owned-PR reads and back off timed-out PRs - #8646

Closed
Azd325 wants to merge 3 commits into
kunchenguid:mainfrom
Azd325:fm/fm-pr-health-wave
Closed

Azd325 wants to merge 3 commits into
kunchenguid:mainfrom
Azd325:fm/fm-pr-health-wave

Conversation

@Azd325

@Azd325 Azd325 commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

What Changed

  • bin/fm-pr-health.sh now runs owned-PR reads at most READ_CONCURRENCY (4) at a time. It stops launching new reads a sixth of the time budget before the pass deadline. PRs not reached stay pending for the next pass.
  • A PR whose read hit its own 5 s cap (exit 124 before the pass deadline) is skipped for BACKOFF_PASSES (3) passes and stays pending. The countdown is kept in a new .backoff map in the fingerprint file. Entries for PRs no longer owned are pruned.
  • docs/configuration.md documents the backoff. tests/fm-pr-health.test.sh is updated to cover the new read behavior.

Risk Assessment

✅ Low: The docs line the intent requires is present and matches the code: a 3-pass countdown on a self-cap timeout, and a skipped URL stays in unsettled/pending. The bounded launch loop, the launch cutoff and the deadline-aware note_timeout trace correctly: a deadline cut is never recorded as a cap timeout. The tests exercise real pass behavior against the fake forge.

Testing

I ran the PR health monitor's own end-to-end test script, which drives bin/fm-pr-health.sh against a stubbed gh. It covers the 4-at-a-time read limit, the 12-call in-flight cap, and the timeout backoff (skipped for three passes, then read again). All passed. The docs one-line backoff note is present in docs/configuration.md, confirmed by diff only. I did not close 8434 or comment on 8646: those are outward GitHub actions, not part of this validation phase.

  • Live validation: ✅ go - 2 of 4 scenarios driven live against the product
Scenario Result Live Evidence
Owned PR reads run four at a time and at most 12 gh calls are in flight (local script against stubbed gh) ✅ pass live tests/fm-pr-health.test.sh: 'owned PR reads run four at a time...' and 'at most 4 PR reads (12 gh calls)' ok
A timed-out PR read is skipped for three passes, then read again (local script against stubbed gh) ✅ pass live tests/fm-pr-health.test.sh: 'a timed-out PR is skipped for three passes, then read and cleared' ok
Docs note on the timeout backoff exists in docs/configuration.md ⏸️ untested no The prior payload checked this only by reading the git diff. It did not drive a live product, so it did not establish a live pass.
Close PR 8434 with a note that 8646 replaces it ⏸️ untested no This is an outward GitHub action on a shared repository. It is outside the test phase and was not performed; the author must do it.

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 - 2 of 4 scenarios driven live against the product
Scenario Result Live Evidence
Owned PR reads run four at a time and at most 12 gh calls are in flight (local script against stubbed gh) ✅ pass live tests/fm-pr-health.test.sh: 'owned PR reads run four at a time...' and 'at most 4 PR reads (12 gh calls)' ok
A timed-out PR read is skipped for three passes, then read again (local script against stubbed gh) ✅ pass live tests/fm-pr-health.test.sh: 'a timed-out PR is skipped for three passes, then read and cleared' ok
Docs note on the timeout backoff exists in docs/configuration.md ⏸️ untested no The prior payload checked this only by reading the git diff. It did not drive a live product, so it did not establish a live pass.
Close PR 8434 with a note that 8646 replaces it ⏸️ untested no This is an outward GitHub action on a shared repository. It is outside the test phase and was not performed; the author must do it.
  • bash tests/fm-pr-health.test.sh (run twice; 0 failures)
  • git diff review of docs/configuration.md backoff note
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: thanks @Azd325. Bounding the owned-PR read wave, so a loaded machine stops timing out every read at once, is a sensible fix. This is my first look.

What I checked on head 64e6cde2 (based on main 427056c4): I read the full diff (bin/fm-pr-health.sh, tests/fm-pr-health.test.sh).

  • Owned-PR reads now run at most 4 at a time.
  • New reads stop launching about a sixth of the budget before the pass deadline.
  • A read cut by its own 5 s cap (exit 124 before the deadline) is skipped for 3 passes and stays pending, counted down in a new .backoff map that is pruned to owned URLs.
  • Skipped, unlaunched and timed-out PRs all stay in notifications.pending.
  • No workflow, credential or network-handling changes.
  • tests/fm-pr-health.test.sh passes locally on this head (39 ok, exit 0), including the three new cases.
  • The no-mistakes attestation names 64e6cde2, with no skipped steps.
  • Coverage guard and repo invariants pass. There are no review threads.

VISION, rule by rule

  • One captain, one interface: aligns. The monitor keeps reaching every PR instead of silently timing out the whole wave.
  • Authority: aligns. It only reads and notifies, and adds no config key.
  • Scripts own the mechanics: aligns. Fixed concurrency and backoff, with no judgment.
  • Restart is a non-event: aligns. The backoff and pending state live in state/pr-health.json.
  • Delegation: aligns.
  • Vendor: aligns (GitHub reads only, as before).
  • Scope: aligns.

Contract class: opt-in. The whole monitor runs only with config/pr-health-monitor present (flag_on, bin/fm-pr-health.sh:111; docs/configuration.md "PR health monitor"). Without the flag nothing changes.

Two non-blocking notes:

Status: held because main is red, not waiting on you. Main (427056c4) isn't green right now, so merges and new full-ci labels are on hold across the repo. The red "Full suite" check here is only the gate that runs once a maintainer adds full-ci. Once main is green, the next step is full-ci, and a merge only if that run is green.

@Azd325 Azd325 changed the title fix: bound owned-PR reads in fm-pr-health and back off timed-out PRs fix(pr-health): bound owned-PR reads and back off timed-out PRs Nov 22, 2026
@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: thanks @Azd325, both notes are handled.

What changed on head 9b6080a5: the only new commit adds one line to the PR health monitor section of docs/configuration.md: "A read cut by its own 5 s cap is skipped for the next 3 passes and stays pending." That matches the script (BACKOFF_PASSES=3, a self-cap exit 124 before the pass deadline). The code and tests are byte-identical to 64e6cde2, which I reviewed last pass. You also closed #8434 in favour of this one, so there's no overlap left.

Gates on 9b6080a5: the no-mistakes attestation names this head with every step through push completed and no skipped steps. The coverage guard, repo invariants and the no-mistakes check pass. There are no review threads, and the PR merges cleanly.

Contract class: opt-in (unchanged). The whole monitor only runs with config/pr-health-monitor present. VISION per-rule verdict: unchanged from my last comment. Every rule aligns, and a docs-only addition doesn't move any of them.

Status: held because main is red, not waiting on you. Main (427056c4) still isn't green, so merges and new full-ci labels are paused across the repo. The red "Full suite" check is only the gate that runs once a maintainer adds full-ci. Once main is green, the next step is full-ci, then a merge if that run is green.

@Azd325

Azd325 commented Nov 28, 2026

Copy link
Copy Markdown
Contributor Author

Closing this in favor of #8807. Both PRs limit how many owned PRs are read at a time in bin/fm-pr-health.sh, and they conflict with each other. #8807 gives each read the time that is left, tries failed PRs last, and reports a pass in which no read completes. It does not keep this PR's three-pass skip after a timeout.

@Azd325 Azd325 closed this Nov 28, 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.

2 participants