Repository navigation
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Intent
Allow the guarded merge path to express multiple explicitly named waived checks so an authorized multi-check merge remains recorded and guarded.
What Changed
bin/fm-pr-merge.shdrops the "only once" guard on--allow-red, so the flag can be repeated to name several explicitly authorized red checks in one merge; each name still waives only checks matching it exactly, every unnamed red check still refuses by name, and the waiver is still refused while the away-posture record exists.github_verify_mergeablecollects the red checks a waiver actually covered and names them in its verification line instead of claiming every required check green, and a newrecord_waived_red_checkspersists onemerge_waived_check=<name>line per covered check into the task meta under the merge-metadata lock already held bypersist_accepted_merge_authority— replacing any lines from an earlier merge and clearing them when nothing was waived — with the persist failure message distinguishing which of the two records failed.fm_pr_metadata_identity_parseinbin/fm-pr-lib.shadmits the new non-emptymerge_waived_check=key afterpr=;AGENTS.mdanddocs/architecture.mdrestate the waiver contract as repeatable-and-recorded, andtests/fm-pr-merge.test.shreplaces the duplicate-waiver refusal case with coverage for a multi-waiver merge, an unlisted red check beside named waivers, and a waiver that covered nothing (which must leave the green claim intact and clear a stale recorded name).Risk Assessment
✅ Low: The follow-up closes the round-1 gap durably and verifiably - the waiver set is written before the merge-authority record and a recording failure skips that record entirely, so no path can leave an authority record asserting an unqualified green merge - the 0600 precondition is guaranteed by the same run's record_pr_metadata, the fm-pr-lib.sh allowlist change keeps every existing meta consumer and the armed poll valid, no other meta writer drops the new key, and the recorded check name is inert against every anchored meta read; the only open item is a documented semantic choice to record the used rather than the authorized waiver set.
Testing
I exercised the multi-waiver merge path end-to-end against the real
fm-pr-merge.shand captured an operator-visible CLI transcript: two separately named waivers merge a PR whoselintandunitchecks are red, the verification line names both waived checks rather than claiming every check green, and both land in the task meta asmerge_waived_check=lines beside the merge-authority record; an unnamed redsecuritycheck still refuses with no forge call, the away-posture record still refuses the multi-waiver form, and a waiver that covered nothing records nothing while clearing a stale record. The fulltests/fm-pr-merge.test.shsuite passes, and a negative control against the base implementation shows the three new tests going red there, so they genuinely test the change. The sibling suite covering the changed metadata parser passes in full when run alone; two earlier runs of it each failed at a different watcher-bounded test with empty stderr, which I traced to that suite's 10-second watcher alarm under machine load — those tests pass repeatedly in isolation here and the suite is green on the base tree, so it is pre-existing load sensitivity, not a regression from this change. The change is UI-free (a shell CLI), so the CLI transcript and persisted meta file are the end-user-visible artifacts; no screenshot applies.Evidence: CLI transcript: multi-waiver merge, unlisted red check, unused waiver, away refusal
Evidence: Persisted task meta after an authorized two-check red merge
window=fm-task-x1 kind=ship mode=no-mistakes pr=https://github.com/example/repo/pull/88 pr_head=c0ffeec0ffeec0ffeec0ffeec0ffeec0ffeec0ff merge_waived_check=lint merge_waived_check=unitEvidence: Key transcript excerpt: two named waivers merge, a third unnamed red check refuses
Evidence: Negative control: the new tests against the base implementation (8c1cdb7)
not ok - github-allow-red-multiple: named waivers should merge error: --allow-red may be specified only once CONTROL: test_allow_red_accepts_multiple_separately_named_checks FAILED against the base implementation not ok - github-allow-red-unlisted: an unlisted red check must refuse: expected exit 1, got 2 CONTROL: test_allow_red_refuses_an_unlisted_red_check FAILED against the base implementation not ok - github-allow-red-unused: an unused waiver was recorded (meta still held merge_waived_check=stale) CONTROL: test_a_waived_merge_records_only_the_checks_it_waived FAILED against the base implementationEvidence: fm-pr-merge suite result
Evidence: Reproduction driver used to produce the CLI transcript
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
bin/fm-pr-merge.sh:666- A waived red merge leaves no evidence of the waiver. On success github_verify_mergeable prints 'verified: <url> is open and mergeable, with every required check green at head <sha>' unconditionally (bin/fm-pr-merge.sh:666), and the only durable artifacts - meta 'pr=' and state/<id>.merge-authority written by persist_accepted_merge_authority - record provider/host/path/number/authority but never the waived check names. Failure scenario: a caller runsfm-pr-merge.sh task-x1 <pr-url> --allow-red lint --allow-red unit --allow-red securityon a pull request whose entire red set is lint+unit+security; every red name is covered at bin/fm-pr-merge.sh:647, refusals stays empty, stderr asserts every required check was green, and the persisted merge-authority record is byte-identical to a fully green merge - so nothing after the fact can distinguish an authorized three-check red merge from a clean one, and the 'still requires every other check green' guard is vacuous once the named set covers the whole red set. Before this change the discrepancy was bounded to one check; it is now unbounded. Recommend naming the waived checks in the verified line and persisting them alongside the merge authority, since that is the earliest shared boundary where the merge is already recorded.bin/fm-pr-merge.sh:163- --allow-red accepts any non-empty next token as the check name, including another option. Failure scenario:fm-pr-merge.sh task-x1 <pr-url> --allow-red lint --allow-red --attended-override -- --adminregisters a waiver literally named '--attended-override', leaves ATTENDED_OVERRIDE=false, and then reject_protected_forge_args refuses --admin with a message about protection bypass rather than about the missing waiver name. It fails closed (a bogus waiver matches no check name, so any real red check still refuses), but the refusal misattributes the cause. Allowing repetition makes this mid-command-line shape plausible where a single occurrence made it unlikely; rejecting a value that begins with '-' (or at least '--') at bin/fm-pr-merge.sh:163 turns it into an accurate parse error.tests/fm-pr-merge.test.sh:2725- test_allow_red_requires_a_separate_name passes 'fm-pr-merge requires each red-check waiver as a separate named argument' but only exercises the --allow-red=lint equals form; the deleted duplicate-waiver case was its only other assertion. Theerror: --allow-red requires a check namebranch at bin/fm-pr-merge.sh:163 has no test anywhere in the suite (grep for 'requires a check name' over tests/ returns nothing). Failure scenario: that guard could be deleted or inverted - e.g. dropping the[ -n "${2:-}" ]test so a trailing--allow-redshifts past the end of the argument list - and the whole suite would stay green while the test's own pass message still claims the behavior is covered.🔧 Fix: record and report named red-check waivers on merge
2 infos still open:
bin/fm-pr-merge.sh:400- The durable record describes what the merge landed on, not what was authorized. FM_PR_WAIVED_CHECKS only collects a name that matched a check the live read reported red (bin/fm-pr-merge.sh:661-668), and record_waived_red_checks returns early when that set is empty (bin/fm-pr-merge.sh:978-981), so a waiver that covered nothing is neither reported nor recorded. Failure scenario: an agent merges with--allow-red lint --allow-red securityon a pull request where only lint is red; the meta records merge_waived_check=lint and the verification line names only 'lint', so no artifact shows that the run was also carrying authority to waive 'security' - an auditor reconstructing what the merge was allowed to bypass sees the used subset only. This is deliberate and documented (the comment at bin/fm-pr-merge.sh:397-399 and the test at tests/fm-pr-merge.test.sh:2775 both pin it), and it is arguably the more honest record, but it diverges from a literal reading of the round-1 fix instruction 'Record every named red-check waiver durably beside merge authority', so confirm the outcome-only semantic is what you want before it becomes the recorded contract.bin/fm-pr-merge.sh:976- record_waived_red_checks (bin/fm-pr-merge.sh:976-1011) is a third hand-maintained copy of the atomic meta-publish sequence - mktemp in STATE, filter one key, append, chmod 0600, fm_pr_private_file_valid, fm_pr_metadata_identity_parse, fm_pr_regular_destination_on_device_or_absent, mv, re-validate - after bin/fm-pr-check.sh:131-149 and the weaker variant in bin/fm-x-lib.sh:915-960. The new copy is correct as written: its single[ "$FM_PR_META_URL" = "$URL" ]check subsumes fm-pr-check's four provider/host/path/number comparisons because all four are derived from that canonical URL by fm_pr_url_parse, and every failure path reaches therm -f -- "$tmp"at line 1009. Noting it because a future change to the privacy or device contract in bin/fm-pr-lib.sh now has to be mirrored into three sites by hand and a divergence would be silent; a shared fm_pr_meta_publish <meta> <state> <drop-key> <line>... helper in bin/fm-pr-lib.sh, which already owns fm_pr_private_file_valid and fm_pr_metadata_identity_parse, is the boundary that would collapse them. No action needed for this merge.tests/fm-pr-check-security.test.sh:697- Pre-existing flakiness (not caused by this change): tests/fm-pr-check-security.test.sh bounds each watcher cycle with a 10-secondalarminrun_watcher_bounded, and under machine load that bound trips, failing whichever watcher-driven test happens to be running with an empty stderr. I saw it fail attest_merged_poll_row_carries_the_merge_authorityin one run andtest_valid_recording_and_merge_derivationin another; both pass 3/3 in isolation on this branch, the whole suite passes when run alone (38 ok / 0 not ok), and the same suite is green on the base tree. No action needed for this change; noting it because the same bound can red a loaded CI lane.bin/fm-test-run.sh tests/fm-pr-merge.test.sh— full suite green (exit=0), including the new multi-waiver, unlisted-red-check, and waiver-recording cases plus the retained GitLab and away-posture refusalsManual CLI demonstration driving the realbin/fm-pr-merge.shthrough four scenarios (multi-waiver merge, unlisted red check, unused waiver over a stale record, multi-waiver while away) with the suite'sgh/gh-aximocks; transcript and resulting task meta capturedNegative control:test_allow_red_accepts_multiple_separately_named_checks,test_allow_red_refuses_an_unlisted_red_check,test_a_waived_merge_records_only_the_checks_it_waivedrun against the base implementation (git archive 8c1cdb7) — all three fail there;test_allow_red_requires_a_separate_namepasses on both as expectedbash tests/fm-pr-check-security.test.sh— the only suite exercising the changedfm_pr_metadata_identity_parse; full pass (38 ok, 0 not ok) when run alone on this branch, and the same suite green on the base treetest_valid_recording_and_merge_derivationandtest_merged_poll_row_carries_the_merge_authorityrun in isolation on this branch 3x each — pass every timegit status --porcelain— worktree clean after testing; temporary base-control tree and helper files removedbin/fm-pr-lib.sh:345- bin/fm-pr-lib.sh's fm_pr_metadata_identity_parse holds the cross-producer allowlist of meta keys permitted after pr=, and this change extended it with merge_waived_check= without a doc comment. I deliberately left it uncommented: the surrounding entries (pr_head=, x_request=, x_platform=, ...) carry no comment either, and a comment there would only restate the case list, which the placement policy forbids. The per-key contract is owned by each producer's header (AGENTS.md:122), and fm-pr-merge.sh's record_waived_red_checks header already states why a waived-check line must survive that validation. Flagging as a judgment call, not a gap: if a future change makes that allowlist a stated contract, fm-pr-lib.sh's header is the place for it.🔧 Fix: install pinned actionlint locally so workflow lint runs
1 warning still open:
✅ **Push** - passed
✅ No issues found.