Repository navigation
Conversation
|
A direct-PR worker reports ready as soon as its pull request is open, before CI finishes, and the merge poll only ever reported MERGED, so a yolo task sat green until an unrelated heartbeat or a custom check prompted the first mate to merge it. When a validated GitHub merge poll reads no merge for a direct-PR task recorded with yolo=on and a pr_head=, the watcher now runs bin/fm-pr-green-poll.sh. It prints checks-green only while the pull request is open at exactly that head and GitHub reports the commit's combined check state as SUCCESS. The watcher surfaces that as one check wake per recorded head, recorded in a private state/<id>.pr-poll-green-notified marker after the durable wake row, so a newly recorded head wakes again and an already-woken head is not read again. The wake never merges, retires, or re-arms the poll: firstmate lands through bin/fm-pr-merge.sh, whose live verification is unchanged. bin/fm-pr-poll.sh stays byte-identical, so merge polls armed before an update keep authenticating and MERGED detection is untouched. GitLab and Gerrit polls record no pr_head= and are unchanged.
…umentation ownership
… entirely passing required-check list, falling back to entirely passing reported checks when requirements cannot be listed. Notifications are keyed by PR identity, head SHA, and normalized passing-check set, allowing later required successes on the same head to wake again. Updated documentation and behavioral regressions. Reproduced premature green before the fix; the full PR-check security suite, bash syntax checks, shellcheck -x, and git diff --check pass
| if [ -z "$out" ] && green_head=$(pr_poll_green_head "$id" "$provider"); then | ||
| run_check_capture "$SCRIPT_DIR/fm-pr-green-poll.sh" "$url" "$green_head" || exit 1 | ||
| if [[ "$FM_CHECK_RESULT" =~ ^checks-green\ ([0-9a-f]{64})$ ]]; then | ||
| green_checks=${BASH_REMATCH[1]} | ||
| if ! fm_pr_poll_green_already_notified "$STATE" "$id" "$provider" "$host" "$path" "$number" "$green_head" "$green_checks"; then |
There was a problem hiding this comment.
Repeated reads delay other checks
Already-notified green PRs are queried again on every check sweep. Each task makes two GitHub head reads and at least one checks read before its marker can suppress the wake. The watcher processes tasks one at a time, and each probe can take up to 30 seconds. With several open PRs or slow GitHub responses, this can delay checks for unrelated tasks. Consider bounding or sharing these repeated reads.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
…duplicate green notifications
…cation prohibited
…een-probe prerequisites
de4b5af to
c83e642
Compare
The early-readiness fixture must treat an absent queue as zero events. The executable regression then passes for the changed scan and fails for the original scan. The readiness delay is a missing prompt handoff rather than slow CI execution. The generated contract already emits the ready line at the CI-ready return in bin/fm-dod-lib.sh:596-600. Merge polling starts after PR registration through bin/fm-pr-check.sh. The independent outcome scan previously waited for a 900-second inactivity interval. Audit E3 records checks green at 16:20:20 UTC and merge at 16:40:10 UTC on October 19. The CI log already reported checks passed and continued monitoring until merge or close. The evidence does not isolate the exact division between reporting and observation delay. Required owner approval remains unchanged. The change complements kunchenguid#6052. That change observes already registered direct-PR checks. This change delivers an unregistered green PR through the existing outcome receipt and wake route. It adds no competing forge probe and leaves merge authority and merge-time guards unchanged. Validation: current-state and reconciliation suites passed; the original scan fails the new regression; lint and documentation checks passed.
The early-readiness fixture must treat an absent queue as zero events. The executable regression then passes for the changed scan and fails for the original scan. The readiness delay is a missing prompt handoff rather than slow CI execution. The generated contract already emits the ready line at the CI-ready return in bin/fm-dod-lib.sh:596-600. Merge polling starts after PR registration through bin/fm-pr-check.sh. The independent outcome scan previously waited for a 900-second inactivity interval. Audit E3 records checks green at 16:20:20 UTC and merge at 16:40:10 UTC on October 19. The CI log already reported checks passed and continued monitoring until merge or close. The evidence does not isolate the exact division between reporting and observation delay. Required owner approval remains unchanged. The change complements kunchenguid#6052. That change observes already registered direct-PR checks. This change delivers an unregistered green PR through the existing outcome receipt and wake route. It adds no competing forge probe and leaves merge authority and merge-time guards unchanged. Validation: current-state and reconciliation suites passed; the original scan fails the new regression; lint and documentation checks passed.
What Changed
Risk Assessment
✅ Low: The fix rounds did exactly what the user decided: a verbatim helper move, green detection gated on the base branch's required checks, and
skippingcounted as passing. All of it fails silent on errors, never grants merge authority, and has behavioral tests that tell the fixed code from the old code.Testing
Focused regression checks passed. Live CLI validation confirmed malformed-input refusal, silent authentication failure, and notification-marker cleanup during isolated teardown. Captured CLI and persisted-state evidence plus explicitly mocked watcher transcripts. No full suite, lint, or static analysis ran; authenticated GitHub wake and merge behavior remains untested live.
Evidence: Real green-probe input guards and authentication-failure transcript
Source: Real green-probe input guards and authentication-failure transcript
Evidence: Supplemental watcher notification transcript — mocked GitHub, not live validation
Source: Supplemental watcher notification transcript — mocked GitHub, not live validation
Evidence: Real isolated teardown removes the persisted green-notification marker
Source: Real isolated teardown removes the persisted green-notification marker
Pipeline
Updates from git push no-mistakes
⏭️ **intent** - skipped
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
✅ No issues found.
bin/fm-pr-green-poll.sh:46- The ci-1 fix round introduced a rule that treats only gh bucketpassas green. gh puts SKIPPED and NEUTRAL conclusions in theskippingbucket, so they never count as green. GitHub counts a skipped required check as satisfied, and the rollup still reads SUCCESS.bin/fm-pr-merge.shalso treats them as green (github_checks_not_greenacceptsSUCCESS,NEUTRAL, orSKIPPED, lines 570-590). Example: a yolo direct-PR head has required checkcipassing and required jobdeploy-previewskipped by anif:condition.fm-pr-merge.shwould land it, but this probe stays silent forever, so the landing prompt the feature exists to send never arrives. The fallback path (repos with no required checks, line 41) is hit harder: any skipped or neutral job in any workflow blocks the wake for that head permanently. Before this round, a SUCCESS rollup was enough, so this lost-wake case is new. The recorded decision said "bucket pass for each", but it did not address skipped or neutral checks, and the wake definition now disagrees with the merge gate it prompts. Same rule elsewhere: tests/fm-pr-check-security.test.sh:3734 assertsskippingis not green in both the required and fallback lists; docs/architecture.md:82-83 describe "every bucket pass". Decision needed: shouldskippingcount as passing, matching fm-pr-merge.sh?bin/fm-pr-green-poll.sh:37- The ci-1 decision asked that a head count as green only when every required check has reported and passed.gh pr checks --requiredonly lists checks that exist in the rollup. A required GitHub Actions or app check run that has not been created yet does not appear at all. Example: required checks areciandreview;cipasses andreviewhas no check run yet. The rollup reads SUCCESS,--requiredreturns[ci pass], and the probe sendschecks-green, which is the premature wake greptile described. The fix round's check-set digest does prevent the lost prompt: a laterreviewsuccess changes the digest and wakes again. But the premature wake is still reachable. The test the fix round added for this,test_green_poll_missing_required(tests/fm-pr-check-security.test.sh:3715), mocksreviewas a reportedpendingentry, not an absent one, so it would pass without covering the greptile case. docs/architecture.md:88 claims coverage of "missing required checks", and docs/architecture.md:82 implies--requiredenumerates all requirements. A durable fix would compare against the base branch's required contexts, whichfm-pr-merge.shalready reads (github_read_required_contexts/github_required_checks_missing). That means moving that logic into a shared helper, which goes beyond the prescribed mechanism, so the remedy needs authorization. Otherwise, accept the premature-then-re-wake behavior and fix the test name and docs so they describe it honestly.bin/fm-pr-green-poll.sh:40- Any--requiredfailure with empty stdout falls back to the all-checks list. That includes transient network, auth, or rate-limit errors, not just gh's "no required checks reported" case. The fallback list includes non-required checks, so its digest differs from the required-list digest. Example: a repo has required checkciand optional checklint. Sweep 1 wakes with {ci}; the merge is refused (for example, the branch is BEHIND). Sweep 2 hits a transient--requiredfailure, falls back to {ci, lint}, and wakes again. Sweep 3 returns {ci} and wakes a third time, because the marker holds only the last digest. This contradicts the header's "Errors and partial reads stay silent" (line 8). Fix: fall back only when gh's stderr reports that no required checks exist, and exit silently on any other--requiredfailure.🔧 Fix applied.
6 issues (5 warnings, 1 info) still open:
bin/fm-pr-green-poll.sh:46- The ci-1 fix round introduced a rule that treats only gh bucketpassas green. gh puts SKIPPED and NEUTRAL conclusions in theskippingbucket, so they never count as green. GitHub counts a skipped required check as satisfied, and the rollup still reads SUCCESS.bin/fm-pr-merge.shalso treats them as green (github_checks_not_greenacceptsSUCCESS,NEUTRAL, orSKIPPED, lines 570-590). Example: a yolo direct-PR head has required checkcipassing and required jobdeploy-previewskipped by anif:condition.fm-pr-merge.shwould land it, but this probe stays silent forever, so the landing prompt the feature exists to send never arrives. The fallback path (repos with no required checks, line 41) is hit harder: any skipped or neutral job in any workflow blocks the wake for that head permanently. Before this round, a SUCCESS rollup was enough, so this lost-wake case is new. The recorded decision said "bucket pass for each", but it did not address skipped or neutral checks, and the wake definition now disagrees with the merge gate it prompts. Same rule elsewhere: tests/fm-pr-check-security.test.sh:3734 assertsskippingis not green in both the required and fallback lists; docs/architecture.md:82-83 describe "every bucket pass". Decision needed: shouldskippingcount as passing, matching fm-pr-merge.sh?bin/fm-pr-green-poll.sh:37- The ci-1 decision asked that a head count as green only when every required check has reported and passed.gh pr checks --requiredonly lists checks that exist in the rollup. A required GitHub Actions or app check run that has not been created yet does not appear at all. Example: required checks areciandreview;cipasses andreviewhas no check run yet. The rollup reads SUCCESS,--requiredreturns[ci pass], and the probe sendschecks-green, which is the premature wake greptile described. The fix round's check-set digest does prevent the lost prompt: a laterreviewsuccess changes the digest and wakes again. But the premature wake is still reachable. The test the fix round added for this,test_green_poll_missing_required(tests/fm-pr-check-security.test.sh:3715), mocksreviewas a reportedpendingentry, not an absent one, so it would pass without covering the greptile case. docs/architecture.md:88 claims coverage of "missing required checks", and docs/architecture.md:82 implies--requiredenumerates all requirements. A durable fix would compare against the base branch's required contexts, whichfm-pr-merge.shalready reads (github_read_required_contexts/github_required_checks_missing). That means moving that logic into a shared helper, which goes beyond the prescribed mechanism, so the remedy needs authorization. Otherwise, accept the premature-then-re-wake behavior and fix the test name and docs so they describe it honestly.bin/fm-pr-green-poll.sh:40- Any--requiredfailure with empty stdout falls back to the all-checks list. That includes transient network, auth, or rate-limit errors, not just gh's "no required checks reported" case. The fallback list includes non-required checks, so its digest differs from the required-list digest. Example: a repo has required checkciand optional checklint. Sweep 1 wakes with {ci}; the merge is refused (for example, the branch is BEHIND). Sweep 2 hits a transient--requiredfailure, falls back to {ci, lint}, and wakes again. Sweep 3 returns {ci} and wakes a third time, because the marker holds only the last digest. This contradicts the header's "Errors and partial reads stay silent" (line 8). Fix: fall back only when gh's stderr reports that no required checks exist, and exit silently on any other--requiredfailure.bin/fm-pr-green-poll.sh:47- Still waiting on a decision; the code is unchanged since round 2. The ci-1 fix round made gh'spassbucket the only green result. gh puts SKIPPED and NEUTRAL conclusions in theskippingbucket, so those checks never count as green. The merge gate this wake prompts disagrees:bin/fm-pr-merge.shgithub_checks_not_greentreatsSUCCESS,NEUTRALandSKIPPEDas green (around lines 570-590), and GitHub counts a skipped required check as satisfied. Example: requiredcipasses and requireddeploy-previewis skipped by anif:condition. fm-pr-merge.sh would land the PR, but this probe stays silent at that head forever, so the landing prompt is lost. The no-required-checks fallback (line 40) has the same problem: any skipped or neutral job in any workflow blocks the wake. The same rule is encoded in tests/fm-pr-check-security.test.sh:3750 (skippingasserted not green for both the required and fallback lists) and in docs/architecture.md:82. Decision needed: should theskippingbucket count as passing, to match fm-pr-merge.sh?bin/fm-pr-green-poll.sh:37- Still waiting on a decision. The latest fix round made this case easier to reach.gh pr checks --requiredfilters the reported rollup byisRequired, so a required check with no check run yet does not appear. Path 1: required checks areciandreview,cipasses andreviewhas not been created. The list is[ci pass]and the probe emitschecks-greenearly. Path 2, sibling added by the round-3 fallback change (lines 38-40): gh'sno required checks reported on '<branch>' brancherror means no reported check is required, not that the repo requires none. If requiredcihas not started yet and optionallinthas passed, the probe falls back to all checks and wakes on{lint}. The later{ci}digest wakes again, so the prompt is not lost, but the premature wake greptile described (ci-1) is still reachable.test_green_poll_missing_required(tests/fm-pr-check-security.test.sh:3731) mocksreviewas a reportedpendingentry, so it does not cover an absent check. docs/architecture.md:88 claims coverage of "missing required checks", and docs/architecture.md:82-83 imply--requiredlists every requirement. A durable fix would compare against the base branch's required contexts, which fm-pr-merge.sh already reads (github_read_required_contexts/github_required_checks_missing), through a shared helper. That goes beyond the prescribed mechanism, so the remedy needs authorization. The alternative is to accept premature-then-re-wake and make the test name and docs describe it honestly.tests/fm-pr-check-security.test.sh:3773- The round-3 fix added a--greenargument mode to the security test script that runs only the green-poll tests and exits. The finding it was addressing (green-fallback-digest-flap) did not need a new test-runner mode, and no intent requirement asks for one. It is a second entry path into the suite, and it will silently drift if new green tests are added only to the default list. Recommend removing it.🔧 Fix applied.
✅ Re-checked - no issues remain.
TMPDIR="$PWD/.test-phase-tmp" bash tests/fm-pr-check-security.test.shpassed.Re-rantest_green_poll_contract,test_checks_green_wakes_once_per_recorded_head,test_checks_green_needs_a_yolo_direct_pr_recorded_head, andtest_teardown_removes_poll_artifactsthrough a temporary focused driver, retaining product transcripts and persisted records. Forge responses were mocked.Ranpython3 .test-phase-tmp/live-checks.py: invoked the realbin/fm-pr-green-poll.shwith malformed URLs, invalid heads, missing/extra arguments, and unavailable GitHub authentication.Ran realgh api graphql -f 'query=query { viewer { login } }'with isolated HOME and GH_CONFIG_DIR; it exited 4 requesting authentication.Created a marked disposable home usingbin/fm-lab-home.sh create, seeded a delivered-head marker, and ran realbin/fm-teardown.sh task-awithout force or lifecycle bypass. Verified the task metadata and green-notification marker were removed.Corrected an initially invalid windowless cleanup fixture to reference an absent private tmux endpoint, then successfully repeated cleanup.Removed temporary drivers and disposable data;git status --shortandgit diff --exit-codeconfirmed no remaining worktree changes.Live validation:⚠️ inconclusive - 3 of 8 scenarios driven live against the product
TMPDIR="$PWD/.test-phase-tmp" bash tests/.test-phase-green.shran seven existing tests selected fromtests/fm-pr-check-security.test.sh:test_green_poll_missing_required,test_green_poll_requirement_reads,test_green_poll_check_lists,test_green_poll_contract,test_checks_green_wakes_per_head_and_check_set,test_checks_green_needs_a_yolo_direct_pr_recorded_head, andtest_teardown_removes_poll_artifacts. Repeated to capture mocked watcher output.TMPDIR="$PWD/.test-phase-tmp" bash tests/.test-phase-merge.shran six existing shared-helper regressions:test_required_check_that_never_reported_refuses,test_required_checks_reported_and_green_merge,test_unreadable_required_set_refuses,test_required_producer_identity,test_app_bound_required_status_context_matches_by_name, andtest_required_partial_reads_report_all_failures.python3 .test-phase-tmp/live.pydrove the real green-poll CLI with invalid requests and an unauthenticated GitHub request, then ranbin/fm-teardown.sh task-aagainst a disposable marked lab home and verified removal of the notification marker and task metadata.Captured live CLI output and explicitly labeled mocked watcher output in the evidence directory. Removed temporary runners, fixtures, and lab data;git status --shortandgit diff --statwere empty.🔧 Fix applied.
1 warning still open:
Ran six selected functions fromtests/fm-pr-check-security.test.sh:test_green_poll_contract,test_green_poll_missing_required,test_green_poll_requirement_reads,test_green_poll_check_lists,test_checks_green_wakes_per_head_and_check_set, andtest_checks_green_needs_a_yolo_direct_pr_recorded_head, using a temporary runner and mocked forge responses.Ran six selected functions fromtests/fm-pr-merge.test.sh:test_required_check_that_never_reported_refuses,test_required_checks_reported_and_green_merge,test_unreadable_required_set_refuses,test_required_producer_identity,test_app_bound_required_status_context_matches_by_name, andtest_required_partial_reads_report_all_failures, using a temporary runner and mocked forge responses.Ranpython3 .test-phase/live.pyto invoke the realbin/fm-pr-green-poll.shagainst malformed inputs, unsupported forge input, and an actual unauthenticatedghfailure.Rangh api graphql -f 'query=query { viewer { login } }'with isolated configuration; gh exited 4 requesting a credential.Created an isolated home withbin/fm-lab-home.sh create, seeded a delivered-head/check-set marker, and ranbin/fm-teardown.sh task-aagainst an absent private tmux endpoint; verified task metadata and marker removal.Captured CLI output and persisted-state evidence, removed disposable labs and temporary runners, and verifiedgit status --shortwas empty. No full suite, lint, or static analysis was run.🔧 Fix applied.
1 warning still open:
Ran seven focused functions fromtests/fm-pr-check-security.test.shusing a disposable runner:test_green_poll_contract,test_green_poll_missing_required,test_green_poll_requirement_reads,test_green_poll_check_lists,test_checks_green_wakes_per_head_and_check_set,test_checks_green_needs_a_yolo_direct_pr_recorded_head, andtest_teardown_removes_poll_artifacts.Ran six focused functions fromtests/fm-pr-merge.test.sh: required-check absence, successful satisfaction, unreadable requirements, producer identity, app-bound status contexts, and partial-read diagnostics.Executedbin/fm-pr-green-poll.shdirectly with missing arguments, unsupported forge, noncanonical PR number, invalid heads, and extra arguments.Executed realgh api graphql -f 'query=query { viewer { login } }'with isolated configuration, then verified the real green probe remained silent when authentication was unavailable.Re-rantest_checks_green_wakes_per_head_and_check_setand captured emitted watcher notifications, explicitly labelled as mocked integration evidence.Ranunshare --user --map-root-user --pid --fork --mount-proc bash .test-green-live/teardown.sh, exercising realbin/fm-teardown.sh task-ain a marked lab home without mocks or a lifecycle bypass.Removed disposable runners and lab directories;git status --shortconfirmed no remaining worktree changes.✅ **Document** - passed
✅ No issues found.
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ No issues found.
✅ **Push** - passed
✅ No issues found.
✅ No issues found.