healer: the API-health probe reads actions/tasks?limit=1 while the read that actually fails is limit=100 — the bundle says 'healthy' during the degradation #325

Closed
opened 2026-11-04 19:24:55 +00:00 by matou-build-agent · 4 comments

Symptom

Run 26098, leg
swarm (elitebook-03), 2026-11-04T19:18:47Z, RED in stage
sandcastle run (workers):

PromptError: Command `bash .sandcastle/claim-next-task.sh` exited with code 28
claim-next-task: the alive-runs fetch (the actions-API tasks list) faulted (rc=28)

rc 28 is curl --max-time. claim_alive_runs (claim-lib.sh) reads
/actions/tasks?limit=100&page=1 under CLAIM_ALIVE_MAX_TIME=20
(claim-next-task.sh), and that read exceeded 20s. The fault itself was
forge latency under fleet contention — three swarm legs live at once
(26098 @19:17:26, 26152 bens-mac-04 @19:15:21, 26152 matou-workstation
@19:13:16) plus run 26153 — and it self-heals on the next tick. The harness
failed loud correctly (idss#1425). That part is not the bug.

The bug: the healer's probe cannot see the read that broke

heal.sh:329 probes probe_api "$FORGEJO_API/actions/tasks?limit=1&page=1".
limit=1 is a different cost class from the limit=100 read that actually
fails. Measured live from elitebook-distributed-server-03, 2026-11-04
~19:40Z, same token, same host, back to back:

read samples size
actions/tasks?limit=1&page=1 1.18s, 1.95s, 1.22s 452 B
actions/tasks?limit=100&page=1 4.59s, 5.45s, 8.64s 21234 B

So the probe runs ~4-7x cheaper than the read the claim prefetch depends on.
In this incident api-timing.txt recorded api_http=200 api_seconds=2.228981
— i.e. the evidence bundle told the healer "API healthy" at the very
moment the hot read was blowing a 20s cap. heal.sh:866's health arm keys on
that number against a 30s threshold, so the only API-latency signal in the
bundle is systematically optimistic for exactly this signature (f99e8b1c38d7,
first occurrence — no prior ledger entry).

Side observation while measuring: limit=100 returns 50 rows
(total_count 31961) — this forge caps the page at 50, so the limit=100
in claim_alive_runs is already being clamped.

Ask

  1. Probe the read the harness actually depends on: make heal.sh's API probe
    use the same query shape as claim_alive_runs
    (actions/tasks?limit=100&page=1), or probe both and record both lines in
    api-timing.txt so a healer can tell cheap-read health from hot-read
    health. Keep api_http/api_seconds/api_curl_exit key names stable —
    heal.sh:862-869 and tests/heal-lib-test.sh parse them.
  2. Turn on the latency series the budgets are supposed to be tuned from.
    claim-lib.sh already has the seam — CLAIM_LATENCY_LOG, appending
    <epoch> dur=<n>s rc=<n> per read — and claim-next-task.sh:72-76 says in
    so many words: "There is no dedicated claim-latency log to derive an exact
    p95 from yet; set CLAIM_LATENCY_LOG (claim-lib.sh) to start recording one
    and retune from disk."
    It is unset in production, so nobody can tell a
    one-off spike from a creeping regression in CLAIM_ALIVE_MAX_TIME=20.
    Wire it to a host path (sibling of run-swarm-verdicts.log) and leave the
    retune to a later ticket once there is data.
  3. claim-next-task.sh:210 ends "run-swarm re-keys this to the claim stage".
    It does not: execute-lib.sh:117 sets verdict_stage "sandcastle run (workers)" and nothing re-keys an in-sandbox claim fault, which is why
    run-verdict.txt for this run reads stage=sandcastle run (workers).
    Either re-key it or fix the sentence — as written an alive-runs transport
    fault and a genuine worker crash share one stage key, so ledger recurrence
    is coarser than the prose promises.

Items 1 and 3 touch root files only; claim-lib.sh/heal.sh changes need
their tests updated in the same commit (repo rule), and a root fix does not
reach the running copy until a human re-vendors

(bash onboarding/onboard.sh vendor .sandcastle <sha>).

Filed by the healer for run 26098 (signature f99e8b1c38d7). The healer
charter forbids the healer from editing heal.sh/heal-lib.sh itself, hence
this ticket rather than a repair.

## Symptom Run [26098](https://git.matou.nz/Matou/dev-factory/actions/runs/26098), leg `swarm (elitebook-03)`, 2026-11-04T19:18:47Z, RED in stage `sandcastle run (workers)`: ``` PromptError: Command `bash .sandcastle/claim-next-task.sh` exited with code 28 claim-next-task: the alive-runs fetch (the actions-API tasks list) faulted (rc=28) ``` rc 28 is `curl --max-time`. `claim_alive_runs` (`claim-lib.sh`) reads `/actions/tasks?limit=100&page=1` under `CLAIM_ALIVE_MAX_TIME=20` (`claim-next-task.sh`), and that read exceeded 20s. The fault itself was forge latency under fleet contention — three swarm legs live at once (26098 @19:17:26, 26152 bens-mac-04 @19:15:21, 26152 matou-workstation @19:13:16) plus run 26153 — and it self-heals on the next tick. The harness failed loud correctly (idss#1425). **That part is not the bug.** ## The bug: the healer's probe cannot see the read that broke `heal.sh:329` probes `probe_api "$FORGEJO_API/actions/tasks?limit=1&page=1"`. `limit=1` is a different cost class from the `limit=100` read that actually fails. Measured live from `elitebook-distributed-server-03`, 2026-11-04 ~19:40Z, same token, same host, back to back: | read | samples | size | |---|---|---| | `actions/tasks?limit=1&page=1` | 1.18s, 1.95s, 1.22s | 452 B | | `actions/tasks?limit=100&page=1` | 4.59s, 5.45s, 8.64s | 21234 B | So the probe runs ~4-7x cheaper than the read the claim prefetch depends on. In this incident `api-timing.txt` recorded `api_http=200 api_seconds=2.228981` — i.e. the evidence bundle told the healer **"API healthy"** at the very moment the hot read was blowing a 20s cap. `heal.sh:866`'s health arm keys on that number against a 30s threshold, so the only API-latency signal in the bundle is systematically optimistic for exactly this signature (`f99e8b1c38d7`, first occurrence — no prior ledger entry). Side observation while measuring: `limit=100` returns **50** rows (`total_count` 31961) — this forge caps the page at 50, so the `limit=100` in `claim_alive_runs` is already being clamped. ## Ask 1. Probe the read the harness actually depends on: make `heal.sh`'s API probe use the same query shape as `claim_alive_runs` (`actions/tasks?limit=100&page=1`), or probe both and record both lines in `api-timing.txt` so a healer can tell cheap-read health from hot-read health. Keep `api_http`/`api_seconds`/`api_curl_exit` key names stable — `heal.sh:862-869` and `tests/heal-lib-test.sh` parse them. 2. Turn on the latency series the budgets are supposed to be tuned from. `claim-lib.sh` already has the seam — `CLAIM_LATENCY_LOG`, appending `<epoch> dur=<n>s rc=<n>` per read — and `claim-next-task.sh:72-76` says in so many words: *"There is no dedicated claim-latency log to derive an exact p95 from yet; set CLAIM_LATENCY_LOG (claim-lib.sh) to start recording one and retune from disk."* It is unset in production, so nobody can tell a one-off spike from a creeping regression in `CLAIM_ALIVE_MAX_TIME=20`. Wire it to a host path (sibling of `run-swarm-verdicts.log`) and leave the retune to a later ticket once there is data. 3. `claim-next-task.sh:210` ends *"run-swarm re-keys this to the claim stage"*. It does not: `execute-lib.sh:117` sets `verdict_stage "sandcastle run (workers)"` and nothing re-keys an in-sandbox claim fault, which is why `run-verdict.txt` for this run reads `stage=sandcastle run (workers)`. Either re-key it or fix the sentence — as written an alive-runs transport fault and a genuine worker crash share one stage key, so ledger recurrence is coarser than the prose promises. Items 1 and 3 touch root files only; `claim-lib.sh`/`heal.sh` changes need their tests updated in the same commit (repo rule), and **a root fix does not reach the running copy until a human re-vendors** (`bash onboarding/onboard.sh vendor .sandcastle <sha>`). Filed by the healer for run 26098 (signature `f99e8b1c38d7`). The healer charter forbids the healer from editing `heal.sh`/`heal-lib.sh` itself, hence this ticket rather than a repair.
Author
Member

swarm-claim host=bens-mac-04 run=26195
(automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=bens-mac-04 run=26195 (automated multi-host claim — lowest live claim id works this ticket)
Author
Member

swarm-claim host=matou-dev-server-01 run=26194
(automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=matou-dev-server-01 run=26194 (automated multi-host claim — lowest live claim id works this ticket)
Author
Member

⏩ independent reviewer for #325 — verdict unauthenticated

review JSON
{
  "verdict": "unauthenticated",
  "findings": []
}
:fast_forward: **independent reviewer** for #325 — verdict `unauthenticated` <details><summary>review JSON</summary> ```json { "verdict": "unauthenticated", "findings": [] } ``` </details>
Author
Member

close-report for #325 — status success

✅ close-report gates passed — every claim verified against the pushed worker branch sandcastle/worker/20261104-204335-4df59d (pre-land — the host promotes it to main only after its post-run verify, #193/#283); issue closed.

envelope
{
  "issue": 325,
  "status": "success",
  "commits": [
    "0ea89052d913f16bbbc4e9987ccdca9b8c1ac6ca"
  ],
  "changed_files": [
    "heal.sh",
    "claim-lib.sh",
    "claim-next-task.sh",
    "tests/heal-test.sh",
    "tests/claim-lib-test.sh",
    "tests/claim-next-task-test.sh",
    "docs/journal/2026-11-04-325-healer-probe-hot-read.md"
  ],
  "tests": [
    {
      "command": "bash tests/heal-test.sh",
      "exit_code": 0
    },
    {
      "command": "bash tests/claim-lib-test.sh",
      "exit_code": 0
    },
    {
      "command": "bash tests/claim-next-task-test.sh",
      "exit_code": 0
    },
    {
      "command": "bash tests/heal-lib-test.sh",
      "exit_code": 0
    },
    {
      "command": "bash tests/docs-budget-test.sh",
      "exit_code": 0
    },
    {
      "command": "bash onboarding/tests/vendor-manifest-coverage-test.sh",
      "exit_code": 0
    }
  ],
  "criteria": {
    "Ask 1 — probe the read the harness actually depends on (actions/tasks?limit=100&page=1), key names stable": "heal.sh gather_evidence now calls probe_api with actions/tasks?limit=100&page=1 (was limit=1); api_http/api_seconds/api_curl_exit unchanged. tests/heal-test.sh +1 scenario: a URL-capturing curl stub asserts the probe reads limit=100 and NOT limit=1 (red-before-green verified by reverting the URL).",
    "Ask 2 — turn on the latency series, wired to a host path (sibling of run-swarm-verdicts.log), retune deferred": "claim-lib.sh CLAIM_LATENCY_LOG default changed from unset to ${CLAIM_VERDICT_LOG%/*}/claim-latency.log (sibling of run-swarm-verdicts.log); append mkdir -p's its parent first so a missing dir is a silent no-op (fixes a stderr redirection-error leak); empty disables. tests/claim-lib-test.sh: ON by default, sink is a verdict-log sibling, empty disables; setup() pins the sink into the sandbox. Retune left to a later ticket per the ask.",
    "Ask 3 — re-key or fix the sentence (claim-next-task.sh:210)": "Chose the ticket's second option: corrected the alive-runs fault message to state the in-sandbox fault surfaces under execute-lib.sh's 'sandcastle run (workers)' verdict stage (shares a stage key with a genuine worker crash), NOT a re-keyed claim stage. tests/claim-next-task-test.sh T5 comment updated to match; the 'alive-runs' stderr assertion still holds.",
    "Repo rule — every lib change updates its test in the same commit": "heal.sh -> tests/heal-test.sh (+1); claim-lib.sh -> tests/claim-lib-test.sh (rewritten default-ON tests + hermetic setup); claim-next-task.sh -> tests/claim-next-task-test.sh (comment). All in commit 0ea8905.",
    "Repo rule — journal entry for a project-state change; GOTCHAS/STATUS": "docs/journal/2026-11-04-325-healer-probe-hot-read.md added. No STATUS.md surface row affected (no consumer/host/blocker change), matching the #321 precedent. GOTCHAS index row deferred (ratchet at 24445/24576 B); hazard recorded in the journal.",
    "Full offline suite green": "Only the four documented pre-existing environmental reds remain (fleet-tui, floor-server, list-ready-tasks, run-swarm-ready-list — live tracker / absent node_modules); they fail identically on the clean tree and are outside this slice. All changed-file tests pass."
  },
  "summary": "heal.sh now probes the limit=100 hot read (not the 4-7x-cheaper limit=1), claim-lib.sh wires the CLAIM_LATENCY_LOG series on at a host verdict-log sibling, and claim-next-task.sh's alive-runs fault prose no longer falsely claims a claim-stage re-key.",
  "reason": "",
  "blockers": [],
  "no_code_change": ""
}
**close-report** for #325 — status `success` :white_check_mark: **close-report gates passed** — every claim verified against the pushed worker branch `sandcastle/worker/20261104-204335-4df59d` (pre-land — the host promotes it to `main` only after its post-run verify, #193/#283); issue closed. <details><summary>envelope</summary> ```json { "issue": 325, "status": "success", "commits": [ "0ea89052d913f16bbbc4e9987ccdca9b8c1ac6ca" ], "changed_files": [ "heal.sh", "claim-lib.sh", "claim-next-task.sh", "tests/heal-test.sh", "tests/claim-lib-test.sh", "tests/claim-next-task-test.sh", "docs/journal/2026-11-04-325-healer-probe-hot-read.md" ], "tests": [ { "command": "bash tests/heal-test.sh", "exit_code": 0 }, { "command": "bash tests/claim-lib-test.sh", "exit_code": 0 }, { "command": "bash tests/claim-next-task-test.sh", "exit_code": 0 }, { "command": "bash tests/heal-lib-test.sh", "exit_code": 0 }, { "command": "bash tests/docs-budget-test.sh", "exit_code": 0 }, { "command": "bash onboarding/tests/vendor-manifest-coverage-test.sh", "exit_code": 0 } ], "criteria": { "Ask 1 — probe the read the harness actually depends on (actions/tasks?limit=100&page=1), key names stable": "heal.sh gather_evidence now calls probe_api with actions/tasks?limit=100&page=1 (was limit=1); api_http/api_seconds/api_curl_exit unchanged. tests/heal-test.sh +1 scenario: a URL-capturing curl stub asserts the probe reads limit=100 and NOT limit=1 (red-before-green verified by reverting the URL).", "Ask 2 — turn on the latency series, wired to a host path (sibling of run-swarm-verdicts.log), retune deferred": "claim-lib.sh CLAIM_LATENCY_LOG default changed from unset to ${CLAIM_VERDICT_LOG%/*}/claim-latency.log (sibling of run-swarm-verdicts.log); append mkdir -p's its parent first so a missing dir is a silent no-op (fixes a stderr redirection-error leak); empty disables. tests/claim-lib-test.sh: ON by default, sink is a verdict-log sibling, empty disables; setup() pins the sink into the sandbox. Retune left to a later ticket per the ask.", "Ask 3 — re-key or fix the sentence (claim-next-task.sh:210)": "Chose the ticket's second option: corrected the alive-runs fault message to state the in-sandbox fault surfaces under execute-lib.sh's 'sandcastle run (workers)' verdict stage (shares a stage key with a genuine worker crash), NOT a re-keyed claim stage. tests/claim-next-task-test.sh T5 comment updated to match; the 'alive-runs' stderr assertion still holds.", "Repo rule — every lib change updates its test in the same commit": "heal.sh -> tests/heal-test.sh (+1); claim-lib.sh -> tests/claim-lib-test.sh (rewritten default-ON tests + hermetic setup); claim-next-task.sh -> tests/claim-next-task-test.sh (comment). All in commit 0ea8905.", "Repo rule — journal entry for a project-state change; GOTCHAS/STATUS": "docs/journal/2026-11-04-325-healer-probe-hot-read.md added. No STATUS.md surface row affected (no consumer/host/blocker change), matching the #321 precedent. GOTCHAS index row deferred (ratchet at 24445/24576 B); hazard recorded in the journal.", "Full offline suite green": "Only the four documented pre-existing environmental reds remain (fleet-tui, floor-server, list-ready-tasks, run-swarm-ready-list — live tracker / absent node_modules); they fail identically on the clean tree and are outside this slice. All changed-file tests pass." }, "summary": "heal.sh now probes the limit=100 hot read (not the 4-7x-cheaper limit=1), claim-lib.sh wires the CLAIM_LATENCY_LOG series on at a host verdict-log sibling, and claim-next-task.sh's alive-runs fault prose no longer falsely claims a claim-stage re-key.", "reason": "", "blockers": [], "no_code_change": "" } ``` </details>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Matou/dev-factory#325
No description provided.