Skip to content

fix(bin): keep signal-stopped contribution reads unmeasured - #7332

Closed
sgwoods wants to merge 4 commits into
kunchenguid:mainfrom
sgwoods:fm/contrib-signal-stopped-unmeasured
Closed

sgwoods wants to merge 4 commits into
kunchenguid:mainfrom
sgwoods:fm/contrib-signal-stopped-unmeasured

Conversation

@sgwoods

@sgwoods sgwoods commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Intent

bin/fm-contributions.sh poll records an error for a forge read that a signal aimed at the read alone
stopped. forge() recognizes only status 124 — the bound the timeout runner reports for its own
per-read cap — so a read ended by an external SIGKILL (137), or by TERM (143), INT (130) or HUP (129)
delivered to the read rather than to the poll, is recorded as an unavailable observation and raises an
observation-unavailable wake for a pull request that is open and unchanged.

A read stopped that way answered nothing, so it is unmeasured rather than a forge failure. This is a
restore rather than a new behaviour: the script header already promised that a read a bound stopped
"remains bounded and may be unmeasured, rather than being mislabeled unavailable". The behaviour and
the documentation disagreed, and the documentation was the one that was right.

The five-second cap is not what this fixes. That path was already correct: every timeout mechanism
normalizes its own bound to 124 (fm_run_external_timeout collapses its own 124|137, the perl
watchdog exits 124 from its handler, the bash fallback returns 124 when its deadline fired), and
forge() already treated 124 as unmeasured. On a host using the perl mechanism, fm_run_timed 1 sleep 3
returns 124.

Relationship to the two changes that landed alongside this.

  • fix: keep unsupported contribution URLs unmeasured #7233 independently fixed unsupported-forge URLs, by gating observation on supported_url and
    keeping them out of final settlement and the forge-read rotation. An earlier revision of this work
    carried its own fix for that; it is withdrawn entirely, with credit to fix: keep unsupported contribution URLs unmeasured #7233, together with its test,
    because that test passes against current main without this change and so demonstrates nothing.
  • fix(bin): name the failing step when a contribution observation is unavailable #6810 now names the first failing step in the error and its unavailable line. That is preserved
    exactly: the failing read's label, exit status, remaining budget and first stderr line are still
    captured for genuine failures. This change only moves the signal statuses out of that category, and
    the header's error-condition sentence is merged into one true statement covering a forge failure, a
    structural refusal, a client death outside the bound set, and a head change.

What produced the observation-unavailable wakes seen in the field is not yet established and is
tracked separately. This change does not claim to fix them.

What Changed

  • read_cut_short asks fm-timeout-lib.sh which statuses report its own bound (124, and 137) and adds
    the signal statuses 129, 130 and 143. A read matching any of them is recorded through a new
    unmeasured helper, which forge() also uses on its existing budget-refusal path.
  • Only a forge failure, a structural refusal, a client death outside that set (such as SIGSEGV's 139),
    or a head change during the observation records an error.
  • The read-outcome classification contract is stated in full exactly once, in the script header that
    usage() publishes; read_cut_short and forge() carry one-line cross-references rather than their
    own copies.
  • tests/fm-contributions.test.sh adds test_read_outcome_classification, which drives one read to
    each distinct end and asserts opposite outcomes in the same test: the bound and signal statuses stay
    unmeasured, silent, and leave the prior record byte-identical, while a forge failure, a SIGSEGV client
    crash and a head change during the observation each record a named error and wake.

No other file is touched.

Testing

The signal-stopped check still holds after the rebase onto current main:
test_read_outcome_classification placed on the untouched upstream tree still fails on the 137 case —
an unmeasured read (cut-kill) printed an unavailable wake: ... - reviews read exited 137 with 20s of budget left: — and passes with this change, so the defect is still present and #6810's own
failing-step line confirms upstream still classifies it as a failure.

  • bash tests/fm-contributions.test.sh — all pass, exit 0.
  • bin/fm-lint.sh — exit 0, with the pinned ShellCheck 0.11.0 and actionlint 1.7.12, 3 workflow files
    valid. shellcheck -x -S style clean on both changed files.
  • The signal-stopped path was also exercised live against a real open pull request in a disposable lab
    home, with the read stopped by real SIGTERM, SIGKILL, SIGHUP and SIGINT rather than simulated
    exit 13x statuses, each compared against the base commit: the base woke, the change stayed silent,
    while a SIGSEGV client death and an HTTP 502 forge failure still woke. The classification code is
    unchanged since those runs.
  • The head-change-during-read case is covered by the fixture test only; forcing a real pull request's
    head to move mid-read would require pushing to a forge.

Replaces #6564

This replaces #6564, which is closed with a pointer here. The same change is raised on a clean branch
because the validation attestation could not be bound to that one: it had been force-pushed by hand,
which broke the pipeline's push binding, and every later attempt to re-attest was correctly refused.
The guard behaved as designed throughout. The two reviews on #6564 shaped what this contains — they
confirmed the unsupported-forge half should be withdrawn and that this remainder is a distinct defect.

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

✅ **Review** - passed

✅ No issues found.

✅ **Test** - passed

✅ No issues found.

  • Live validation: ✅ go - 4 of 7 scenarios driven live against the product
Scenario Result Live Evidence
Poll whose PR reviews read is SIGKILLed externally records no error and prints no wake (base commit recorded 'exited 137') ✅ pass live fixed.txt / base.txt SIGKILL rows
Poll whose read is sent SIGTERM or SIGHUP externally stays unmeasured (base recorded 143/129 errors) ✅ pass live fixed.txt / base.txt SIGTERM, SIGHUP rows
Read ending with status 130 (INT) stays unmeasured ⏸️ untested no The earlier payload did not show a live result here. A real SIGINT cannot reach a read that a non-interactive shell runs in the background, so status 130 was produced only by the colocated stub test (…
Adversarial: client crash (SIGSEGV, 139) still records a named error and prints the observation-unavailable wake ✅ pass live fixed.txt SIGSEGV row; test_read_outcome_classification crash
Adversarial: genuine forge failure (HTTP 502) and head change during observation still record an error and wake ⏸️ untested no The earlier payload did not show a live result here. These cases ran only in the colocated test against a stub forge (test_read_outcome_classification fail/head modes), because a real GitHub failure o…
Read stopped by the 5s per-read bound stays unmeasured (unchanged behaviour) ⏸️ untested no The earlier payload did not show a live result here. This case ran only in the colocated stub test (test_read_outcome_classification cut-bound).
--help header states the classification contract once and names client death outside the bound set as an error condition ✅ pass live usage-contract.txt
  • bash tests/fm-contributions.test.sh (colocated suite including the new test_read_outcome_classification: cut-bound/137/143/130/129 stay quiet; 139 crash, HTTP 502 failure, head change each record a named error and wake)
  • drive-external-signals.sh <wt> fixed <wt>/bin: real poll with the reviews read blocked in sleep, an external process sends SIGKILL/TERM/INT/HUP/SEGV to that read's pid only
  • Same driver against the base commit a24f4cb8's bin/ (extracted with git archive to a temp dir and removed afterwards) to reproduce the original bug
  • bin/fm-contributions.sh --help to confirm the published header carries the classification contract and the corrected error-condition sentence
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

A contribution read that a signal aimed at the read alone stopped answered
nothing, so it is unmeasured rather than a forge failure. forge() recognized
only the 124 the timeout runner reports for its own cap, so a read ended by an
external SIGKILL, or by TERM, INT or HUP delivered to the read and not to the
poll, was recorded as an unavailable observation. read_cut_short() now asks
fm-timeout-lib.sh which statuses report its bound and adds those three signal
statuses.

A genuine forge failure, a structural refusal, a client death outside that set
such as SIGSEGV's 139, and a head change during the observation all still
record an error and still wake; those are the cases the error exists for. The
failing read's own words are still captured for the error and its unavailable
line, unchanged from kunchenguid#6810.

A read stopped at the runner's own five-second cap is not newly fixed here.
Every timeout mechanism normalizes its own bound to 124, and that status was
already treated as unmeasured before this change.

What produced the observation-unavailable wakes seen in the field is not yet
established, and is tracked separately. This change does not fix those wakes.

The read-outcome contract is stated in full once, in the script header that
usage() publishes; read_cut_short() and forge() carry one-line pointers at it.

Tests pin both directions in one table: a read stopped by its bound or by any
of 137, 143, 130 and 129 records no error and raises no wake, while a forge
failure, a SIGSEGV client crash and a head change each record a named error
and wake.
@sgwoods

sgwoods commented Oct 15, 2026

Copy link
Copy Markdown
Contributor Author

Eighteen checks green, one short — and it is the same job, with the same cause you diagnosed for us
last time.

Behavior portable serial 2 ended cancelled again. On #6810 you found that this job had hit the
30-minute ceiling inside the unrelated fm-supervision-host.test.sh, re-ran it, and it passed. Every
sibling job here is green, so the pattern matches exactly.

Could you re-run that single job when convenient? We hold no push access, so we cannot re-run it
ourselves.

Deliberately not pushing anything to clear it, for the same reason as before: a new commit would
invalidate the attestation bound to this head and cost the green state. A re-run keeps both intact.

For the record, answering your two requests on #6564:

#6564 is closed and points here. Thank you for the two reviews on it — they shaped what this contains,
including withdrawing the unsupported-URL half once #7233 covered it.

If that job's ceiling is becoming a recurring nuisance for contributors, we would be glad to look at
fm-supervision-host.test.sh as a separate contribution — only if it is welcome, and not otherwise.

@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: thank you @sgwoods — clear write-up, and the #6564→#7332 handoff is appreciated.

Contract-class: restore. The script header already promised that a read a bound (or equivalent cut-short) stopped stays unmeasured rather than mislabeled unavailable. Treating external signal statuses 137/143/130/129 the same way as the timeout runner's 124 closes that documentation/behavior gap without silencing genuine forge failures, SIGSEGV client deaths, or mid-observation head changes. #6810's failing-step naming is preserved.

VISION.md: all seven align (honest interface under load; scripts own the classification; no new default-on surface).

This pass: attestation MATCHES tip 7a1b90f7; live go on the signal-stopped and adversarial crash rows; fixture coverage for the remaining table rows. No security tip. Eighteen checks were already green; Behavior portable serial 2 cancelled at the familiar 30-min fm-supervision-host ceiling again (#6790). I re-ran the failed jobs of run 38681773933 — no new commit, attestation intact.

Status: waiting on CI (re-run). If serial 2 (and the rest) come back green and still mergeable, this is auto-merge-eligible as restore. Nothing needed from you right now.

@sgwoods

sgwoods commented Oct 18, 2026

Copy link
Copy Markdown
Contributor Author

Withdrawing this, with apologies for the churn — and leaving the work where you can take it if you
want it.

Why. We cannot keep this rebased from our side at the rate your main moves. It has drifted three
times in four days, and each rebase also has to re-bind the attestation. That is our constraint, not
a complaint: the cadence here is healthy and the required check is right to be strict.

What the work is, for anyone reading later. forge() on main treats only rc==124 as a budget
refusal, so a read killed at its bound (137) or stopped by TERM/INT/HUP (143/130/129) is still
recorded as forge-unavailable and wakes. You classed it restore twice, the attestation matched at
7a1b90f7, and you said it was auto-merge-eligible once green. The last green run was one cancelled
job short — the 30-minute ceiling in fm-supervision-host.test.sh, which you diagnosed and re-ran
for us on #6810.

It is yours if you want it. The branch is fm/contrib-signal-stopped-unmeasured on our fork, and
the change is small: the classification in forge() plus its test. If it is easier to take the diff
and raise it yourself under your own attestation, please do — no attribution needed, and no hard
feelings if you would rather let it go.

One finding worth keeping either way, unrelated to whether this lands: that 30-minute job ceiling
in fm-supervision-host.test.sh has cancelled a job on two of our three contributions. If outside
contributors hit it routinely, it reads as a red check on work that is actually fine. We offered to
look at it earlier and the offer stands.

Thank you for the reviews on this one and on #6564 before it. They were specific, they were quick, and
they twice changed what we shipped for the better — including telling us plainly when #7233 had
already covered half of it.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants