Skip to content

fix(bin): guard merges on bases with no required checks - #7495

Open
Moshik21 wants to merge 11 commits into
kunchenguid:mainfrom
Moshik21:fm/fm-upstream-six-local-fixes-suite
Open

Moshik21 wants to merge 11 commits into
kunchenguid:mainfrom
Moshik21:fm/fm-upstream-six-local-fixes-suite

Conversation

@Moshik21

@Moshik21 Moshik21 commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Intent

Fix the two review findings on open upstream pull request 7495 (guard merges on bases with no required checks) on kunchenguid/firstmate that the maintainer says must be fixed in the PR; the owner approved publishing the fixes on 2026-11-12. The pull request makes bin/fm-pr-merge.sh refuse a merge on a GitHub base branch with no required checks unless the head is not behind the live base tip and the ship worker's recorded full-suite result holds (suite=pass bound to the live base commit, or suite=none with a reason), with an --attended-override that waives both conditions only while no away-posture record exists. The two findings the maintainer asks to fix in the PR: (1) Waiver survives going away: on main, require_current_away_authority re-checks every attended-only waiver (--allow-red, --allow-missing, --allow-no-pipeline) under the away-record lock and refuses if an away record appeared since preflight, but the --attended-override waiver of the behind-base and suite-record conditions is decided once from the pre-lock posture and never re-checked, so a merge can run under away authority with neither condition checked; add the matching re-check (refuse, or re-run the two conditions, when the waiver was used and the away posture is now true), with a test. (2) Separate reads mix suite results: suite=, base= and reason= come from three separate reads of a record file the worker may be rewriting, so an old suite=pass can pair with a new base=; read the record once and parse that copy, ideally also have the worker brief say to write the record atomically (temporary file then mv), and add a test if possible.

What Changed

  • bin/fm-pr-merge.sh now refuses a GitHub merge on a base branch with an empty required-check set unless the head is not behind the live base tip and the ship worker's recorded full-suite result holds (suite=pass bound to the live base commit, or suite=none with a reason=). --attended-override waives both conditions only while no away-posture record exists. require_current_away_authority now re-checks that waiver under the away-record lock and refuses if an away record appeared after preflight. The suite record is read once and parsed from that single copy, so suite=, base= and reason= cannot come from different rewrites.
  • bin/fm-dod-lib.sh adds a suite-record step to the PR-publishing definitions of done. The worker writes <data>/<task-id>/suite-result as its last step, using a temporary file and mv so the write is atomic. fm_dod_block takes the data directory as an eighth argument, passed by bin/fm-brief.sh and bin/fm-promote.sh. bin/fm-pr-lib.sh gains fm_pr_suite_record_path as the one owner of the record location.
  • docs/architecture.md and docs/scripts.md describe the new condition. Tests in tests/fm-pr-merge.test.sh, tests/fm-dod-lib.test.sh, tests/fm-pr-check-security.test.sh and tests/fm-captain-hold-lifecycle.test.sh cover the no-required-checks refusals, the suite-record step, and the dod-block argument.

Risk Assessment

✅ Low: Both required fixes are present and I could not construct a failing sequence for either: the attended-override waiver is re-checked under the away-record lock, and the suite record is read once and parsed from that copy.

Testing

I drove the real bin/fm-pr-merge.sh against a fake gh through the five no-required-checks tests, using a trimmed copy of the merge test file. All five pass. Those cover the refusals, the suite=none attestation, the attended-only override, the new late-away-record refusal, and the single-read suite record. Both new tests fail against the pre-fix script and pass against the fix. The brief wording test in tests/fm-dod-lib.test.sh also passes. I did not run the full tests/fm-pr-merge.test.sh (about 20 minutes). It is not live Herdr or tmux product validation, since the merge guard is exercised only through the fake gh. The worktree is clean; temporary files were removed.

  • Live validation: ✅ go - 6 of 6 scenarios driven live against the product
Scenario Result Live Evidence
On a no-required-checks base, a merge is refused when the head is behind, the recorded base is stale, the suite failed, suite=none has no reason, or the record is missing, symlinked or unparsable, or… ✅ pass live merge-guard-trimmed.log: 'fm-pr-merge refuses a no-required-checks base that is behind, stale, failing, unrecorded, or unreadable' ok
A record with suite=none and a reason merges, and stderr reports it as the worker's attestation ✅ pass live merge-guard-trimmed.log: attested no-suite reason test ok
--attended-override waives the guard when attended but not while an away-posture record exists ✅ pass live merge-guard-trimmed.log: override waives attended-only ok
Finding 1: an away record published after the override was granted (before the locked authority check) refuses the merge with exit 2 and no gh pr merge ✅ pass live merge-guard-trimmed.log (unchecked-override-away-after-view case inside the attended-only test, ok); merge-guard-prefix-mutation.log shows it failing with 'expected exit 2, got 0' on the pre-fix scrip…
Finding 2: a suite record rewritten to a failing result while the merge reads it is refused, not paired as old suite=pass with new base= ✅ pass live merge-guard-trimmed.log: single-read test ok; merge-guard-prefix-mutation.log shows it failing with 'expected exit 1, got 0' on the pre-fix script
The generated worker brief tells the worker to write the suite record via a temp file and mv ✅ pass live dod-lib.log: all fm-dod-lib tests passed, exit=0
Evidence: Trimmed merge-guard run against the fixed script (all ok)

Source: Trimmed merge-guard run against the fixed script (all ok)

ok - fm-pr-merge --allow-missing is single use, attended-only, and GitHub-only like --allow-red
ok - fm-pr-merge refuses a no-required-checks base that is behind, stale, failing, unrecorded, or unreadable
ok - fm-pr-merge accepts suite=none with a reason and reports it as the worker's attestation
ok - fm-pr-merge --attended-override waives the no-required-checks conditions only while attended
ok - fm-pr-merge parses one copy of a suite record that is rewritten while it is read
bash tests/zz-trim-merge.test.sh  14.17s user 17.09s system 81% cpu 38.375 total
Evidence: New tests failing against the pre-fix script

Source: New tests failing against the pre-fix script

ok - fm-pr-merge --allow-missing is single use, attended-only, and GitHub-only like --allow-red
ok - fm-pr-merge refuses a no-required-checks base that is behind, stale, failing, unrecorded, or unreadable
ok - fm-pr-merge accepts suite=none with a reason and reports it as the worker's attestation
not ok - unchecked-override-away-after-view: late away publication must refuse the waiver: expected exit 2, got 0
not ok - unchecked-torn-record: the merge must be refused: expected exit 1, got 0
Evidence: DoD lib test run

Source: DoD lib test run

FM_TEST_BEGIN 2026-11-12T14:33:04Z tests/fm-dod-lib.test.sh family=pure-contract-unit expected_gate_skip=none
ok - scout done: is not gated
ok - unpushed ship done: is refused
ok - no-mistakes pre-validation done: is not gated
ok - named head on a remote-tracking ref is accepted
ok - named head only on the no-mistakes gate mirror is refused, even after a refresh; on origin it is accepted
ok - head origin holds through the gate clone is accepted after a refresh, and later reads see it
ok - a project clone with its own git directory is refreshed too, and its origin's head is accepted
ok - past the refresh deadline nothing is fetched and the refusal says it used the last-known refs
ok - a failed refresh still refuses and says the verdict used the last-known refs
ok - a remote that hangs and sorts before origin cannot take origin's refresh; origin's head is accepted and the hanging remote is named
ok - a hanging remote in a standalone copy cannot take the project clone's refresh; its origin's head is accepted and failed remotes name their repository
ok - local-only named branch stays reachable when the gate mirror also holds it
ok - a moved remote branch that lacks the named head is refused
ok - a 40-hex token in the note is not the named head
ok - a recorded merged PR satisfies the gate after prune
ok - the merged-PR short-circuit applies only to the recorded PR the done line names
ok - a forge-recorded head for the named PR is accepted without a local object
ok - a direct-PR recorded head does not cover a later unpushed commit
ok - CI-ready notes require checks green and an actual PR reference
ok - no-mistakes CI-ready done: with extra text is gated
ok - keyed and spaced ship done: lines are gated
ok - local-only linked named branch is reachable from the project clone
ok - local-only detached HEAD only in the disposable copy is refused
ok - standalone local-only done: requires the named head in the project clone
ok - non-done lines are not gated
ok - fenced and indented Captain lines are not authorized intent
ok - PR-based DoD draft check uses gh-axi
ok - PR-based DoD renders the suite record step and local-only does not
ok - promotion keeps a scout's recorded base branch and refuses local-only for it
ok - forge=external composes with direct-PR only and refuses a base branch
ok - external rule one forbids origin and task-prefixed pushes and names only the backup copy
ok - external DoD renders the contract, the review grammar, and the adapter, and refuses without one
ok - external review done: accepted on a canonical URL alone without a backup; PR, non-https, query, fragment, forge, and pattern mismatches refused
ok - external review done with a backup: refused until HEAD is under refs/remotes/backup/backup/, then accepted
ok - worker role names the skill and its fallback skill file
all fm-dod-lib tests passed
FM_TEST_END 2026-11-12T14:33:32Z tests/fm-dod-lib.test.sh exit=0 duration_ms=27461 gate_skip=false
FM_TEST_SUMMARY total=1 failed=0 skipped_gate=0 duration_ms=27685
FM_TEST_SUMMARY_FAMILY family=pure-contract-unit count=1 duration_ms=27461 failed=0
FM_TEST_SLOWEST rank=1 script=tests/fm-dod-lib.test.sh duration_ms=27461

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

🔧 **Rebase** - 1 issue found → auto-fixed ✅
  • ⚠️ bin/fm-pr-merge.sh - merge conflict rebasing onto origin/main

🔧 Fix applied.
✅ Re-checked - no issues remain.

✅ **Review** - passed

✅ No issues found.

✅ **Test** - passed

✅ No issues found.

  • Live validation: ✅ go - 6 of 6 scenarios driven live against the product
Scenario Result Live Evidence
On a no-required-checks base, a merge is refused when the head is behind, the recorded base is stale, the suite failed, suite=none has no reason, or the record is missing, symlinked or unparsable, or… ✅ pass live merge-guard-trimmed.log: 'fm-pr-merge refuses a no-required-checks base that is behind, stale, failing, unrecorded, or unreadable' ok
A record with suite=none and a reason merges, and stderr reports it as the worker's attestation ✅ pass live merge-guard-trimmed.log: attested no-suite reason test ok
--attended-override waives the guard when attended but not while an away-posture record exists ✅ pass live merge-guard-trimmed.log: override waives attended-only ok
Finding 1: an away record published after the override was granted (before the locked authority check) refuses the merge with exit 2 and no gh pr merge ✅ pass live merge-guard-trimmed.log (unchecked-override-away-after-view case inside the attended-only test, ok); merge-guard-prefix-mutation.log shows it failing with 'expected exit 2, got 0' on the pre-fix scrip…
Finding 2: a suite record rewritten to a failing result while the merge reads it is refused, not paired as old suite=pass with new base= ✅ pass live merge-guard-trimmed.log: single-read test ok; merge-guard-prefix-mutation.log shows it failing with 'expected exit 1, got 0' on the pre-fix script
The generated worker brief tells the worker to write the suite record via a temp file and mv ✅ pass live dod-lib.log: all fm-dod-lib tests passed, exit=0
  • Trimmed copy of tests/fm-pr-merge.test.sh (same harness and fixtures) running only the five no-required-checks tests, with all other tests stripped from the copy. Exit 0, all ok.
  • The same trimmed run against the pre-fix bin/fm-pr-merge.sh (from 047b9541^, swapped in temporarily and restored): the late-away-waiver test failed with expected exit 2, got 0, and the torn-record test failed with expected exit 1, got 0.
  • bin/fm-test-run.sh tests/fm-dod-lib.test.sh: exit 0, including the new assertion that the worker brief says to mv the record into place atomically.
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

@Moshik21

Copy link
Copy Markdown
Contributor Author

At 510efd2840d2d4bb1e961305dc9450503121b2cd, the existing security-fixture repair passes all 47 assertions through the normal runner, and CI serial 6 passes. Serial 5 fails at “the watcher did not exit on its auto-relaunch wake within the bound.” The same assertion appears in earlier upstream runs, including October 18 and October 17; its precise timing cause remains unconfirmed. Serial 2 was cancelled without a verdict. This head has 17 passing checks, one failure and one cancellation.

@Moshik21

Copy link
Copy Markdown
Contributor Author

An automatic pipeline repair added an unrelated watcher-wait change in 2e44da0f. It was reverted by the new commit fe60b28b because it is unrelated to this fix and its local verification did not complete. The resulting tree exactly matches 510efd28. The serial-5 watcher assertion also failed before these PRs; the earlier evidence links those runs. No history was rewritten.

@Moshik21
Moshik21 force-pushed the fm/fm-upstream-six-local-fixes-suite branch from fe60b28 to 83c7b17 Compare October 20, 2026 20:22
@Moshik21 Moshik21 changed the title fix(bin): require a recorded suite result and a current base when the base has no required checks fix(bin): require a current base and recorded suite result when the base has no required checks Oct 20, 2026
@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate:

Thanks @Moshik21, and thanks for the detailed scenario transcript. I read the whole diff at 1f6ea876 against main.

Contract-class: new-default. This changes what happens on a fresh install. On any GitHub base branch with no required checks, which is common for a captain's own projects, fm-pr-merge.sh would now refuse a merge in two cases: the head is behind the base tip, or there's no suite-result record with suite=pass at the live base. Every PR-publishing worker brief would also tell the worker to run the full suite and write that record. Today those merges go through. That's a stronger gate, and a reasonable one, but it's a new default for everyone. So the final call is Kun's, a merge-or-leave decision. I won't auto-merge it.

On VISION, the parts Kun will weigh:

  • It strengthens a refusal path, which aligns.
  • The gate rests on a record the worker writes about its own run, and suite=none with a reason is accepted. VISION says workers are "supervised, not trusted" and that "validation belongs to no-mistakes, CI belongs to the forge."
  • Every PR-publishing worker would now spend tokens on a full-suite run.

Before it goes to Kun, I need two things from you. This is waiting on you:

  1. Committed tests for the refusal paths. The Risk section says none of the new refusal paths is tested in the repo. The live driver covered 14 scenarios, but please add the main ones to tests/fm-pr-merge.test.sh so they're regression coverage: behind-base, stale base, suite=fail, suite=none with no reason, missing or symlinked record, unreadable compare, and override ignored while away.
  2. The --herdr-resume-lock-wait change in tests/fm-backend-herdr-presentation-e2e.test.sh came in from a pipeline CI-repair commit. It's unrelated to the merge guard. Please move it to its own PR, or explain in the body why it belongs here.

CI: Behavior portable serial 2 was cancelled at the 30-minute limit (the known #7255 ceiling), and everything else is green. I re-ran that job once (run 39499574511). Please re-raise through git push no-mistakes after the changes above.

@Moshik21
Moshik21 force-pushed the fm/fm-upstream-six-local-fixes-suite branch from 1f6ea87 to 81da486 Compare October 20, 2026 23:27
@Moshik21 Moshik21 changed the title fix(bin): require a current base and recorded suite result when the base has no required checks fix(bin): refuse GitHub merges on unchecked bases without a current suite record Oct 20, 2026
@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate:

Thanks @Moshik21, this covers both things I asked for on 1f6ea876:

  • Refusal-path tests are committed. tests/fm-pr-merge.test.sh now runs the real merge script against fakes for behind-base, stale recorded base, suite=fail, suite=none with no reason, missing, symlinked, and unparsable records, an unreadable compare, suite=none with a reason accepted, and the attended override that a recorded away posture doesn't waive.
  • The Herdr lock-wait edit is out. tests/fm-backend-herdr-presentation-e2e.test.sh is no longer in the diff, and the body says why.
  • The no-mistakes attestation is bound to this head, 81da4862. Since 1f6ea876 the merge-guard code is unchanged; only tests and the scripts index changed.

The one red check is Behavior portable serial 2. It was cancelled at the 30-minute ceiling (#7255), which isn't caused by this PR. I've re-run that job once.

Nothing else is needed from you. The contract class is still new-default: on a GitHub base with no required checks, a fresh install would start refusing merges that go through today. Once CI is green, this goes to Kun as a merge-or-leave decision. That hold is Kun's call, not something waiting on you.

@Moshik21
Moshik21 force-pushed the fm/fm-upstream-six-local-fixes-suite branch from 81da486 to 7c5bc84 Compare October 27, 2026 06:05
@Moshik21 Moshik21 changed the title fix(bin): refuse GitHub merges on unchecked bases without a current suite record fix(bin): guard merges on GitHub bases with no required checks Oct 27, 2026
@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate:

Thanks @Moshik21 for refreshing this onto current main. I compared the new head 7c5bc841 against 7da4c362:

  • The merge-guard code is byte-for-byte the same as 81da4862. bin/fm-pr-merge.sh, fm-dod-lib.sh, fm-pr-lib.sh, fm-brief.sh and fm-promote.sh carry the same change. What's new is fixture work only: tests/fm-pr-check-security.test.sh and tests/fm-captain-hold-lifecycle.test.sh now supply a compare read and a passing suite record, because their fake bases report no required checks.
  • The Herdr lock-wait edit isn't in the net diff. No .github/workflows changes.
  • The no-mistakes attestation is bound to this head.

CI run 40459004178 on this head is still in progress, so I'm waiting on that. Nothing else is needed from you. The contract class is still new-default: on a GitHub base with no required checks, a fresh install would start refusing merges that go through today. Once this run is green, it goes to Kun as a merge-or-leave decision. That hold is Kun's call, not something waiting on you. Your own risk note, that the suite record isn't bound to the validated head, is one of the things he'll weigh.

@Moshik21
Moshik21 force-pushed the fm/fm-upstream-six-local-fixes-suite branch from 7c5bc84 to af93890 Compare November 12, 2026 06:30
@Moshik21 Moshik21 changed the title fix(bin): guard merges on GitHub bases with no required checks fix(bin): guard merges on bases with no required checks Nov 12, 2026
@greptile-apps

greptile-apps Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Critical impact] The PR appears safe to merge; no outstanding or new actionable issues were found.

Reviews (4) · Last reviewed commit: "test(bin): give the waived-red behind ca..." · Reviewed by Greptile

Comment thread bin/fm-pr-merge.sh Resolved
Comment thread bin/fm-pr-merge.sh Resolved
@Moshik21

Copy link
Copy Markdown
Contributor Author

Refresh, 2026-11-12. New head af93890eaec9636497360ed7559afa2c4fc764f5: the seven commits rebased onto main a02b0898 plus one small test commit, re-raised through no-mistakes with the attestation bound to this head. The merge-guard logic in bin/fm-pr-merge.sh is the same as on 7c5bc841. What changed because main moved:

  • fm_dod_block gained a seventh argument on main (PR text auto|manual), so the data directory is now the eighth; bin/fm-brief.sh and bin/fm-promote.sh pass both.
  • Main's manual-PR definition of done is a PR-publishing block too, so it now renders the suite record step like the other two.
  • The no-required-checks refusal also sets FM_PR_GITHUB_OTHER_REFUSAL, as every other non-check refusal on main now does.
  • tests/fm-dod-lib.test.sh passes the data directory as the eighth argument and asserts the manual-PR render (the extra commit).

No .github/workflows changes.

Checks: Test coverage guard, Repo invariants and the no-mistakes body check pass. Full suite is red only because the PR has no full-ci label yet, so lint and the behavior lanes have not run on this head. On a tree identical to this head (macOS), bin/fm-lint.sh passes and bin/fm-test-run.sh passes on fm-pr-merge, fm-captain-hold-lifecycle, fm-dod-lib, fm-brief, fm-self-repo-role, fm-afk-contract and fm-branch-supervision. fm-pr-check-security failed once at watcher did not reach its device re-record, a 2-second bounded wait in a watcher case that does not call the merge script, and passed in full when rerun alone. The earlier red checks on 7c5bc841 were tests/fm-remote-reply.test.sh (the NUL-bearing line was not captured) in serial 3 and a serial 1 job cancelled at its time limit; neither is in this PR's files.

Known follow-ups, not changed in this refresh: the two Greptile comments on this head. The --attended-override waiver is decided from the posture read before verification and is not rechecked under the away-record lock, and the suite record's fields are read separately, so a record being rewritten could be read as a mix of two results. Both would change the guard's contract, so they are left for a separate change.

@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: thanks @Moshik21 for the refresh onto a02b0898 and the clear rundown of what moved (the eighth fm_dod_block argument, the manual-PR render, FM_PR_GITHUB_OTHER_REFUSAL). I read head af93890e against main. The no-mistakes attestation binds this head with no skipped steps, and the coverage guard, repo invariants and the no-mistakes check pass. There are no .github/workflows changes, and the branch is current with main.

This is waiting on you (author): the two open Greptile P1s need fixing in this PR. You called them follow-ups that would change the guard's contract. The guard is new in this PR, so fixing them completes its contract rather than changing an existing one:

  1. "Waiver survives going away" (bin/fm-pr-merge.sh, github_unchecked_base_refusals). On main, require_current_away_authority re-checks every attended-only waiver under the away-record lock. --allow-red, --allow-missing and --allow-no-pipeline are each refused there if the away record has appeared since preflight. The new --attended-override waiver of the behind-base and suite-record conditions is decided once from the pre-lock posture and never re-checked. A merge can then run under away authority with neither condition checked. Please add the matching re-check (refuse, or re-run the two conditions, when the waiver was used and FM_PR_AWAY_POSTURE is now true), with a test.
  2. "Separate reads mix suite results". suite=, base= and reason= come from three separate reads of a file the worker may be rewriting, so an old suite=pass can pair with a new base=. Please read the record once into a variable and parse that copy. Ideally the brief also tells the worker to write it atomically (temp file plus mv). Add a test if you can.

After that, please resolve the two threads and re-raise through git push no-mistakes. Contract-class is still new-default (on a GitHub base with no required checks, a fresh install would start refusing merges that go through today). Once the P1s are closed, this goes on to the full suite and then to Kun as a merge-or-leave decision. Rockets: none.

Moshik21 and others added 9 commits November 12, 2026 07:30
… base has no required checks

On GitHub, when the base branch has no required checks, fm-pr-merge.sh refuses a head behind the live base and requires the ship worker's recorded full-suite result bound to that base commit, with an explicit no-suite escape and the attended override. The direct-PR and no-mistakes briefs now tell the worker to record it as its last step.
…d suite result

The captain-hold lifecycle merge cases use a fake gh whose base reports no
required checks. The merge guard now also reads a forge compare and the
worker's recorded suite result for such a base, so the fake answers the compare
with a current base and run_pr_merge records a passing suite against it.
…fixture regression. The fake GitHub base in tests/fm-pr-check-security.test.sh reports no required checks, so the new fail-closed guard in bin/fm-pr-merge.sh (`github_unchecked_base_refusals`) needs a compare read and a recorded suite result. The fixture supplied neither. The invariant is that any merge-driving fixture against a base with no required checks must supply a compare read (behind_by=0 and a valid base_sha) and a suite=pass record bound to that same base. I kept the prior agent's 14-line candidate, which is the only change in the worktree. It adds three things: - **Compare handler:** the fake `gh` answers `api repos/*/compare/*` with `behind_by=0` and `base_sha=eeee…`. - **`write_suite_record` helper:** it writes `suite=pass`, `base=eeee…` and `ran=…` to the record path. `write_task_meta` calls it, so every task written through that helper gets a record. - **Two direct calls:** one in the legacy task-id merge flow and one in the teardown-race case. Those two don't go through `write_task_meta`. Production code is untouched, and I added no test cases. Verified: `bin/fm-test-run.sh tests/fm-pr-check-security.test.sh` exited 0 with 47 `ok` lines, no `not ok`, and `failed=0`. It took about 11.9 minutes. `bash -n` on the test file also passes. Not run: the repo's lint and other required checks. As instructed, I did not re-run the upstream baseline or the unmodified branch. ci-2 (the cancelled serial 2 job) needs no code change. The change is uncommitted in the worktree, ready for the pipeline to commit and publish
…iling script was tests/fm-backend-herdr-presentation-e2e.test.sh. It failed at "concurrent secondmate recovery" with "herdr presentation recovery could not acquire its session lock; refusing a concurrent resume". All other Herdr scripts passed. The rm "Permission denied" lines in the log are temp-dir cleanup noise after the failure. Invariant: a test that expects two concurrent exact-resume recoveries to serialize on the Herdr session lock must wait for the lock. The default is a bounded attempt of about 5s, then a hard refusal. On a slow CI runner the first recovery can hold the lock longer than that. Cause: a pre-existing timing race in the test. The PR touches only the merge, DoD and brief scripts and their fixtures, none of which are on the Herdr presentation path. Fix: in tests/fm-backend-herdr-presentation-e2e.test.sh I added the documented `--herdr-resume-lock-wait` flag to the two concurrent recovery spawns (primary-wave-resume and bravo-wave-resume). No production code changed. The other backgrounded spawns in the file are clean creates, which fall back flat on contention. The default-refuse test and the existing opt-in wait test are untouched. Verified: `bash -n` on the edited test file passes. NOT verified: the local run of `bin/fm-test-run.sh tests/fm-backend-herdr-presentation-e2e.test.sh` was killed at the background time limit before it finished, so the changed test has not been shown to pass locally. Lint and the other required checks were not run. The next CI run of the Herdr job will confirm the fix. ci-2 (the cancelled serial 2 job) needs no code change, per the earlier decision
…e suite record step

Add regression tests to tests/fm-pr-merge.test.sh for a head behind the base tip, a stale recorded base, suite=fail, suite=none with and without a reason, a missing, symlinked or unparsable record, an unreadable compare, and the attended override (waived when attended, not while away). Add a tests/fm-dod-lib.test.sh case for the suite record step in the PR-publishing DoD.

Remove the unrelated --herdr-resume-lock-wait change to tests/fm-backend-herdr-presentation-e2e.test.sh that an automatic CI repair added.
…rgument

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
… the suite record once

The --attended-override waiver of the behind-base and suite-record
conditions is now refused when the away-posture record appears before the
merge runs under its lock, like the other attended-only waivers.
The suite record is read into one copy before its fields are parsed, so a
record being rewritten cannot pair an old suite= with a new base=, and the
worker brief says to replace the record with a temporary file and mv.
@Moshik21
Moshik21 force-pushed the fm/fm-upstream-six-local-fixes-suite branch from af93890 to 047b954 Compare November 12, 2026 14:34
Comment thread bin/fm-pr-merge.sh Resolved
The recorded full-suite result carried only base=, so a passing record
made before a later push still approved the newer head. The record now
names head=<sha> and the merge guard requires it to equal the live pull
request head before accepting suite=pass.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@kunchenguid kunchenguid added the full-ci Maintainer go-ahead: run the full CI suite on this outside pull request label Nov 12, 2026
@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: thanks @Moshik21, all three P1s are closed in the code. I've queued the full suite (full-ci) on 33bf256f.

  • Waiver survives going away: fixed. --attended-override now sets FM_PR_GITHUB_UNCHECKED_WAIVED, and require_current_away_authority refuses it if the away record has appeared, the same way the other attended-only waivers are refused.
  • Separate reads mix suite results: fixed. The record is read once into contents, and every field is parsed from that copy.
  • Older tests approve newer code (raised on 047b9541): fixed in 33bf256f. A suite=pass record must now name head=<sha> equal to the live PR head, and a missing head refuses.

All three threads are resolved, and Greptile is 5/5 on 33bf256f. The no-mistakes attestation binds this head with no skipped steps, and live validation is go 6/6. The coverage guard and repo invariants pass. There are no workflow changes, and it is current with main a9ae3c0c with no conflict.

Contract class: still new-default. On a GitHub base with no required checks, a fresh install would start refusing merges that go through today, and PR-publishing briefs gain a suite-record step. So if the suite is green, this goes to Kun as a merge-or-leave decision. VISION.md: every rule aligns. It strengthens a refusal path and never runs repository code. Nothing is needed from you right now. It's waiting on CI.

…ad matches the suite record

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@Moshik21

Copy link
Copy Markdown
Contributor Author

Fixes for the two review threads, 2026-11-12. New head 937c622077e6315669ead58d1c9caa8ee52310a5, rebased onto main a9ae3c0c and re-raised through no-mistakes; the attestation binds this head. No .github/workflows changes.

  • Waiver survives going away: require_current_away_authority now refuses (exit 2) when the --attended-override waiver of the behind-base and suite-record conditions was used and the away-posture record is present at the locked recheck, the same way it treats --allow-red, --allow-missing and --allow-no-pipeline. The waiver decision moved from github_unchecked_base_refusals (which runs in a subshell) to its caller, so the flag survives to the recheck. The new case unchecked-override-away-after-view publishes the away record after the PR view; before the fix it merged.
  • Separate reads mix suite results: the record is read once, and suite=, base=, reason= (and now head=) are parsed from that one copy. The worker's definition of done now says to write the record to a temporary file and mv it into place. The new test test_unchecked_base_reads_the_suite_record_once rewrites the record after the first read; before the fix the merge went through.
  • Older tests approve newer code (the Greptile comment on the intermediate head): the record now carries head= from git rev-parse HEAD, and suite=pass is accepted only when it equals the live PR head; a missing or different head refuses. There are new cases for both. One existing case, github-behind-unknown-after-waived-red, now declares a required check like its sibling cases, because after --update-branch its head changes and a no-required-checks base rightly refuses the old record.
  • Rebase: main moved github_read_required_contexts and github_required_checks_missing into bin/fm-pr-lib.sh; they stay there unchanged, and only github_unchecked_base_refusals remains in bin/fm-pr-merge.sh.

Checks on this head: 19 of 22 full-suite jobs passed, plus Greptile Review and the no-mistakes check. Behavior portable serial 5 and Lint 1 were cancelled at the 30-minute job limit with no failure before the cut (every finished script exited 0, no lint error), so the aggregate Full suite check is red. A maintainer rerun of those two jobs would give a verdict; they cannot be rerun from the fork. Locally on this tree (macOS), tests/fm-pr-merge.test.sh passes in full (146 ok). On the previous head, which differs only by that one test line, fm-dod-lib, fm-pr-check-security, fm-captain-hold-lifecycle and bin/fm-lint.sh pass.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

full-ci Maintainer go-ahead: run the full CI suite on this outside pull request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants