Skip to content

fix(bin): harden contributions observation against slow forge reads - #6782

Open
MattDelac wants to merge 3 commits into
kunchenguid:mainfrom
MattDelac:fm/harden-contributions-observation-retries
Open

MattDelac wants to merge 3 commits into
kunchenguid:mainfrom
MattDelac:fm/harden-contributions-observation-retries

Conversation

@MattDelac

Copy link
Copy Markdown

Intent

No captain words drove this task; it is firstmate-repo maintenance filed by firstmate. The captain-facing line is short: the contributions observer has been emitting repeated contributions: observation unavailable for <url> wakes because its hard per-call timeout is shorter than the GitHub API's occasional latency spikes, and this task hardens it.

Evidence: data/learnings.md (2026-10-03 entry) records the reproduction - the per-call bound in forge() is a hard 5s, individual gh api calls normally take 0.5-1s but spike past 5s (one measured 7.5s), and a burst can fail many URLs in one poll (six URLs failed in the 2026-10-06 poll). Every recorded failure had pending empty, the prior observation intact, and the same reads succeeding by hand moments later, so these are benign latency transients that cost a wake and a reconciliation each time. Roughly fifteen such wakes in a week.

What Changed

  • Raise the per-call forge read bound in forge() from 5s to 10s so GitHub latency spikes complete instead of being killed as budget refusal.
  • Retry a URL's observation once when the first attempt failed for a reason other than the budget and poll time remains, and clear per-URL forge stderr before each observation so records never inherit another URL's error evidence.
  • Record the failing read's first bounded stderr line in the unavailable error, and initialize the budget-exhausted flag so a rotated unreadable URL cannot abort the poll before later URLs are observed.

Risk Assessment

✅ Low: The change is a small, well-bounded hardening with behavioral regression tests for the raised bound, the successful retry, and the budget-cut retry; the remaining notes are a test-only date-fallback gap and the accepted cost of repeating deterministic failures.

Testing

Drove bin/fm-contributions.sh poll from the gate worktree in a throwaway marked lab home against the real GitHub API with the machine's logged-in gh, perturbing only the CONNECT path (delay/502) to reproduce latency spikes and transient failures. Thirteen live scenarios covered: healthy polls, a 7s core-read spike completing under the raised 10s bound (with an ac0811c A/B that leaves the record unmeasured), reads past the bound staying silent budget refusals with no retry, a single 502 retried once and self-healing (with a base A/B showing the reported wake), a retry cut by the budget staying unmeasured, a persistent outage waking once per episode with the failing call named in the record, a shared URL served by one retry for both owners, and both cross-URL stderr fixes (GitHub-first isolation, and the rotated unreadable-first order whose f8ecd43 A/B aborts with BUDGET_EXHAUSTED unbound). The focused fixture suite on 92c1683 is green (54 ok, 0 not ok) and the round-2 regression test is red against f8ecd43. Only the head-changed-during-observation retry could not be forced live (no deterministic way to race a real PR head); it is covered by the fixture test test_shared_url_observed_once head mode. No reviewer-visible visual surface exists for this CLI change, so evidence is CLI transcripts and persisted record JSON. No actionable findings; every live scenario passed.

  • Live validation: ✅ go - 9 of 10 scenarios driven live against the product
Scenario Result Live Evidence
A healthy contribution poll records a fresh observation and emits no observation-unavailable wake ✅ pass live raw/transcript-r3-s1-healthy-no-proxy.txt (rc=0, empty stdout, checked_at advanced, error null) and raw/transcript-r3-s1b-healthy-passthrough.txt
A GitHub read delayed 7s (the recorded spike class, past the old 5s bound) completes under the raised bound and records a fresh observation with no wake; the base commit leaves the record unmeasured ✅ pass live raw/transcript-r3-s2-spike-7s-core.txt (target: 7s DELAY then TUNNEL, elapsed 9s, fresh, no wake) vs raw/transcript-r3-s2-base-spike-7s-core.txt (ac0811c: killed at 5s, record untouched)
A read delayed past the raised 10s bound is budget refusal: exactly one attempt, silent, record untouched, no retry ✅ pass live raw/transcript-r3-s3-beyond-10s-bound.txt (one CONNECT #1 delay, elapsed 10s, empty stdout, prior record intact)
A single transient forge 502 is retried once and self-heals with a fresh observation and no wake; the base commit instead emits the reported contributions-observation wake ✅ pass live raw/transcript-r3-s4-single-502-retried-heals.txt (FAIL #1, TUNNEL #2, fresh, no wake) vs raw/transcript-r3-s4-base-single-502-wakes.txt (base wake + error record)
A transient failure whose retry is cut by the poll budget stays unmeasured: record untouched and no wake ✅ pass live raw/transcript-r3-s5-retry-budget-cut.txt (FAIL #1 then 25s-delayed retry killed at the 10s bound, prior record intact, empty stdout)
A persistent forge outage emits one observation-unavailable wake for the episode, records an error naming the failed call, and a second poll stays silent while retrying once per poll ✅ pass live raw/transcript-r3-s6-persistent-502-two-polls.txt (poll 1 wake + error with Get &#34;.../pulls/6780&#34;: Bad Gateway, poll 2 empty, 4 CONNECTs for 2 polls)
A URL shared by two owners gets one observation and one retry serving both owners, both fresh and no wake ✅ pass live raw/transcript-r3-s7-shared-url-transient.txt (FAIL #1, TUNNEL #2, both delivery and duplicate records fresh, empty stdout)
In a poll where a GitHub read fails and an unreadable GitLab URL is visited second, each record keeps its own error: GitLab generic, GitHub its own stderr detail ✅ pass live raw/transcript-r3-s8-cross-url-detail-github-first.txt (gitlab error exactly the generic string; delivery error carries its own Bad Gateway detail)
In a rotated poll where the unreadable GitLab URL is visited first, the poll still completes rc=0 and records each URL's own error; the pre-round-2-fix f8ecd43 aborts with BUDGET_EXHAUSTED unbound ✅ pass live raw/transcript-r3-s8b-cross-url-detail-gitlab-first.txt vs raw/transcript-r3-s8b-prefix-rotated-aborts.txt; focused red/green in raw/r3-red-slice-rotated.txt and raw/focused-test-run-r3.log
A head-changed-during-observation failure is retried and records the generic unavailable error without another URL's stderr ⏸️ untested no Cannot deterministically race the real GitHub PR head between the observer's core read and closing read; a live drive would require a disposable GitHub repository whose PR head can be moved mid-observ…
Evidence: Round-3 live validation summary (results, excerpts, transcript index)

Source: Round-3 live validation summary (results, excerpts, transcript index)

# Live validation round 3 — harden contributions observation against slow forge reads

- Change under test: `bin/fm-contributions.sh` @ `92c1683` (branch
  `fm/harden-contributions-observation-retries`), base `ac0811c`. The target includes the
  original hardening (`1fa7d8a`), the round-1 cross-URL stderr fix (`f8ecd43`), and the
  round-2 rotated-order fix (`92c1683`).
- Product driven: `bin/fm-contributions.sh poll`, run from the gate worktree in a disposable
  marked lab home (`bin/fm-lab-home.sh create`, removed at the end of the run), against the
  **real GitHub API** with the machine's logged-in `gh` 2.97.0 (PR
  `kunchenguid/firstmate#6780`, head `e032f75…`, still open).
- Perturbation: the local CONNECT proxy (`raw/perturbing-connect-proxy.pl`) delays or 502s a
  chosen CONNECT ordinal to `api.github.com:443`. `gh`, TLS and the forge responses are real;
  only the network path is perturbed, reproducing the recorded latency spikes and transient
  read failures on demand.
- A/B legs: unmodified `ac0811c` (base) and `f8ecd43` (round-1 fix, pre-round-2 fix) sources
  were extracted into the throwaway lab.
- Harness: `raw/r3-live-harness.sh`; per-scenario verbatim transcripts
  `raw/transcript-r3-*.txt`; combined run `raw/r3-harness-run.log`.
- Lab home, proxy, base/prefix source copies and the scratch red-slice root were all removed
  when the run exited; the worktree was left clean.

## Results

| # | Scenario | Perturbation | Product | Result |
|---|----------|--------------|---------|--------|
| S1 | Healthy poll, no proxy | none | target | pass — fresh observation, no error, no wake |
| S1b | Healthy poll through the proxy | passthrough | target | pass — fresh observation, no wake |
| S2 | Core read spikes to 7s (recorded 7.5s class, past the old 5s bound) | CONNECT #1 delayed 7s | target | pass — read completes (elapsed 9s), fresh observation, no wake |
| S2-base | Same 7s spike | CONNECT #1 delayed 7s | base | base kills the read at 5s: record untouched (unmeasured), silent |
| S3 | Read past the raised bound | CONNECT #1 delayed 14s | target | pass — killed at the 10s bound, exactly one attempt, silent, record untouched |
| S4 | One transient forge failure (the reported wake) | CONNECT #1 502 | target | pass — retried once, observation recorded, no error, no wake |
| S4-base | Same single 502 | CONNECT #1 502 | base | base wakes `contributions: observation unavailable for <url>` — the reported symptom |
| S5 | Transient failure whose retry is cut by the budget | #1 502, #2 delayed 25s | target | pass — retry attempted once and killed at the 10s bound; record untouched, no wake |
| S6 | Persistent outage, two consecutive polls | #1–#4 502 | target | pass — wake once for the episode, second poll silent; error names the failed call; exactly one retry per poll |
| S7 | Shared URL (two owners), transient failure | #1 502 | target | pass — one retry serves both owners, both fresh, no wake |
| S8 | GitHub failure + unreadable GitLab URL, GitHub-first | #1–#2 502 | target | pass — GitHub record keeps its own stderr detail, GitLab record generic |
| S8b | Same poll rotated so the unreadable GitLab URL is visited first | #1–#2 502 | target | pass — `rc=0`; GitLab generic, GitHub keeps its own detail (round-2 regression fixed) |
| S8b-prefix | Same rotated poll at `f8ecd43` | #1–#2 502 | f8ecd43 | pre-fix abort reproduced: `BUDGET_EXHAUSTED: unbound variable`, `rc=1`, both records untouched |

## Key excerpts

\### S2 — 7s spike past the old bound, inside the raised bound (target)

`` `
$ poll 1/1 rc=0 elapsed=9s
--- poll 1 stdout/stderr (verbatim):
(empty)
--- records after poll 1:
delivery: {"checked_at":"2026-07-15T12:00:00Z","error":null,...,"state":"open"}
--- forge connection log (proxy-19002.log):
12:16:37 #1 api.github.com:443 DELAY 7s begin
12:16:44 #1 api.github.com:443 DELAY 7s end
12:16:44 #1 api.github.com:443 TUNNEL
`` `

The same 7s delay against base `ac0811c` leaves the record untouched (silent, unmeasured) —
the transient that previously cost the observation.

\### S3 — beyond the raised bound stays budget refusal

`` `
$ poll 1/1 rc=0 elapsed=10s
--- poll 1 stdout/stderr (verbatim):
(empty)
--- records after poll 1:
delivery: {"checked_at":"2026-01-01T00:00:00Z","error":null,...,"state":"open"}
--- forge connection log (proxy-19004.log):
12:16:51 #1 api.github.com:443 DELAY 14s begin
`` `

Only CONNECT #1 exists in the proxy log: the budget-refused attempt was not retried.

\### S4 — one transient 502 is retried and self-heals; base wakes

target:

`` `
$ poll 1/1 rc=0 elapsed=2s
--- poll 1 stdout/stderr (verbatim):
(empty)
--- records after poll 1:
delivery: {"checked_at":"2026-07-15T12:00:00Z","error":null,...,"state":"open"}
--- forge connection log (proxy-19005.log):
12:17:02 #1 api.github.com:443 FAIL (CONNECT 502)
12:17:02 #2 api.github.com:443 TUNNEL
`` `

base `ac0811c`:

`` `
$ poll 1/1 rc=0 elapsed=0s
--- poll 1 stdout/stderr (verbatim):
contributions: observation unavailable for https://github.com/kunchenguid/firstmate/pull/6780
--- record after poll 1:
error:"forge observation unavailable or changed during read"
--- forge connection log (proxy-19006.log):
12:17:04 #1 api.github.com:443 FAIL (CONNECT 502)
`` `

\### S5 — a retry cut by the budget stays unmeasured

`` `
$ poll 1/1 rc=0 elapsed=10s
--- poll 1 stdout/stderr (verbatim):
(empty)
--- records after poll 1:
delivery: {"checked_at":"2026-01-01T00:00:00Z","error":null,...,"state":"open"}
--- forge connection log (proxy-19007.log):
12:17:04 #1 api.github.com:443 FAIL (CONNECT 502)
12:17:04 #2 api.github.com:443 DELAY 25s begin
`` `

\### S6 — persistent outage: one wake per episode, error names the failed call

`` `
$ poll 1/2 rc=0
contributions: observation unavailable for https://github.com/kunchenguid/firstmate/pull/6780
record error: "forge observation unavailable or changed during read: Get \"https://api.github.com/repos/kunchenguid/firstmate/pulls/6780\": Bad Gateway"
$ poll 2/2 rc=0
(empty)
record error: unchanged
--- forge connection log (proxy-19008.log):
#1 FAIL #2 FAIL   (poll 1: initial + retry)
#3 FAIL #4 FAIL   (poll 2: initial + retry)
`` `

\### S8b — rotated poll: unreadable GitLab first, poll still completes

`` `
$ poll 1/1 rc=0
contributions: observation unavailable for https://gitlab.com/foo/bar/-/merge_requests/1
contributions: observation unavailable for https://github.com/kunchenguid/firstmate/pull/6780
delivery: {"error":"forge observation unavailable or changed during read: Get \".../pulls/6780\": Bad Gateway",...}
gitlab:   {"error":"forge observation unavailable or changed during read",...}
--- forge connection log (proxy-19011.log):
#1 api.github.com FAIL (CONNECT 502)
#2 api.github.com FAIL (CONNECT 502)   (one retry)
`` `

\### S8b-prefix — the same ordering at `f8ecd43` aborts

`` `
$ poll 1/1 rc=1
/tmp/fm-lab.WH6E30/prefix/bin/fm-contributions.sh: line 416: BUDGET_EXHAUSTED: unbound variable
--- records after poll 1:
delivery: {"checked_at":"2026-01-01T00:00:00Z","error":null,...}
gitlab:   {"checked_at":"2026-01-01T00:00:00Z","error":null,...}
--- forge connection log (proxy-19012.log):
12:17:18 proxy listening on 127.0.0.1:19012
`` `

## Focused regression suite (stub forge, supporting check)

`bash tests/fm-contributions.test.sh` on `92c1683`: **54 ok, 0 not ok**, exit 0
(`raw/focused-test-run-r3.log`). Includes the new targeted checks:

`` `
ok - a read between the old and raised per-call bounds completes without a wake
ok - one transient forge failure is retried once and self-heals without a wake
ok - a retry cut short by the poll budget stays unmeasured and silent
ok - an unreadable non-GitHub URL records no other URL's forge error detail
ok - a rotated poll starting on an unreadable URL still records every URL error
`` `

Red slice for the round-2 regression, running the current test file's
`test_rotated_unreadable_url_first_does_not_abort_poll` against `f8ecd43`
(`raw/r3-red-slice-rotated.txt`):

`` `
/tmp/r3-red.cDvDhF/bin/fm-contributions.sh: line 416: BUDGET_EXHAUSTED: unbound variable
not ok - a poll whose first URL is unreadable aborted
not ok - 1 contribution regressions
`` `

## Notes

- The head-changed-during-observation retry is part of the same retry path but cannot be
  forced deterministically against the live GitHub API (would require altering the real PR
  head). It is covered by the fixture test
  `test_shared_url_observed_once` (`head` mode expects the retry and the generic error).
- No production consumer in `bin/` matches the exact error string; the recorded message
  keeps the existing `forge observation unavailable or changed during read` prefix and
  appends `: <first bounded stderr line>`, shown live in S6.

## Transcript index

- `raw/transcript-r3-s1-healthy-no-proxy.txt`
- `raw/transcript-r3-s1b-healthy-passthrough.txt`
- `raw/transcript-r3-s2-spike-7s-core.txt`
- `raw/transcript-r3-s2-base-spike-7s-core.txt`
- `raw/transcript-r3-s3-beyond-10s-bound.txt`
- `raw/transcript-r3-s4-single-502-retried-heals.txt`
- `raw/transcript-r3-s4-base-single-502-wakes.txt`
- `raw/transcript-r3-s5-retry-budget-cut.txt`
- `raw/transcript-r3-s6-persistent-502-two-polls.txt`
- `raw/transcript-r3-s7-shared-url-transient.txt`
- `raw/transcript-r3-s8-cross-url-detail-github-first.txt`
- `raw/transcript-r3-s8b-cross-url-detail-gitlab-first.txt`
- `raw/transcript-r3-s8b-prefix-rotated-aborts.txt`
- `raw/r3-harness-run.log` (combined stdout of the harness)
- `raw/focused-test-run-r3.log` (focused test file, 54/54)
- `raw/r3-red-slice-rotated.txt` (pre-fix red slice)
- `raw/r3-live-harness.sh` (harness used this round)
Evidence: S8b rotated poll: target rc=0 with per-URL errors; f8ecd43 rc=1 unbound
target: poll rc=0; gitlab error="forge observation unavailable or changed during read"; delivery error="...: Get \"https://api.github.com/repos/kunchenguid/firstmate/pulls/6780\": Bad Gateway"
f8ecd43: poll rc=1; line 416: BUDGET_EXHAUSTED: unbound variable; both records untouched
Evidence: Focused regression suite on 92c1683
54 ok, 0 not ok (exit 0); new checks: raised-bound slow read, retry-once heal, budget-cut retry, cross-URL error evidence, rotated unreadable-first poll
Evidence: S1 healthy poll, no proxy (fresh observation, no wake)

Source: S1 healthy poll, no proxy (fresh observation, no wake)

=== scenario: s1-healthy-no-proxy
=== when: 2026-10-07T16:16:33Z
=== product: ~/.no-mistakes/worktrees/62c0a9471fe0/01M4BFZH3G7J8QYS8V515S9SC1/bin/fm-contributions.sh
=== proxy rules: <none>
=== budget: 20s, polls: 1

$ before:
delivery: {"checked_at":"2026-01-01T00:00:00Z","error":null,"fresh_head":"e032f755e72ef9771458ae0064ef215900062c3a","state":"open"}
$ poll 1/1 rc=0 elapsed=2s
--- poll 1 stdout/stderr (verbatim):
--- records after poll 1:
delivery: {"checked_at":"2026-07-15T12:00:00Z","error":null,"fresh_head":"e032f755e72ef9771458ae0064ef215900062c3a","state":"open"}
--- wake queue:
(empty)
=== end scenario: s1-healthy-no-proxy
Evidence: S1b healthy poll through passthrough proxy

Source: S1b healthy poll through passthrough proxy

=== scenario: s1b-healthy-passthrough
=== when: 2026-10-07T16:16:35Z
=== product: ~/.no-mistakes/worktrees/62c0a9471fe0/01M4BFZH3G7J8QYS8V515S9SC1/bin/fm-contributions.sh
=== proxy rules: 1:delay:0
=== budget: 20s, polls: 1

$ before:
delivery: {"checked_at":"2026-01-01T00:00:00Z","error":null,"fresh_head":"e032f755e72ef9771458ae0064ef215900062c3a","state":"open"}
$ proxy on 127.0.0.1:19001
$ poll 1/1 rc=0 elapsed=2s
--- poll 1 stdout/stderr (verbatim):
--- records after poll 1:
delivery: {"checked_at":"2026-07-15T12:00:00Z","error":null,"fresh_head":"e032f755e72ef9771458ae0064ef215900062c3a","state":"open"}
--- forge connection log (proxy-19001.log):
12:16:35 proxy listening on 127.0.0.1:19001
12:16:35 #1 api.github.com:443 DELAY 0s begin
12:16:35 #1 api.github.com:443 DELAY 0s end
12:16:35 #1 api.github.com:443 TUNNEL
12:16:36 #1 api.github.com:443 CLOSE
12:16:36 #3 api.github.com:443 TUNNEL
12:16:36 #2 api.github.com:443 TUNNEL
12:16:36 #7 api.github.com:443 TUNNEL
12:16:36 #4 api.github.com:443 TUNNEL
12:16:36 #5 api.github.com:443 TUNNEL
12:16:36 #6 api.github.com:443 TUNNEL
12:16:36 #4 api.github.com:443 CLOSE
12:16:36 #7 api.github.com:443 CLOSE
12:16:36 #3 api.github.com:443 CLOSE
12:16:36 #5 api.github.com:443 CLOSE
12:16:36 #6 api.github.com:443 CLOSE
12:16:36 #2 api.github.com:443 CLOSE
12:16:36 #8 api.github.com:443 TUNNEL
12:16:37 #8 api.github.com:443 CLOSE
--- wake queue:
(empty)
=== end scenario: s1b-healthy-passthrough
Evidence: S2 7s spike completes under raised bound (target, elapsed 9s)

Source: S2 7s spike completes under raised bound (target, elapsed 9s)

=== scenario: s2-spike-7s-core
=== when: 2026-10-07T16:16:37Z
=== product: ~/.no-mistakes/worktrees/62c0a9471fe0/01M4BFZH3G7J8QYS8V515S9SC1/bin/fm-contributions.sh
=== proxy rules: 1:delay:7
=== budget: 20s, polls: 1

$ before:
delivery: {"checked_at":"2026-01-01T00:00:00Z","error":null,"fresh_head":"e032f755e72ef9771458ae0064ef215900062c3a","state":"open"}
$ proxy on 127.0.0.1:19002
$ poll 1/1 rc=0 elapsed=9s
--- poll 1 stdout/stderr (verbatim):
--- records after poll 1:
delivery: {"checked_at":"2026-07-15T12:00:00Z","error":null,"fresh_head":"e032f755e72ef9771458ae0064ef215900062c3a","state":"open"}
--- forge connection log (proxy-19002.log):
12:16:37 proxy listening on 127.0.0.1:19002
12:16:37 #1 api.github.com:443 DELAY 7s begin
12:16:44 #1 api.github.com:443 DELAY 7s end
12:16:44 #1 api.github.com:443 TUNNEL
12:16:45 #1 api.github.com:443 CLOSE
12:16:45 #6 api.github.com:443 TUNNEL
12:16:45 #5 api.github.com:443 TUNNEL
12:16:45 #4 api.github.com:443 TUNNEL
12:16:45 #2 api.github.com:443 TUNNEL
12:16:45 #7 api.github.com:443 TUNNEL
12:16:45 #3 api.github.com:443 TUNNEL
12:16:45 #6 api.github.com:443 CLOSE
12:16:45 #5 api.github.com:443 CLOSE
12:16:45 #4 api.github.com:443 CLOSE
12:16:45 #2 api.github.com:443 CLOSE
12:16:45 #7 api.github.com:443 CLOSE
12:16:45 #3 api.github.com:443 CLOSE
12:16:45 #8 api.github.com:443 TUNNEL
12:16:46 #8 api.github.com:443 CLOSE
--- wake queue:
(empty)
=== end scenario: s2-spike-7s-core
Evidence: S2-base 7s spike at ac0811c left unmeasured

Source: S2-base 7s spike at ac0811c left unmeasured

=== scenario: s2-base-spike-7s-core
=== when: 2026-10-07T16:16:46Z
=== product: /tmp/fm-lab.WH6E30/base/bin/fm-contributions.sh
=== proxy rules: 1:delay:7
=== budget: 20s, polls: 1

$ before:
delivery: {"checked_at":"2026-01-01T00:00:00Z","error":null,"fresh_head":"e032f755e72ef9771458ae0064ef215900062c3a","state":"open"}
$ proxy on 127.0.0.1:19003
$ poll 1/1 rc=0 elapsed=5s
--- poll 1 stdout/stderr (verbatim):
--- records after poll 1:
delivery: {"checked_at":"2026-01-01T00:00:00Z","error":null,"fresh_head":"e032f755e72ef9771458ae0064ef215900062c3a","state":"open"}
--- forge connection log (proxy-19003.log):
12:16:46 proxy listening on 127.0.0.1:19003
12:16:46 #1 api.github.com:443 DELAY 7s begin
--- wake queue:
(empty)
=== end scenario: s2-base-spike-7s-core
Evidence: S3 read past 10s bound: one attempt, silent, untouched

Source: S3 read past 10s bound: one attempt, silent, untouched

=== scenario: s3-beyond-10s-bound
=== when: 2026-10-07T16:16:51Z
=== product: ~/.no-mistakes/worktrees/62c0a9471fe0/01M4BFZH3G7J8QYS8V515S9SC1/bin/fm-contributions.sh
=== proxy rules: 1:delay:14
=== budget: 20s, polls: 1

$ before:
delivery: {"checked_at":"2026-01-01T00:00:00Z","error":null,"fresh_head":"e032f755e72ef9771458ae0064ef215900062c3a","state":"open"}
$ proxy on 127.0.0.1:19004
$ poll 1/1 rc=0 elapsed=10s
--- poll 1 stdout/stderr (verbatim):
--- records after poll 1:
delivery: {"checked_at":"2026-01-01T00:00:00Z","error":null,"fresh_head":"e032f755e72ef9771458ae0064ef215900062c3a","state":"open"}
--- forge connection log (proxy-19004.log):
12:16:51 proxy listening on 127.0.0.1:19004
12:16:51 #1 api.github.com:443 DELAY 14s begin
--- wake queue:
(empty)
=== end scenario: s3-beyond-10s-bound
Evidence: S4 single 502 retried once and heals (target)

Source: S4 single 502 retried once and heals (target)

=== scenario: s4-single-502-retried-heals
=== when: 2026-10-07T16:17:02Z
=== product: ~/.no-mistakes/worktrees/62c0a9471fe0/01M4BFZH3G7J8QYS8V515S9SC1/bin/fm-contributions.sh
=== proxy rules: 1:fail
=== budget: 20s, polls: 1

$ before:
delivery: {"checked_at":"2026-01-01T00:00:00Z","error":null,"fresh_head":"e032f755e72ef9771458ae0064ef215900062c3a","state":"open"}
$ proxy on 127.0.0.1:19005
$ poll 1/1 rc=0 elapsed=2s
--- poll 1 stdout/stderr (verbatim):
--- records after poll 1:
delivery: {"checked_at":"2026-07-15T12:00:00Z","error":null,"fresh_head":"e032f755e72ef9771458ae0064ef215900062c3a","state":"open"}
--- forge connection log (proxy-19005.log):
12:17:02 proxy listening on 127.0.0.1:19005
12:17:02 #1 api.github.com:443 FAIL (CONNECT 502)
12:17:02 #2 api.github.com:443 TUNNEL
12:17:03 #2 api.github.com:443 CLOSE
12:17:03 #6 api.github.com:443 TUNNEL
12:17:03 #8 api.github.com:443 TUNNEL
12:17:03 #3 api.github.com:443 TUNNEL
12:17:03 #4 api.github.com:443 TUNNEL
12:17:03 #5 api.github.com:443 TUNNEL
12:17:03 #7 api.github.com:443 TUNNEL
12:17:03 #6 api.github.com:443 CLOSE
12:17:03 #3 api.github.com:443 CLOSE
12:17:03 #7 api.github.com:443 CLOSE
12:17:03 #8 api.github.com:443 CLOSE
12:17:03 #5 api.github.com:443 CLOSE
12:17:03 #4 api.github.com:443 CLOSE
12:17:03 #9 api.github.com:443 TUNNEL
12:17:04 #9 api.github.com:443 CLOSE
--- wake queue:
(empty)
=== end scenario: s4-single-502-retried-heals
Evidence: S4-base single 502 wakes at ac0811c (reported symptom)

Source: S4-base single 502 wakes at ac0811c (reported symptom)

=== scenario: s4-base-single-502-wakes
=== when: 2026-10-07T16:17:04Z
=== product: /tmp/fm-lab.WH6E30/base/bin/fm-contributions.sh
=== proxy rules: 1:fail
=== budget: 20s, polls: 1

$ before:
delivery: {"checked_at":"2026-01-01T00:00:00Z","error":null,"fresh_head":"e032f755e72ef9771458ae0064ef215900062c3a","state":"open"}
$ proxy on 127.0.0.1:19006
$ poll 1/1 rc=0 elapsed=0s
--- poll 1 stdout/stderr (verbatim):
contributions: observation unavailable for https://github.com/kunchenguid/firstmate/pull/6780
--- records after poll 1:
delivery: {"checked_at":"2026-07-15T12:00:00Z","error":"forge observation unavailable or changed during read","fresh_head":"e032f755e72ef9771458ae0064ef215900062c3a","state":"open"}
--- forge connection log (proxy-19006.log):
12:17:04 proxy listening on 127.0.0.1:19006
12:17:04 #1 api.github.com:443 FAIL (CONNECT 502)
--- wake queue:
(empty)
=== end scenario: s4-base-single-502-wakes
Evidence: S5 retry cut by budget stays unmeasured and silent

Source: S5 retry cut by budget stays unmeasured and silent

=== scenario: s5-retry-budget-cut
=== when: 2026-10-07T16:17:04Z
=== product: ~/.no-mistakes/worktrees/62c0a9471fe0/01M4BFZH3G7J8QYS8V515S9SC1/bin/fm-contributions.sh
=== proxy rules: 1:fail 2:delay:25
=== budget: 20s, polls: 1

$ before:
delivery: {"checked_at":"2026-01-01T00:00:00Z","error":null,"fresh_head":"e032f755e72ef9771458ae0064ef215900062c3a","state":"open"}
$ proxy on 127.0.0.1:19007
$ poll 1/1 rc=0 elapsed=10s
--- poll 1 stdout/stderr (verbatim):
--- records after poll 1:
delivery: {"checked_at":"2026-01-01T00:00:00Z","error":null,"fresh_head":"e032f755e72ef9771458ae0064ef215900062c3a","state":"open"}
--- forge connection log (proxy-19007.log):
12:17:04 proxy listening on 127.0.0.1:19007
12:17:04 #1 api.github.com:443 FAIL (CONNECT 502)
12:17:04 #2 api.github.com:443 DELAY 25s begin
--- wake queue:
(empty)
=== end scenario: s5-retry-budget-cut
Evidence: S6 persistent outage: one wake, second poll silent, error names failed call

Source: S6 persistent outage: one wake, second poll silent, error names failed call

=== scenario: s6-persistent-502-two-polls
=== when: 2026-10-07T16:17:14Z
=== product: ~/.no-mistakes/worktrees/62c0a9471fe0/01M4BFZH3G7J8QYS8V515S9SC1/bin/fm-contributions.sh
=== proxy rules: 1:fail 2:fail 3:fail 4:fail
=== budget: 20s, polls: 2

$ before:
delivery: {"checked_at":"2026-01-01T00:00:00Z","error":null,"fresh_head":"e032f755e72ef9771458ae0064ef215900062c3a","state":"open"}
$ proxy on 127.0.0.1:19008
$ poll 1/2 rc=0 elapsed=0s
--- poll 1 stdout/stderr (verbatim):
contributions: observation unavailable for https://github.com/kunchenguid/firstmate/pull/6780
--- records after poll 1:
delivery: {"checked_at":"2026-07-15T12:00:00Z","error":"forge observation unavailable or changed during read: Get \"https://api.github.com/repos/kunchenguid/firstmate/pulls/6780\": Bad Gateway","fresh_head":"e032f755e72ef9771458ae0064ef215900062c3a","state":"open"}
$ poll 2/2 rc=0 elapsed=1s
--- poll 2 stdout/stderr (verbatim):
--- records after poll 2:
delivery: {"checked_at":"2026-07-15T12:00:00Z","error":"forge observation unavailable or changed during read: Get \"https://api.github.com/repos/kunchenguid/firstmate/pulls/6780\": Bad Gateway","fresh_head":"e032f755e72ef9771458ae0064ef215900062c3a","state":"open"}
--- forge connection log (proxy-19008.log):
12:17:14 proxy listening on 127.0.0.1:19008
12:17:14 #1 api.github.com:443 FAIL (CONNECT 502)
12:17:14 #2 api.github.com:443 FAIL (CONNECT 502)
12:17:15 #3 api.github.com:443 FAIL (CONNECT 502)
12:17:15 #4 api.github.com:443 FAIL (CONNECT 502)
--- wake queue:
(empty)
=== end scenario: s6-persistent-502-two-polls
Evidence: S7 shared URL served by one retry for both owners

Source: S7 shared URL served by one retry for both owners

=== scenario: s7-shared-url-transient
=== when: 2026-10-07T16:17:15Z
=== product: ~/.no-mistakes/worktrees/62c0a9471fe0/01M4BFZH3G7J8QYS8V515S9SC1/bin/fm-contributions.sh
=== proxy rules: 1:fail
=== budget: 20s, polls: 1

$ before:
delivery: {"checked_at":"2026-01-01T00:00:00Z","error":null,"fresh_head":"e032f755e72ef9771458ae0064ef215900062c3a","state":"open"}
duplicate: {"checked_at":"2026-01-01T00:00:00Z","error":null,"fresh_head":"e032f755e72ef9771458ae0064ef215900062c3a","state":"open"}
$ proxy on 127.0.0.1:19009
$ poll 1/1 rc=0 elapsed=2s
--- poll 1 stdout/stderr (verbatim):
--- records after poll 1:
delivery: {"checked_at":"2026-07-15T12:00:00Z","error":null,"fresh_head":"e032f755e72ef9771458ae0064ef215900062c3a","state":"open"}
duplicate: {"checked_at":"2026-07-15T12:00:00Z","error":null,"fresh_head":"e032f755e72ef9771458ae0064ef215900062c3a","state":"open"}
--- forge connection log (proxy-19009.log):
12:17:15 proxy listening on 127.0.0.1:19009
12:17:15 #1 api.github.com:443 FAIL (CONNECT 502)
12:17:15 #2 api.github.com:443 TUNNEL
12:17:16 #2 api.github.com:443 CLOSE
12:17:16 #6 api.github.com:443 TUNNEL
12:17:16 #4 api.github.com:443 TUNNEL
12:17:16 #7 api.github.com:443 TUNNEL
12:17:16 #5 api.github.com:443 TUNNEL
12:17:16 #8 api.github.com:443 TUNNEL
12:17:16 #3 api.github.com:443 TUNNEL
12:17:16 #4 api.github.com:443 CLOSE
12:17:16 #5 api.github.com:443 CLOSE
12:17:16 #6 api.github.com:443 CLOSE
12:17:16 #3 api.github.com:443 CLOSE
12:17:16 #7 api.github.com:443 CLOSE
12:17:16 #8 api.github.com:443 CLOSE
12:17:16 #9 api.github.com:443 TUNNEL
12:17:17 #9 api.github.com:443 CLOSE
--- wake queue:
(empty)
=== end scenario: s7-shared-url-transient
Evidence: S8 GitHub-first cross-URL error isolation

Source: S8 GitHub-first cross-URL error isolation

=== scenario: s8-cross-url-detail-github-first
=== when: 2026-10-07T16:17:17Z
=== product: ~/.no-mistakes/worktrees/62c0a9471fe0/01M4BFZH3G7J8QYS8V515S9SC1/bin/fm-contributions.sh
=== proxy rules: 1:fail 2:fail
=== budget: 20s, polls: 1

$ before:
delivery: {"checked_at":"2026-01-01T00:00:00Z","error":null,"fresh_head":"e032f755e72ef9771458ae0064ef215900062c3a","state":"open"}
gitlab: {"checked_at":"2026-01-01T00:00:00Z","error":null,"fresh_head":"e032f755e72ef9771458ae0064ef215900062c3a","state":"open"}
$ proxy on 127.0.0.1:19010
$ poll 1/1 rc=0 elapsed=0s
--- poll 1 stdout/stderr (verbatim):
contributions: observation unavailable for https://github.com/kunchenguid/firstmate/pull/6780
contributions: observation unavailable for https://gitlab.com/foo/bar/-/merge_requests/1
--- records after poll 1:
delivery: {"checked_at":"2026-07-15T12:00:00Z","error":"forge observation unavailable or changed during read: Get \"https://api.github.com/repos/kunchenguid/firstmate/pulls/6780\": Bad Gateway","fresh_head":"e032f755e72ef9771458ae0064ef215900062c3a","state":"open"}
gitlab: {"checked_at":"2026-07-15T12:00:00Z","error":"forge observation unavailable or changed during read","fresh_head":"e032f755e72ef9771458ae0064ef215900062c3a","state":"open"}
--- forge connection log (proxy-19010.log):
12:17:17 proxy listening on 127.0.0.1:19010
12:17:17 #1 api.github.com:443 FAIL (CONNECT 502)
12:17:17 #2 api.github.com:443 FAIL (CONNECT 502)
--- wake queue:
(empty)
=== end scenario: s8-cross-url-detail-github-first
Evidence: S8b rotated GitLab-first poll completes with per-URL errors

Source: S8b rotated GitLab-first poll completes with per-URL errors

=== scenario: s8b-cross-url-detail-gitlab-first
=== when: 2026-10-07T16:17:17Z
=== product: ~/.no-mistakes/worktrees/62c0a9471fe0/01M4BFZH3G7J8QYS8V515S9SC1/bin/fm-contributions.sh
=== proxy rules: 1:fail 2:fail
=== budget: 20s, polls: 1

$ before:
delivery: {"checked_at":"2026-01-01T00:00:00Z","error":null,"fresh_head":"e032f755e72ef9771458ae0064ef215900062c3a","state":"open"}
gitlab: {"checked_at":"2026-01-01T00:00:00Z","error":null,"fresh_head":"e032f755e72ef9771458ae0064ef215900062c3a","state":"open"}
$ proxy on 127.0.0.1:19011
$ poll 1/1 rc=0 elapsed=0s
--- poll 1 stdout/stderr (verbatim):
contributions: observation unavailable for https://gitlab.com/foo/bar/-/merge_requests/1
contributions: observation unavailable for https://github.com/kunchenguid/firstmate/pull/6780
--- records after poll 1:
delivery: {"checked_at":"2026-07-15T12:05:00Z","error":"forge observation unavailable or changed during read: Get \"https://api.github.com/repos/kunchenguid/firstmate/pulls/6780\": Bad Gateway","fresh_head":"e032f755e72ef9771458ae0064ef215900062c3a","state":"open"}
gitlab: {"checked_at":"2026-07-15T12:05:00Z","error":"forge observation unavailable or changed during read","fresh_head":"e032f755e72ef9771458ae0064ef215900062c3a","state":"open"}
--- forge connection log (proxy-19011.log):
12:17:17 proxy listening on 127.0.0.1:19011
12:17:18 #1 api.github.com:443 FAIL (CONNECT 502)
12:17:18 #2 api.github.com:443 FAIL (CONNECT 502)
--- wake queue:
(empty)
=== end scenario: s8b-cross-url-detail-gitlab-first
Evidence: S8b-prefix adversarial A/B: f8ecd43 aborts rotated poll

Source: S8b-prefix adversarial A/B: f8ecd43 aborts rotated poll

=== scenario: s8b-prefix-rotated-aborts
=== when: 2026-10-07T16:17:18Z
=== product: /tmp/fm-lab.WH6E30/prefix/bin/fm-contributions.sh
=== proxy rules: 1:fail 2:fail
=== budget: 20s, polls: 1

$ before:
delivery: {"checked_at":"2026-01-01T00:00:00Z","error":null,"fresh_head":"e032f755e72ef9771458ae0064ef215900062c3a","state":"open"}
gitlab: {"checked_at":"2026-01-01T00:00:00Z","error":null,"fresh_head":"e032f755e72ef9771458ae0064ef215900062c3a","state":"open"}
$ proxy on 127.0.0.1:19012
$ poll 1/1 rc=1 elapsed=0s
--- poll 1 stdout/stderr (verbatim):
/tmp/fm-lab.WH6E30/prefix/bin/fm-contributions.sh: line 416: BUDGET_EXHAUSTED: unbound variable
--- records after poll 1:
delivery: {"checked_at":"2026-01-01T00:00:00Z","error":null,"fresh_head":"e032f755e72ef9771458ae0064ef215900062c3a","state":"open"}
gitlab: {"checked_at":"2026-01-01T00:00:00Z","error":null,"fresh_head":"e032f755e72ef9771458ae0064ef215900062c3a","state":"open"}
--- forge connection log (proxy-19012.log):
12:17:18 proxy listening on 127.0.0.1:19012
--- wake queue:
(empty)
=== end scenario: s8b-prefix-rotated-aborts
Evidence: Focused test file run on 92c1683 (54 ok, 0 not ok)

Source: Focused test file run on 92c1683 (54 ok, 0 not ok)

ok - only required-captain contributions are rows; other actors are counted
ok - replaced-head verdict is stale and cannot create a captain requirement
ok - unchecked ownership is disclosed and cannot prove silence
ok - newest check with no verdict is distinct from passing and pending
ok - new maintainer comment wakes once and stays pending until acknowledged
ok - new maintainer review wakes once and stays pending until acknowledged
ok - new maintainer inline wakes once and stays pending until acknowledged
ok - ready-for-pr on a filed issue becomes a planning wake
ok - a fresh open issue remains measured maintainer triage
ok - an absent check lane remains missing across repeated observations
ok - mixed freshness retains measured captain work and discloses the gap
ok - malformed durable evidence cannot prove silence
ok - a transient ready-for-pr label wakes and its exact acknowledgement survives replay
ok - recorded judgment keeps its exact head and is stale immediately on a published replacement
ok - verdict help and refusal name exactly the actors the command accepts
ok - a current forge observation refreshes a verdict after a replacement
ok - an unavailable current head leaves verdict freshness unknown
ok - away yolo delivery is fleet work without granting merge authority
actionable: PR https://github.com/o/r/pull/8 is registered but its ready line did not reach the parent channel (rc=3)
ok - cross-home away yolo delivery is fleet work
ok - retired ownership persists and unsupported forge remains visibly unmeasured
ok - unsupported forge coverage is disclosed without inventing fleet work
ok - held unsupported forge coverage remains unmeasured
ok - shared contribution signal wakes once while retaining both acknowledgements
ok - watcher keeps observer diagnostics separate from contribution wakes
ok - expired child unsupported-forge coverage remains unmeasured
ok - watcher surfaces one newly durable contribution signal without re-ringing it
ok - parent consumes measured child coverage and refuses expired child silence
ok - unreadable pending signals refuse an empty-inbox claim
ok - record task identity is the directory dirname/basename named
ok - snapshot and pending create nothing in a home without state
ok - budget exhausted mid-observation (exhaust) keeps the prior record and stays silent
ok - budget exhausted mid-observation (hang) keeps the prior record and stays silent
ok - a genuine forge failure inside the budget still records the error and wakes
ok - a URL owned by two tasks is observed once and every owner receives the result
/tmp/fm-contributions.tEw4rI/terminal-merged/fakebin/date: line 2: exec: : not found
/tmp/fm-contributions.tEw4rI/terminal-merged/fakebin/date: line 2: exec: : not found
/tmp/fm-contributions.tEw4rI/terminal-closed/fakebin/date: line 2: exec: : not found
/tmp/fm-contributions.tEw4rI/terminal-closed/fakebin/date: line 2: exec: : not found
ok - a merged or closed contribution settles once, is not re-read, and never wakes again
ok - a late owner inherits a terminal observation without a forge read or wake
ok - a retry converges every owner whose saved row is not terminal, keeping its own acknowledgement state
ok - an open PR linked from a done task keeps being observed
ok - a later URL waits when fewer than fifteen seconds remain for its observation
ok - eight 3-second PR reads complete fresh within one 20-second poll cycle
ok - a read killed at the ten-second bound is budget refusal and stays silent
ok - a read between the old and raised per-call bounds completes without a wake
ok - one transient forge failure is retried once and self-heals without a wake
ok - a retry cut short by the poll budget stays unmeasured and silent
ok - an unreadable non-GitHub URL records no other URL's forge error detail
ok - a rotated poll starting on an unreadable URL still records every URL error
ok - rotation preserves timed-out records and refreshes every slow PR on successive cycles
ok - the effective budget is cut down to the watcher per-check bound with margin
ok - generated checks enforce configured and inherited budgets at runtime
ok - a genuinely unavailable forge records an error and wakes once per failure episode
ok - a late owner does not restart a shared forge failure episode
/tmp/fm-contributions.tEw4rI/retire-gone/fakebin/date: line 2: exec: : not found
/tmp/fm-contributions.tEw4rI/retire-gone/fakebin/date: line 2: exec: : not found
/tmp/fm-contributions.tEw4rI/retire-gone/fakebin/date: line 2: exec: : not found
/tmp/fm-contributions.tEw4rI/retire-gone/fakebin/date: line 2: exec: : not found
ok - retire stops the unavailable check, leaves rotation and restores complete coverage
ok - a late owner settled beside a retired final record stays unretired and known
ok - retire is idempotent and refuses non-captain, unknown, malformed and signal-bearing pairs
EXIT=0
Evidence: Red slice: rotated unreadable-first test against f8ecd43

Source: Red slice: rotated unreadable-first test against f8ecd43

=== focused red: current test file's test_rotated_unreadable_url_first_does_not_abort_poll
=== when: 2026-10-07T16:17:44Z
=== product under ROOT: /tmp/r3-red.cDvDhF/bin/fm-contributions.sh (f8ecd43, pre-round-2-fix)
=== runner line: for test_name in test_rotated_unreadable_url_first_does_not_abort_poll; do

/tmp/r3-red.cDvDhF/bin/fm-contributions.sh: line 416: BUDGET_EXHAUSTED: unbound variable
not ok - a poll whose first URL is unreadable aborted
not ok - 1 contribution regressions
rc=1

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.)

🔧 **Test** - 2 issues found → auto-fixed (2) ✅
  • ⚠️ bin/fm-contributions.sh:260 - The new per-read stderr evidence can be misattributed across URLs in one poll. observe() clears $TMP/last-forge.err only at line 264, after the scheme check at line 260, so a canonical-but-unreadable URL (GitLab .../-/merge_requests/N, which poll necessarily records as unmeasured) returns early and the error composed at line 445 appends the detail still held from the previous URL's genuine forge failure. Live A/B (S8): with a real GitHub PR's reads 502'd and a GitLab merge_request URL read in the same poll, the GitLab record's error became 'forge observation unavailable or changed during read: Get "https://api.github.com/repos/kunchenguid/firstmate/pulls/6780&#34;: Bad Gateway' even though no forge call was made for it (proxy log shows only the GitHub attempts); the base commit recorded the generic message with no detail. Suggested fix: move ': > "$TMP/last-forge.err"' above the scheme check in observe() (or append the detail only when this URL's own forge read failed); a scratch probe with that one-line move restored the generic message for the GitLab record while the GitHub record kept its own detail (raw/transcript-s8-cross-url-detail-probe.txt).
  • 🚨 live validation verdict: no-go (8 of 8 scenarios were driven live against the product); failed: Error evidence names the call that actually failed: an unreadable non-GitHub URL must not inherit another URL's stderr detail in the same poll
  • Live validation: ❌ no-go - 8 of 8 scenarios driven live against the product
Scenario Result Live Evidence
A healthy poll against the real GitHub API refreshes the owned open PR's observation (checked_at advances, error null) with no wake ✅ pass live raw/transcript-s0-plain.txt and raw/transcript-s1-proxy-passthrough.txt: FM_HOME=$LAB bin/fm-contributions.sh poll with real gh 2.97.0 against real api.github.com; record checked_at moved from 2026-01…
A GitHub read that spikes to ~7.5s — past the old hard 5s bound but inside the raised bound — completes and records a fresh observation instead of leaving the URL unmeasured ✅ pass live raw/transcript-s2-fixed.txt (fixed: 7s CONNECT delay, elapsed 10s, fresh observation, no wake) vs raw/transcript-s2-base.txt (base: killed at 5s, record untouched at 2026-01-01, silent); focused test…
A read past the raised 10s bound is still killed at the bound, stays unmeasured and silent, and is not retried ✅ pass live raw/transcript-s3-beyond-bound.txt: 14s CONNECT delay, elapsed 10s, exactly one CONNECT in the proxy log, record untouched, no error, no wake
One transient forge read failure is retried once and self-heals: fresh observation, error cleared, no wake (the base emitted the reported unavailable wake and error record) ✅ pass live raw/transcript-s4-fixed.txt vs raw/transcript-s4-base.txt: CONNECT #1 502'd; the fixed run's retry core read is the next tunneled CONNECT and the record ends error null with no wake, while the base pr…
A retry that the poll budget cuts short stays unmeasured and silent — budget refusal is never relabeled as a forge failure or a wake ✅ pass live raw/transcript-s5-retry-cut.txt: first attempt 502'd instantly, the retry's core read delayed 25s and killed at the 10s bound; record untouched, error null, no wake; focused test test_budget_cut_retry…
A persistent forge outage records error evidence naming the failing read and wakes only once per episode across two consecutive polls, with exactly one retry per poll ✅ pass live raw/transcript-s6-persistent-failure.txt: poll 1 printed exactly one unavailable line and recorded error 'forge observation unavailable or changed during read: Get "https://api.github.com/repos/kunche…
A URL owned by two tasks is observed once plus one retry, both owners converge on the fresh observation, and no wake is emitted ✅ pass live raw/transcript-s7-shared-retry.txt: delivery and duplicate records both fresh with error null after one 502'd attempt plus one successful retry (9 CONNECTs total for the single observation), wake queu…
Error evidence names the call that actually failed: an unreadable non-GitHub URL must not inherit another URL's stderr detail in the same poll ❌ fail live raw/transcript-s8-cross-url-detail.txt: with the GitHub PR's reads 502'd, the GitLab merge_request record (no forge call made for it — proxy log shows only the GitHub attempts) got error '...: Get "ht…
  • read-only gh auth status and gh api repos/kunchenguid/firstmate/pulls/6780 to confirm a real logged-in gh 2.97.0 and a real open PR for the fixture
  • bin/fm-lab-home.sh create $(mktemp -d &#34;${TMPDIR:-/tmp}/fm-lab.XXXXXX&#34;) for a disposable marked lab home; removed with rm -rf $LAB at the end of the run
  • S0: env -u NO_MISTAKES_GATE -u FM_GATE_REFUSE_BYPASS -u FM_ROOT_OVERRIDE -u FM_STATE_OVERRIDE -u FM_DATA_OVERRIDE -u FM_CONFIG_OVERRIDE -u FM_PROJECTS_OVERRIDE FM_HOME=$LAB bin/fm-contributions.sh poll — unperturbed real-GitHub poll
  • S1: same poll with HTTPS_PROXY=http://127.0.0.1:18920 pointed at the perturbing proxy in passthrough mode (control)
  • S2: CONNECT #1 to api.github.com delayed 7s, fixed bin/fm-contributions.sh vs $LAB/base/bin/fm-contributions.sh (base extracted with git archive ac0811c | tar -x into the lab)
  • S3: CONNECT #1 delayed 14s (past the raised bound)
  • S4: CONNECT #1 returned HTTP 502 on CONNECT, fixed vs base
  • S5: CONNECT #1 502'd and CONNECT #2 delayed 25s (retry cut by the budget)
  • S6: CONNECTs #1-#4 502'd across two consecutive polls
  • S7: two task records owning the same PR URL, CONNECT #1 502'd
  • S8: GitHub PR failure followed by a GitLab .../-/merge_requests/1 URL in one poll — fixed, base, and a scratch probe with ': > "$TMP/last-forge.err"' moved above observe()'s scheme check
  • bash tests/fm-contributions.test.sh — 52 ok, 0 not ok (includes the new tests test_slow_forge_read_within_raised_bound_completes, test_transient_forge_failure_retries_once_and_recovers, test_budget_cut_retry_stays_unmeasured)

🔧 Fix applied.
1 error still open:

  • 🚨 bin/fm-contributions.sh:419 - Live S8b (rotated URL order): when a canonical but unsupported URL (any non-GitHub /-/merge_requests/N, which poll necessarily records as unmeasured) is first in the poll rotation, observe() returns before assigning BUDGET_EXHAUSTED, so the new retry check expanded the unset variable and set -u aborted the poll with 'BUDGET_EXHAUSTED: unbound variable' (rc=1, no record updated). The base commit ac0811c was reachable through the same ordering at its continue line (line 399), so the crash predates this change; but the new retry code is now the first dereference and the change's cross-URL regression test pinned only the GitHub-first order. Fixed during this test phase: poll() initializes BUDGET_EXHAUSTED=0 before the loop (line 383) and tests/fm-contributions.test.sh adds test_rotated_unreadable_url_first_does_not_abort_poll (red against f8ecd43, green after the fix). Live S8b then completed rc=0 with the GitLab record generic and the GitHub record carrying its own stderr detail. The product fix and its regression test are already applied in this worktree.
  • Live validation: ✅ go - 9 of 9 scenarios driven live against the product
Scenario Result Live Evidence
Run a healthy contributions poll and get a fresh observation with no error and no wake ✅ pass live raw/transcript-r2-s1-healthy-no-proxy.txt; raw/transcript-r2-s1b-healthy-passthrough.txt
A 7s core forge read (the recorded latency-spike class) completes inside the raised 10s bound and records a fresh observation with no wake ✅ pass live raw/transcript-r2-s2-spike-7s-core.txt
A read delayed past the 10s per-call bound is killed as budget refusal: silent, one attempt, prior record untouched ✅ pass live raw/transcript-r2-s3-beyond-10s-bound.txt
A single transient forge failure (CONNECT 502) is retried once and self-heals: fresh observation, no error, no wake ✅ pass live raw/transcript-r2-s4-single-502-retried-heals.txt
A transient failure whose retry the poll budget cuts short stays unmeasured: silent, prior record untouched ✅ pass live raw/transcript-r2-s5-502-then-budget-cut-retry.txt
A persistent two-poll outage still records error evidence naming the failed call and wakes exactly once for the episode ✅ pass live raw/transcript-r2-s6-persistent-502-two-polls.txt
A URL shared by two owners with one transient failure is observed and retried once for both owners, both fresh, no wake ✅ pass live raw/transcript-r2-s7-shared-url-transient.txt
A failed GitHub read and a canonical-but-unreadable GitLab URL in one poll each keep their own error evidence (GitHub-first rotation) ✅ pass live raw/transcript-r2-s8-cross-url-detail-github-first.txt; raw/transcript-r2-s8-base-cross-url-detail.txt
The same mixed poll rotated so the unreadable URL is visited first records every URL's error instead of aborting the poll ✅ pass live raw/transcript-r2-s8b-cross-url-detail-gitlab-first.txt; raw/transcript-r2-s8b-pre-fix-rotated.txt; raw/r2-red-slice.txt
  • bash raw/r2-live-harness.sh - 11 live scenarios driving the real bin/fm-contributions.sh poll against the real GitHub API (PR kunchenguid/firstmate#6780) from a disposable marked lab home through the perturbing CONNECT proxy; run on f8ecd43 and re-run after the test-phase fix
  • git archive ac0811c bin base-source lab run of the GitHub-first cross-URL poll for before/after comparison (raw/transcript-r2-s8-base-cross-url-detail.txt)
  • git archive f8ecd43 bin live pre-fix rotated-order reproduction in a fresh lab home (raw/transcript-r2-s8b-pre-fix-rotated.txt)
  • red/green slice run of test_rotated_unreadable_url_first_does_not_abort_poll against f8ecd43 and the fixed worktree (raw/r2-red-slice.txt)
  • bash tests/fm-contributions.test.sh - focused file after the fix, 54 ok / 0 not ok (raw/focused-test-run-r2.log)

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

  • Live validation: ✅ go - 9 of 10 scenarios driven live against the product
Scenario Result Live Evidence
A healthy contribution poll records a fresh observation and emits no observation-unavailable wake ✅ pass live raw/transcript-r3-s1-healthy-no-proxy.txt (rc=0, empty stdout, checked_at advanced, error null) and raw/transcript-r3-s1b-healthy-passthrough.txt
A GitHub read delayed 7s (the recorded spike class, past the old 5s bound) completes under the raised bound and records a fresh observation with no wake; the base commit leaves the record unmeasured ✅ pass live raw/transcript-r3-s2-spike-7s-core.txt (target: 7s DELAY then TUNNEL, elapsed 9s, fresh, no wake) vs raw/transcript-r3-s2-base-spike-7s-core.txt (ac0811c: killed at 5s, record untouched)
A read delayed past the raised 10s bound is budget refusal: exactly one attempt, silent, record untouched, no retry ✅ pass live raw/transcript-r3-s3-beyond-10s-bound.txt (one CONNECT #1 delay, elapsed 10s, empty stdout, prior record intact)
A single transient forge 502 is retried once and self-heals with a fresh observation and no wake; the base commit instead emits the reported contributions-observation wake ✅ pass live raw/transcript-r3-s4-single-502-retried-heals.txt (FAIL #1, TUNNEL #2, fresh, no wake) vs raw/transcript-r3-s4-base-single-502-wakes.txt (base wake + error record)
A transient failure whose retry is cut by the poll budget stays unmeasured: record untouched and no wake ✅ pass live raw/transcript-r3-s5-retry-budget-cut.txt (FAIL #1 then 25s-delayed retry killed at the 10s bound, prior record intact, empty stdout)
A persistent forge outage emits one observation-unavailable wake for the episode, records an error naming the failed call, and a second poll stays silent while retrying once per poll ✅ pass live raw/transcript-r3-s6-persistent-502-two-polls.txt (poll 1 wake + error with Get &#34;.../pulls/6780&#34;: Bad Gateway, poll 2 empty, 4 CONNECTs for 2 polls)
A URL shared by two owners gets one observation and one retry serving both owners, both fresh and no wake ✅ pass live raw/transcript-r3-s7-shared-url-transient.txt (FAIL #1, TUNNEL #2, both delivery and duplicate records fresh, empty stdout)
In a poll where a GitHub read fails and an unreadable GitLab URL is visited second, each record keeps its own error: GitLab generic, GitHub its own stderr detail ✅ pass live raw/transcript-r3-s8-cross-url-detail-github-first.txt (gitlab error exactly the generic string; delivery error carries its own Bad Gateway detail)
In a rotated poll where the unreadable GitLab URL is visited first, the poll still completes rc=0 and records each URL's own error; the pre-round-2-fix f8ecd43 aborts with BUDGET_EXHAUSTED unbound ✅ pass live raw/transcript-r3-s8b-cross-url-detail-gitlab-first.txt vs raw/transcript-r3-s8b-prefix-rotated-aborts.txt; focused red/green in raw/r3-red-slice-rotated.txt and raw/focused-test-run-r3.log
A head-changed-during-observation failure is retried and records the generic unavailable error without another URL's stderr ⏸️ untested no Cannot deterministically race the real GitHub PR head between the observer's core read and closing read; a live drive would require a disposable GitHub repository whose PR head can be moved mid-observ…
  • Baseline: gh api repos/kunchenguid/firstmate/pulls/6780 confirmed the live fixture PR is still open at head e032f755e72ef9771458ae0064ef215900062c3a
  • bash tests/fm-contributions.test.sh on 92c1683 -> 54 ok, 0 not ok, exit 0 (raw/focused-test-run-r3.log)
  • bash raw/r3-live-harness.sh -> 13 live scenarios against real gh/GitHub API in a disposable bin/fm-lab-home.sh lab, perturbed by raw/perturbing-connect-proxy.pl (raw/r3-harness-run.log, raw/transcript-r3-*.txt)
  • Live S1/S1b healthy polls: env -u NO_MISTAKES_GATE ... FM_HOME=$LAB FM_CONTRIBUTIONS_BUDGET=20 bin/fm-contributions.sh poll (direct and via passthrough proxy) -> fresh observation, no wake
  • Live S2/S2-base: same poll with proxy rule 1:delay:7 on the target and on git archive ac0811c -> target 7s read completes fresh; base kills at 5s and leaves the record unmeasured
  • Live S3: proxy rule 1:delay:14 -> killed at the 10s bound, exactly one CONNECT, silent, record untouched
  • Live S4/S4-base: proxy rule 1:fail -> target retries once and heals; base emits contributions: observation unavailable for &lt;url&gt;
  • Live S5: rules 1:fail 2:delay:25 -> retry cut at the 10s bound, record untouched, no wake
  • Live S6: rules 1:fail 2:fail 3:fail 4:fail over two polls -> one wake, second poll silent, error ...: Get &#34;https://api.github.com/repos/kunchenguid/firstmate/pulls/6780&#34;: Bad Gateway
  • Live S7 shared URL: rule 1:fail -> one retry, both owners fresh, no wake
  • Live S8/S8b cross-URL detail (GitHub-first and rotated GitLab-first): rules 1:fail 2:fail -> both orders complete with GitLab generic and GitHub's own stderr detail
  • Live S8b-prefix adversarial A/B: same rotated poll with git archive f8ecd43 -> line 416: BUDGET_EXHAUSTED: unbound variable, rc=1, both records untouched
  • Red slice: current test file's test_rotated_unreadable_url_first_does_not_abort_poll against extracted f8ecd43 -> not ok - a poll whose first URL is unreadable aborted (raw/r3-red-slice-rotated.txt)
  • Teardown: git status --porcelain clean, lab home/proxy/scratch roots removed after the run
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

The poll's per-call bound was a hard five seconds, and a single GitHub API
latency spike above it (one measured at 7.5s) recorded "forge observation
unavailable or changed during read" and woke supervision. Roughly fifteen
such wakes arrived in a week; every one had no pending signals, the prior
observation intact, and the same reads succeeding by hand moments later.

Raise the per-call bound to ten seconds while the poll deadline stays the
outer bound. Retry a failed observation once when the failure was not the
budget's, and keep an attempt the budget cuts short unmeasured exactly like
a first attempt: prior records untouched, no unavailable record. Append the
failing read's first bounded, single-line stderr text to the recorded
reason so a record names the failed call while the existing prefix, wake
text, acknowledgement contract, schema, locking, and rotation stay
unchanged.

Tests cover a read between the old and raised bounds completing fresh
without a wake, one transient failure recovering on the single retry
without a wake, and a retry cut short by the budget staying unmeasured.
The fixture fake clock now resolves the host's date instead of /bin/date so
the suite also runs on hosts without an FHS bin tree.
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.

1 participant