Repository navigation
ci: refresh the live PR body before the required no-mistakes check - #266
Merged
Merged
Conversation
A synchronize webhook, and a GitHub rerun of that job, carries the previous head's attestation snapshot. Loading the live body before the pinned action lets a fix-round rerun see the rebound attestation instead of failing as a frozen mismatch or a missing signature. Co-authored-by: Cursor <cursoragent@cursor.com>
…404s and fetch failures
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
Fix the required GitHub check named "PR must be raised via no-mistakes" so a firstmate pull request that takes a fix round can reach fully green. Evidence is #258.
Reproduce the synchronize path first from the failing run logs, not from the workflow file. The reported error was "python interpreter not found; cannot parse pipeline attestation", and the hypothesized split was opened passes / synchronize fails, with reruns of synchronize run 33810709843 staying red. Do not treat that python-missing diagnosis as given: establish why the interpreter would be present on one trigger and absent on the other, and do not guess. The likely remedy of adding actions/setup-python before the check was unverified and only a starting point.
Scope: the fix goes in this repository's own workflow. Do not modify, unpin, re-pin, fork, or vendor the pinned upstream action kunchenguid/no-mistakes@32d396a. If the defect is genuinely inside that pinned action and cannot be worked around from our side, stop and report a blocker rather than touching it.
A green opened run is not evidence. Name the trigger event behind every check result cited. The pull request body must name the reproduction (which run, which trigger, what was observed, what was established about the mechanism or explicitly could not be), quote the verbatim error line from a failing run log, state the trigger behind every cited check result, reference #258, include Closes #258, and amend the pipeline-owned PR body rather than replacing it. Comment on issue 258 with a substantive delivery summary. Do not merge.
Decisions made while reproducing: the python-not-found string is the pinned action's script source printed by GitHub on every run, including green opened runs; it is not an executed error. Python ran on synchronize. The executed failures were a real checker verdict: missing signature on some synchronize runs, and on 33810709843 all three attempts "Pipeline attestation head_sha does not match the current PR head" (attestation 4079582 vs head 6d2304c). Reruns replay the original webhook snapshot, so they cannot see a body the pipeline wrote afterwards. Therefore setup-python was not shipped. The workaround in our workflow is to fetch the live pull-request body (without checking out PR code) and write it into the event payload before the unchanged pinned action, waiting briefly for the attestation to bind the triggering head, then still writing a still-stale live body through so the action reports a real mismatch instead of a missing signature.
What Changed
.github/scripts/nm-required-refresh-event-body.py, which reads the live pull-request body over the GraphQL API and writes it intopull_request.bodyinGITHUB_EVENT_PATHbefore the compliance gate reads it. It polls until the body'sno-mistakes-pipeline-attestation:v1head_shabinds the expected head, stops early for a body carrying neither the attestation nor the no-mistakes signature marker, and writes a still-stale body through once the budget is spent so the action reports a real mismatch rather than a missing signature. Every failure path (no token, noGITHUB_REPOSITORY, transport or GraphQL error, malformed response) prints a::warning::and exits 0, and a single failed attempt costs one poll rather than the whole wait..github/workflows/no-mistakes-required.ymlgainedpull-requests: readand a step ahead of the unchanged pinnedrequire-no-mistakes@32d396acaction: it downloads the helper from the contents API atgithub.sha(no PR checkout), runs it underpython3orpythonwith a 120s budget at an 8s interval, and annotates a warning while leaving the webhook snapshot in place when the helper is unfetchable, the interpreter is absent, or the helper exits non-zero.tests/fm-no-mistakes-required-gate.test.shby ~1100 lines covering the wait, the still-stale write-through, the signature-only and hand-authored bodies, mid-wait transient failures, exhausted budgets, and the workflow's step order, fetch ref, and degrade annotations; documented the divergence indocs/fork-divergence.mdas its own entry, stated the live-body read and its fallback inCONTRIBUTING.md, and added.github/scripts/to the shared tracked material list inAGENTS.md.Risk Assessment
✅ Low: The change is well-bounded and every failure path I traced - unfetchable helper, missing interpreter, helper crash, unreachable or malformed GraphQL response, spent wait budget - degrades to the pre-change behavior of judging the webhook snapshot with a warning annotation, the pinned action is untouched, and the helper's bind predicate was confirmed identical to the pinned verifier's own attestation parse.
Testing
Reproduced the reported failure from the real GitHub run first (run 33810709843, trigger synchronize on PR #254), confirming from its raw log that the python-not-found string is the pinned action's echoed script source and the executed failure is the head_sha mismatch (attestation 4079582 vs head 6d2304c). Then demonstrated the fix end-to-end by executing the workflow's own refresh step and the pinned action's own composite step against the real verify.py at 32d396ac: the same event payload that reds pre-refresh goes green post-refresh after a 16s wait on the declared 120s/8s budget, a genuinely stale live body still produces the real mismatch verdict, and both degrade paths annotate with a warning and let the action emit a verdict instead of reddening the gate. The targeted gate suite (18 cases) and the sibling pinned-action suite pass, the gate suite is stable over four consecutive runs, and the same suite fails on the base commit, so the regression is really covered. This change is CI/workflow only and has no rendered UI surface of its own; its end-user surface is the GitHub check-run result, captured both as a screenshot of the real failing run's annotations and as a full CLI transcript of the simulated job. No test failures, setup problems, or flakiness found, and no transient files were left in the worktree.
~/.no-mistakes/evidence/01M1N08VM3082R4P4F91T6AX0N/repro-github-check-run-33810709843.png)Evidence: End-to-end transcript: the required check red before the fix, green after it, and every degrade path
Evidence: Before/after of the required check (excerpt of the end-to-end transcript)
Evidence: Raw log of the reproduced failing run 33810709843 (synchronize) - python-not-found is echoed script source, the mismatch is the executed error
Evidence: Fail-before-fix: the new suite run against base commit bb26893
Evidence: Targeted suite output (tests/fm-no-mistakes-required-gate.test.sh)
Evidence: End-to-end harness used to produce the transcript (workflow step extractor, GraphQL stub, run script)
CI note (unresolved elsewhere, not resolved here)
Portable serial 6 and 8 failed on the first pass of run 33835336284. Serial 6 (job 100906573610) exited 124 where the test expected 137. Serial 8 (job 100906573770) did not see a remote job worker become ready after startup. A re-run of those two jobs on the same run did not reproduce either (serial 6 job 100909448093 pass, serial 8 job 100909448082 pass). That is the known shared-runner condition tracked as #262, not evidence that those suites are sound, and not a defect in this PR. This PR being green is not proof those tests are reliable. The question stays open on #262. Bounds were not widened. The required check "PR must be raised via no-mistakes" passed on this PR's opened run 33835336291.
Pipeline
Updates from git push no-mistakes
... (3 earlier update rounds omitted to keep the PR body within GitHub's 65536-char limit; full history is in the run log.)
🔧 Fix: harden required-check live-body refresh against 404s and fetch failures
6 issues (1 warning, 5 infos) still open:
tests/fm-no-mistakes-required-gate.test.sh:306- No test exercises a successful live-body fetch. Tests 5, 6, 7 and the executed step in test 9 all pass --body-file/NM_REQUIRED_BODY_FILE, which returns from fetch_live_body at .github/scripts/nm-required-refresh-event-body.py:82 before the GraphQL path; test 8 only exercises the transport failure. The fix round then turned every fetch failure intoreturn 0with a::warning::(helper lines 183-190), so a broken fetch is now silent. Concrete failure: change the query topullRequest(number:$p){bodyText}- GitHub replies witherrors, fetch_live_body raises LiveBodyUnavailable, main() prints a warning and exits 0, the step is GREEN, the pinned action judges the webhook snapshot, and the required check keeps failing exactly as it did in run 33810709843. Every test in this suite still passes. (I verified the query as written is correct today: executed against api.github.com/graphql for PR Merge upstream round 3 through kunchenguid/firstmate@9e3df47b #264, errors=None, 27092-byte body - so this is a regression-detection gap, not a live defect.) Mechanical remedy, no behavior change: add a case that points GITHUB_GRAPHQL_URL at a local stub returning{"data":{"repository":{"pullRequest":{"body":...}}}}and asserts that body lands in the event payload..github/scripts/nm-required-refresh-event-body.py:187- When a fetch fails after an earlier one succeeded,body is not None, so the except block falls through to line 192 and writes the last body - but prints nothing about the failure, and then prints "Refreshed pull_request.body from the live pull request" as if the full wait budget had been spent. Trace: fetch at t=0 returns the pre-push body (attestation 4079582, head 6d2304c), sleep 8, fetch at t=8 gets a 502 -> loop aborts at 8s of a 120s budget -> the stale body is written -> the action emits "Pipeline attestation head_sha does not match the current PR head". The operator sees the same mismatch text issue Required no-mistakes check errors with "python interpreter not found", producing a red that is not a verdict #258 was filed over, with no signal that the wait was cut short by an API error rather than genuinely exhausted. Emit the same::warning::on that branch before falling through..github/workflows/no-mistakes-required.yml:38- The comment claims fetching atgithub.sha"resolves for every open PR once this reaches main". That is not true for a PR that conflicts with main: GitHub cannot recompute refs/pull/N/merge, so the stale ref keeps pointing at a merge of an older base. Verified on currently-open PR fix(bin): harden guarded merge execution in fm-pr-merge #241: REST reportsmergeable:false, mergeable_state:dirty, merge_commit_sha:null, yetrefs/pull/241/mergestill exists at80af4f7f71c1a68a037f2093d19b8b577fc67124, whose base parent0c51a080is a 2026-09-02 main - two days behind current mainbb268932. Once this lands, that tree will not contain the helper, curl 404s, and the step degrades to the webhook snapshot. Behaviorally that is the honest fallback the fix round added, so nothing is broken - but the comment (and the matching error message in tests/fm-no-mistakes-required-gate.test.sh:~430, "a PR head ref 404s until the branch takes main") overstates the guarantee. Scope the remedy to correcting the claim; adding a base-branch (github.base_ref) fallback ref would extend the change and needs authorization..github/scripts/nm-required-refresh-event-body.py:53- The workflow sets no timeout/interval, so every run whose live body does not bind the triggering head burns the full default budget: 120s with an 8s interval = ~16 GraphQL calls before the pinned action can report anything. Concrete case: a contributor opens a PR by hand with body "please merge" - attestation_head() returns "" which never equals the head SHA, so the helper polls for two minutes before the action emits "This PR was not raised through no-mistakes", where it previously reported in seconds. The same knob cuts the other way: if the pipeline's post-push body write takes longer than 120s, the run still reds and green still depends on a manual rerun. Remedy changes behavior (skip the wait when the live body carries no signature marker at all, and/or set the budget explicitly in the workflow), so it needs your call rather than a silent fix.tests/fm-no-mistakes-required-gate.test.sh:321-fm_run_timed 30bounds the helper at exactly the 30s socket timeout the helper passes to urlopen (helper line 112). On a host where loopback port 1 is DROPped by a firewall rather than refused, connect() hangs instead of failing fast, and the two 30s deadlines race: fm_run_timed can TERM the process first, giving rc=124 and "an unreachable live body failed the required check" - a false red for a suite that is asserting the opposite. Raise the outer bound (e.g. 60) so the helper's own failure always wins..github/workflows/no-mistakes-required.yml:46- Re-verifying round 1'sgate-executes-pr-head-codefinding against the fix: moving the ref from the PR head SHA togithub.shadid NOT make the helper base-trusted.github.shais the PR merge commit, so a PR that edits .github/scripts/nm-required-refresh-event-body.py still gets its own version downloaded and run by the gate. It is reduced to parity with what was already exposed:pull_requestworkflows load their definition from that same merge ref, so a PR could already rewrite this workflow's steps directly, and the pinned verify.py states the NON-GOAL explicitly ("a hand-written body that reproduces the documented format passes this check"). No residual action recommended - recording the accurate status so the fix is not read as having closed it.🔧 Fix: scope the live-body wait and cover its transport paths
3 issues (2 warnings, 1 info) still open:
.github/scripts/nm-required-refresh-event-body.py:129- The degrade path misses the transport errors urllib raises after the request is sent, so an ordinary GitHub transient reds the required check with a traceback instead of falling back to the webhook snapshot. In CPython's urllib.request.AbstractHTTPHandler.do_open, onlyh.request(...)is wrapped into URLError;r = h.getresponse()is not, and neither isresponse.read()at line 128. So http.client.RemoteDisconnected (ConnectionResetError + BadStatusLine), IncompleteRead, and a mid-stream ConnectionResetError/SSLError all escape this except tuple, escapemain'sexcept LiveBodyUnavailableat line 202, and abort the process. Reproduced against the real helper: an endpoint that accepts the POST and closes without a response produceshttp.client.RemoteDisconnected: Remote end closed connection without responseand EXIT=1, which under the workflow step'sset -eu(.github/workflows/no-mistakes-required.yml:57) fails the step, so "PR must be raised via no-mistakes" is red with no compliance verdict at all - the exact outcome the comment at lines 203-205 and test 10 claim this path prevents, and strictly worse than the pre-change behavior where the same PR still reached a verdict from the snapshot. Test 10 does not cover it: a refused connection fails insideh.request()and so IS wrapped into URLError, which is why it passes today. Remedy is mechanical and stays inside the existing contract: addimport http.clientand broaden toexcept (OSError, http.client.HTTPException, json.JSONDecodeError) as err(OSError already subsumes URLError and TimeoutError), and cover it with a stub that closes the connection without answering.tests/fm-no-mistakes-required-gate.test.sh:276- The new tests start background fixtures whose PIDs are never recorded or killed, so a failing assertion turns a one-second red into a 480s bounded timeout. Concrete sequence for test 7: the helper regresses and stops re-fetching, so the writer subshell is parked inattestation_body "$NEW_HEAD" > "$live"- an open-for-write on a FIFO with no reader, which unlinking the fixture does not wake. The test callsfail, which exits 1; tests/lib.sh's EXIT trap only removes temp dirs, so the orphan survives holding the inherited stdout write end. bin/fm-test-run.sh:2154 runs each script asbash "$1" 2>&1 | tee "$2", so tee never sees EOF, the pipeline never completes, and fm_run_timed bounds it at the 480s DEFAULT_PER_SCRIPT_TIMEOUT_SECS - which that file's own shard arithmetic (bin/fm-test-run.sh:163-180) says can push a portable-serial shard past its lane cap and lose per-script attribution entirely. Same shape at line 324 (test 8) and line 503, where the GraphQL stub blocks forever inserver.handle_request()if the helper makes fewer requests than its plan. The repo already has the precedent for this (fm_test_stop_remote_job_worker in tests/lib.sh): capture$!when starting each fixture and kill it beforefail/ on test exit.tests/fm-no-mistakes-required-gate.test.sh:175- The same four-line python3 skip guard is copy-pasted into all nine new tests (lines 175, 216, 256, 309, 352, 395, 522, 570, 751), 36 lines that all print the identical string. The suite cannot use the repo's top-of-filecommand -v python3 ... || exit 0convention because tests 1-4 and 14 must still run without python3, but a singlerequire_python3()helper returning non-zero (called asrequire_python3 || return 0) collapses all nine to one line each with no behavior change.🔧 Fix: degrade on post-request transport errors and bound test fixtures
3 issues (2 warnings, 1 info) still open:
.github/scripts/nm-required-refresh-event-body.py:187- Thetry:wraps the entirewhile True:poll, so the first LiveBodyUnavailable from any single attempt ends the whole wait budget rather than just that attempt - and the failure it produces is exactly the red this change exists to eliminate. Concrete trace with the workflow's shipped settings (no-mistakes-required.yml:54-55, 120s at an 8s interval,15 fetches against api.github.com/graphql): fetch feat(harness): add crew-only cursor and agy adapters #1 at t0 returns the pre-push body whose attestation binds H1 whileexpectedis H2, soattestation_head(body) == expectedis false andraised_through_no_mistakes(body)is true (the signature is present) and the helper sleeps 8s; fetch feat(spawn): add a design crewmate profile that lands an ADR #2 at t~8 gets an ordinary GitHub 502, which round 3 correctly made catchable (HTTPError is an OSError, line 129), so LiveBodyUnavailable propagates out of the loop; the handler at line 202 seesbodyis not None, prints the warning, and line 214 writes the H1 body through. The pinned verify.py I read at 32d396ac then hitscheck_head_bindand fails with "Pipeline attestation head_sha does not match the current PR head" - verbatim the issue-258 red, produced at 8 seconds of a 120-second budget that had 14 attempts left and would have gone green. Test 12 codifies this shape and its own comment (line 610) calls that 502 "the transient the full 120s budget is meant to ride out", which is the opposite of what the code does. The remedy stays inside the existing loop and adds no new state, subsystem, or persistence: catch LiveBodyUnavailable per attempt, retain the last successfully read body, warn once, and keep polling until the deadline; fall through to the write only when the budget is genuinely exhausted, and keep the existingbody is Nonedegrade for the case where no fetch ever succeeded. This is a claim about control flow and is distinct from round 2's decision on this branch, which chose the warning text so an aborted wait is not reported as a clean refresh - it did not decide that one blip should end the wait.tests/fm-no-mistakes-required-gate.test.sh:212- The single assumption the whole change rests on is asserted nowhere: that the pinned action reads the pull-request body from $GITHUB_EVENT_PATH at run time, so a step that rewrites that file beforehand changes the verdict (stated as fact in the workflow comment at no-mistakes-required.yml:32). Every new helper case (tests 5-13) asserts only what the helper wrote into event.json and stops there; test 14 executes the workflow's own run block but still ends at event.json. The sibling suite tests/fm-no-mistakes-required.test.sh does drive the real verify.py, butrun_verifier(line 36) always passes PR_BODY explicitly, which is precisely the branch this change never uses. So if the pinned verifier had instead read${{ github.event.pull_request.body }}- an expression GitHub resolves from the job's in-memory context, which is never refreshed from disk - the change would be an inert no-op, every added test would still be green, and the required check would stay red: the exact shape of Required no-mistakes check errors with "python interpreter not found", producing a red that is not a verdict #258. I confirmed out of band against the pinned source at 32d396ac thatevent_payload()opens GITHUB_EVENT_PATH at run time andFacts.bodyfalls back to it when PR_BODY is empty, so the mechanism does hold today; what is missing is the regression that keeps it holding when the pin is next bumped. The remedy reuses machinery already in the repo rather than adding any: tests/fm-no-mistakes-required.test.sh already hasfetch_shared_verifierdownloading that verifier at this same ref, so add one case that runs it with GITHUB_EVENT_PATH pointed at the pre-refresh event (expect non-zero and "head_sha does not match") and again at the event the helper rewrote (expect 0). That is the red-before/green-after reproduction of the reported failure that the current cases stop one link short of.tests/fm-no-mistakes-required-gate.test.sh:111- This change introducedworkflow_model_json(line 689), which normalizes the required-check workflow into a typed job/step model and refuses any construct it cannot represent, and test 14 asserts the step order, env, and pin against that model. Tests 2 and 3 still assert the same file withsed -n '/^[[:space:]]*types:/p'andsed -n '/^[[:space:]]*group:/p'compared for exact string equality against hardcoded lines including their leading indentation, so a purely cosmetic reflow ofon:orconcurrency:reds them while a semantically identical model passes, and thetypes:pattern would silently concatenate two lines if any future step ever carried that key. Readingon.pull_request.typesandconcurrency.group/concurrency.cancel-in-progressoff$tmp/model.jsonexpresses the same two divergence invariants (which docs/fork-divergence.md:177 says this suite pins) as meaning rather than as file text, with no behavior change. Scoped to these two cases in this file, not a repository-wide sweep.🔧 Fix: retry per attempt and drive the pinned verifier
2 issues (1 warning, 1 info) still open:
tests/fm-no-mistakes-required-gate.test.sh:109- On a host without python3, 14 of this suite's 17 cases silently no-op and the run is still recorded as a clean pass, so the workflow this change ships is asserted by nothing.require_python3 || return 0returns beforepass, andbin/fm-test-run.sh:1469 detect_gate_skiponly recognizes a gate skip when the FIRST non-empty output line starts withskip:. Test 1 (test_reproduce_issue_98_sequence, line 62) needs no python3 and always printsok - ...first, so every laterskip:line is invisible: the script exits 0 andFM_TEST_ENDrecordsgate_skip=false. What still runs is tests 1, 4 and 17, which are self-contained bash reimplementations of a grep and touch neither .github/workflows/no-mistakes-required.yml nor the refresh helper. The last fix round widened this: tests 2 and 3 (lines 109 and 133) were previously unconditionalsed-and-string comparisons and now sit behind the same guard, so theedited-trigger and per-PR concurrency divergence that docs/fork-divergence.md:177 names this suite as the pin for has no enforcement at all on such a host. The suite's own toolchain comment (line 20) states python3 is optional here and bin/fm-bootstrap.sh does not install it, so this is a host the repo expects. tests/lib.sh:82-89 already names this exact failure shape - "a test that is defined and never invoked reports safety it never checked, and it is invisible while it does". Remedy reuses the pattern the sibling suite already has at tests/fm-no-mistakes-required.test.sh:16-19: a top-of-filecommand -v python3 >/dev/null 2>&1 || { echo "skip: python3 not found ..."; exit 0; }so the first output line is the skip and the runner records gate_skip=true, replacing the per-case guards. No new machinery, no product behavior change.tests/fm-no-mistakes-required-gate.test.sh:1037- Test 16 is the only case that proves the assumption the whole change rests on - that the pinned verifier's verdict turns on what the helper wrote to GITHUB_EVENT_PATH - and it silently disappears when the network is unavailable: a curl failure echoesskip:mid-run and returns 0. Because that line is not the first non-empty output line, bin/fm-test-run.sh:1469 does not see a gate skip, so an offline run reports this suite green with the load-bearing case never executed. The sibling suite fetches the same file from the same ref and callsfailinstead (tests/fm-no-mistakes-required.test.sh:28-34), so the repo's own convention for this fetch is hard-fail; a full sweep would be red anyway, but a change-selected run of this suite alone would not. Aligning line 1037 (and the curl-missing branch at 1025) withfailmatches the established pattern and costs nothing when the network is up.🔧 Fix: fail rather than skip when the pinned verifier is unreachable
3 issues (2 warnings, 1 info) still open:
.github/workflows/no-mistakes-required.yml:38- The step comment (lines 36-39) says the helper is fetched at github.sha, "the pull-request merge commit ... so it carries whatever the base branch held", and tests/fm-no-mistakes-required-gate.test.sh:934 repeats it ("which carries the copy on the base branch; a PR head ref carries it only once that branch itself takes main"). That is inverted. On a pull_request event github.sha is the test-merge commit refs/pull/N/merge, whose tree is the PR head merged INTO base, so the contents API at that ref returns the pull request's own copy of .github/scripts/nm-required-refresh-event-body.py. The change in fact depends on this: the helper does not exist on main, so if the merge ref carried only base content the curl would 404 on this very PR and the refresh would be inert. So the ref choice is right and MUST NOT be changed to github.event.pull_request.base.sha - what is wrong is the recorded rationale, and it matters twice over. First, it is the sole justification given for the ref, so the next reader cannot check it. Second, it asserts the required check runs base-controlled code when the job actually downloads and executes PR-authored Python with GITHUB_TOKEN in the environment - the property the pinned action explicitly advertises it does not have ("Nothing here reads the repository contents, so a fork's code is never executed"), and the property the intent's "without checking out PR code" was protecting. This is not a new bypass (under pull_request the workflow YAML itself already comes from the merge ref, and the pinned verifier documents itself as a contributor guardrail rather than a security boundary), so the minimal remedy is to correct the comment and the test message to say the merge ref carries the PR's copy. Flagged ask-user rather than auto-fix because you may instead want to decide that executing PR-authored Python inside the required check is not acceptable, which is a design call and not mine to make..github/scripts/nm-required-refresh-event-body.py:131- fetch_live_body catches OSError, http.client.HTTPException and json.JSONDecodeError around urlopen, then calls payload.get("errors") on whatever json.loads produced. json.loads succeeds on any valid JSON value, so a response body that is a JSON array or scalar - a proxy or GHES error page that is valid JSON but not an object - makes payload.get raise AttributeError, which is not a LiveBodyUnavailable and is caught nowhere. The helper exits non-zero with a traceback, the workflow step is underset -eu, and "PR must be raised via no-mistakes" reports failure with the pinned action never having run - strictly worse than the webhook-snapshot verdict this change was written to improve on, and the exact outcome the step comment at .github/workflows/no-mistakes-required.yml:41-44 promises cannot happen ("a live body that cannot be read leaves the webhook snapshot in place for the pinned action to judge rather than reddening the required check without a verdict"). Remedy is mechanical and stays inside the existing degrade path: after json.loads,if not isinstance(payload, dict): raise LiveBodyUnavailable(f"unexpected response shape: {payload!r}"), which routes it through the same per-attempt retry and snapshot fallback every other transport failure already uses..github/workflows/no-mistakes-required.yml:67- The step comment states the refresh is best effort and must leave the webhook snapshot for the pinned action rather than red the required check, but the run block only honors that for the curl 404 branch.python3 "$script"underset -eufails the step for any non-zero helper exit, and the interpreter resolution is narrower than the pinned action's own: action.yml at 32d396ac tries python3, then falls back topython, and only errors when neither exists, so a runner carryingpythonbut notpython3would satisfy the pinned action while this new step reds the gate ahead of it. runs-on is ubuntu-latest today so the interpreter half is not reachable now, which is why this is info rather than warning; the general half is reachable through any unhandled helper exception (see the AttributeError path above) or an OSError rewriting the event payload. Mirroring the action'scommand -v python3 || command -v pythonresolution and letting a helper failure emit::warning::live-body refresh failed; judging the webhook snapshotinstead of failing the step would make the code match the contract the comment states. Note the tradeoff: swallowing the helper's exit code also hides genuine helper bugs behind a warning, so if you prefer a loud failure there, the honest fix is to narrow the comment instead.🔧 Fix: correct the merge-ref rationale and annotate every degrade
1 info still open:
.github/scripts/nm-required-refresh-event-body.py:239- The helper rewrites GITHUB_EVENT_PATH in place withopen(path, "w")+json.dump, which truncates the only artifact the required check's verdict is computed from before it has a replacement to write. If that write does not complete (ENOSPC on the runner, or the process dying between truncate and flush), verify.py'sevent_payload()swallows the JSONDecodeError and returns{}, soFacts.bodybecomes "" and check_signature reds a compliant PR with "This PR was not raised through no-mistakes" - a wrong verdict rather than the degrade the step promises, and one the step'sif ! "$PY" "$script"guard cannot restore because the damage is already on disk. I could not construct a likely trigger on ubuntu-latest (job cancellation reports the check as cancelled, not red), so this is info rather than warning. The remedy is mechanical and stays inside the existing write: dump to a sibling temp file in the same directory andos.replaceit over the event path, so a partial write can never be what the pinned action reads.✅ **Test** - passed
✅ No issues found.
bash tests/fm-no-mistakes-required-gate.test.sh- 18/18 pass (repeated 4x, no flakiness)bash tests/fm-no-mistakes-required.test.sh- sibling pinned-action suite, 3/3 passFail-before-fix check: ran the new suite against a temp checkout of base commit bb268932 - fails attest_refresh_replaces_stale_synchronize_snapshotbecause the helper does not exist theregh-axi run view 33810709843 --repo HelloWorldSungin/firstmate --log- pulled the real failing synchronize run log and confirmed the executed error vs. the echoed run-script sourceBrowser capture of the real failing check-run annotations at github.com/HelloWorldSungin/firstmate/actions/runs/33810709843/job/100849798818 viachrome-devtools-axiEnd-to-end job simulationbash evidence/e2e/run-e2e.sh- 5 arms: pre-fix synchronize (red), post-fix synchronize with mid-job body write (green after 16s), still-stale live body (real mismatch verdict), missing python interpreter (warning + verdict), unfetchable helper (warning + verdict)Extracted the workflow's refresh step and the pinned action's composite step with PyYAML (evidence/e2e/extract-step.py) and executed both verbatim against the realverify.pyfetched at 32d396acgit show bb268932:.github/workflows/no-mistakes-required.yml | grep uses:vs target - confirmed the pinned action ref is unchanged and no copy of it was vendored🔧 **Document** - 2 issues found → auto-fixed ✅
docs/fork-divergence.md:174- The entry heading is still "Fork-local no-mistakes compliance-gate event scope", but the entry now records two separate divergences: the omittededitedtrigger plus per-PR concurrency (2026-08-14) and the live-body refresh step and its fork-local helper (2026-09-04). The body states both and I left the heading alone deliberately: retitling or splitting into a second ledger entry is a curation call for the ledger's owner, and the ledger's convention is one entry per divergence with its own dated introduction and retirement condition. No in-repo link targets this anchor, so a split or rename would break nothing.CONTRIBUTING.md:46- This change adds.github/scripts/as a new tracked directory holding shared material that must ship through the no-mistakes pipeline, but the three enumerations of shared tracked material (CONTRIBUTING.md:46 "Only shared material is tracked: ...", CONTRIBUTING.md:74, AGENTS.md:49) and the AGENTS.md layout tree do not name it. I did not add it because those lists already omittests/anddocs/, which are equally tracked and equally gated, so they are evidently curated categories rather than an exhaustive tracked-path inventory; adding one path would deepen that inconsistency rather than fix it. The real fix is deciding whether those lists are exhaustive and reconciling all three plus the layout tree in one pass, which is a consolidation beyond this change's scope.🔧 Fix: split the refresh ledger entry and record .github/scripts
✅ Re-checked - no issues remain.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.