healer: the api-timing probe reports every curl failure as timeout, so auth faults and remote degradation are indistinguishable in the evidence #1462
Labels
No labels
agent-blocked
agent-working
autopilot
bug
deferred
deploy-pending
enhancement
landing-pr
model-haiku
model-opus
model-sonnet
needs-design
needs-info
needs-triage
no-triage
out-of-scope
priority
ready-for-agent
ready-for-human
ready-for-session
rehearsal-183
snapshot-pending
standing-drive
wayfinder:grilling
wayfinder:map
wayfinder:prototype
wayfinder:research
wayfinder:task
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Matou/idss#1462
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Symptom
heal.sh's Forgejo latency probe writesapi_seconds=timeoutinto theevidence directory on any curl failure, not just a timeout:
curl -sffails identically for a 35s stall, a fast 401/403 (expired ormis-synced token), a 5xx, and DNS/connect failure. The
||branch labels allfour
timeout.Why it matters
This is the healer's only evidence about whether the Forgejo API was
reachable, and several run-verdict faults (
preflight (list untriaged issues)exits 22 via
preflight-triage.sh'sapi()retry wrapper, which also usescurl -sfand so swallows the body) leave an empty error block. So for awhole class of incidents the healer is choosing between "remote API degraded"
(transient-external, no repair) and "the bot's token is broken"
(harness-infra, repairable) on evidence that cannot distinguish them.
Observed on heal run
heal-Matou-idss-1789250785-2562903(signaturef4b342f26065, triage run 22846):api_seconds=timeout+ an empty errorblock forced live re-probing with the bind-mounted token to rule out auth
before the incident could be classified. The same probe answers in ~1-2s when
the instance is healthy, so the failure was real — but the evidence file did
not say which failure.
What to build
Record the distinguishing facts instead of one ambiguous word. Capture
curl's own outcome:
and write
api_http=<code>,api_seconds=<t>,api_curl_exit=<rc>— so a401reads as auth, a000/exit 28 as a genuine timeout, a5xxas remotedegradation. Keep an
api_seconds=line (heal.sh:521 and the watchdog parseit) so existing consumers do not break.
Acceptance criteria
api_http=200, a real elapsedapi_seconds=<n>, andapi_curl_exit=0.api_http=401,api_curl_exit=0) andis NOT reported as
timeout.--max-timerecordsapi_curl_exit=28andapi_seconds=timeout, preserving today's line for existing parsers.api_seconds=still works on all threeshapes (covered by
tests/heal-lib-test.shor a sibling).Contract
.sandcastle/heal.shis vendored factory core (FACTORY_MANIFESTline 25,FACTORY_REF72496a4). Land the fix inMatou/dev-factory, bumpFACTORY_REF, and re-vendor — a direct edit here reds the"Factory core: vendored .sandcastle files match FACTORY_REF" CI stage
(#571/#602).
Filed by the swarm healer while diagnosing triage run 22846 — a side-finding,
not that run's root cause (which was remote Forgejo degradation,
transient-external).
This ticket cannot be closed by a Sandcastle worker — its entire deliverable is a change to vendored factory core, which is a protected path per #445.
What the fix touches, and why a swarm run cannot land it:
.sandcastle/heal.sh(listed inFACTORY_MANIFEST, vendored fromMatou/dev-factoryatFACTORY_REF). The ticket's own Contract states the fix must land inMatou/dev-factory, bumpFACTORY_REF, and re-vendor — a direct edit here reds the "Factory core: vendored .sandcastle files match FACTORY_REF" CI stage (#571/#602)..sandcastle/is a protected path: the protected-paths tree-fingerprint (.sandcastle/protected-paths-lib.sh, #445) rolls back any create/change/delete under it and fails the run loud. A swarm worker also has noMatou/dev-factorycheckout in its sandbox, and the re-vendor step itself rewrites.sandcastle/heal.sh.tests/heal-lib-test.shdoes not exist in this repo either — it, too, is factory-side.There is no in-scope, in-repo work a Sandcastle worker can do here: 100% of the change is protected factory core.
Per Rule 9 / ADR 0174, a protected
.sandcastle/machinery change needs an interactive session's standing (a session works inMatou/dev-factory, bumpsFACTORY_REF, and re-vendors), not a swarm run. Relabellingready-for-agent→ready-for-session.Why session (not human)
The fix is a two-way door (revertible, provable by
tests/heal-lib-test.shper AC4) — it does not need Ben, only the factory-core standing a session has. A session escalates toready-for-humanonly if it finds a genuine one-way door.Close report — landed under ADR 0174 (two-way door; veto anytime)
The api-timing probe now records curl's own outcome instead of collapsing every failure onto one ambiguous
timeout.What landed
probe_api(heal-lib.sh) writes three lines toapi-timing.txt:api_http=<code>,api_seconds=<t|timeout>,api_curl_exit=<rc>. It captures curl's-w '%{http_code} %{time_total}'and its real exit code.heal.sh'sgather_evidencecallsprobe_api; the watchdog reads all three facts and trips theforgejo-apiincident on any unhealthy probe (transport failure / non-2xx / ≥30s) — the same trip-set the old blankettimeoutfired on (curl -sffailed on all of them) — but the errline and evidence now name which fault.Note on the task's snippet: the suggested
read -r code t <<<"$(curl …)"; rc=$?loses curl's exit —$?afterreadis READ's status (verified: it reports 0 on a connect-refused).probe_apicaptures the exit off a guarded assignment instead.Acceptance criteria
api_http=200, a real elapsedapi_seconds=<n>,api_curl_exit=0. ✓api_http=401,api_curl_exit=0, and nottimeout. ✓--max-timestall:api_curl_exit=28withapi_seconds=timeoutpreserved. ✓sed -n 's/^api_seconds=//p'read (heal.sh watchdog + prompt) still yields a usable value on all shapes. ✓Contract honoured: fixed in
Matou/dev-factory(1e08738),FACTORY_REFbumped9aaac50→1e08738, re-vendored byte-identical here —check-harness-driftOK (the vendored-file drift gate stays green).Commits
1e08738— the fix + tests.44cf7d66— re-vendor (FACTORY_REF+heal.sh/heal-lib.sh+ tests) +STATUS.md.Proof
heal-lib-test: 25 groups (AC1–AC4 over healthy/401/stall/connect shapes).heal-test: 19 scenarios, incl. a new watchdog scenario proving a fast 401 trips the incident but is recordedapi_http=401, nevertimeout.check-harness-drift: OK againstdev-factory@1e08738.Ruled by agent under ADR 0174 — veto anytime. A side-finding of triage run 22846 (root cause: remote Forgejo degradation, transient-external).