sandcastle: watchdog mode never fetches the failing run's job log — heal-lib keys .html_url, /actions/tasks returns .url #174
Labels
No labels
agent-blocked
agent-working
bug
deferred
enhancement
model-haiku
model-opus
model-sonnet
needs-info
needs-triage
no-triage
priority
product-decision
ready-for-agent
ready-for-human
ready-for-session
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Matou/coa#174
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?
Filed by the healer (watchdog sweep, heal run
heal-Matou-coa-1792811494-314812, signature0ff1caf1b642, evidence/tmp/matou-heal-Matou-coa.rt5kh0on matou-dev-server-01).Symptom
In watchdog mode the healer's
job-log.txtis always:Today's bundle for the
swarm (bens-mac-04)streak is the worked example:run-verdict.txt,worker-logs.txtandno-local-evidence.txtall say "no local evidence … the failing leg ran on another swarm pool host", the trigger error line is the emptywatchdog: streak (), andjob-log.txtsays not fetched. The bundle carried zero fault text. The diagnosis agent had to fetch the step logs by hand to findCould not resolve host: git.matou.nz(#172).That is precisely the case #188 was built for — its own comment says "On a cross-host failure (#135) this is the ONLY fault text the bundle can carry" — and it is dead in the only mode that fires for an off-host leg (the on-host hook cannot run at all, #171).
Cause
.sandcastle/heal-lib.sh—watchdog_run_url()keys on.html_url:heal.sh:294buildsruns.jsonfrom$FORGEJO_API/actions/tasks?limit=50&page=1. That endpoint has nohtml_url. Probed live 2026-10-24T03:21Z, the row keys are:.urlalready is the web URL (https://git.matou.nz/Matou/coa/actions/runs/22096) — exactly whatcollect_job_logswants. Sowatchdog_run_urlalways echoes empty,collect_job_logstakes its[ -z "$run_url" ]branch, and the probe never happens.Fetching
.urlby hand on the three failing runs returns the fault immediately:Why the test suite is green
tests/heal-lib-test.sh:267builds its fixture withhtml_url, so the unit test asserts the synthetic shape, not the shape Forgejo returns. Its next assertion (:287) — "must return empty when the payload carries no html_url (older/foreign shape)" — is in fact the production path, asserted as the acceptable fallback.tests/heal-test.sh:941only covers hook mode (RUN_URLset from the workflow env), so watchdog mode was never exercised against a real-shaped payload.Fix
Accept either key, preferring
html_urlso a payload that does carry it is unchanged:Acceptance
watchdog_run_urlreturns the run URL from a fixture whose rows carry onlyurl(the real/actions/tasksshape) — add that fixture alongside the existinghtml_urlone; keep an assertion that a row with neither key still yields empty.tests/heal-test.shgrows a watchdog-mode case (noRUN_URL) provingjob-log.txtcarries the leg's own log line, mirroring the hook-mode case at:941.job-log.txtwith real log text, not the "not fetched" note.Out of scope
HEAL_WORKDIRhardcoded path (#171). This ticket is only about the watchdog being unable to fetch the off-host fault text. Together the three are why a 15-day-old host outage still arrives aswatchdog: streak ()with an empty bundle.Notes
.sandcastle/is vendored atFACTORY_REFa2dc353; this is factory-side too, so the re-vendor must carry it back deliberately.ready-for-sessionperdocs/agents/issue-tracker.md, never inside a worker PR.docs/GOTCHAS.mdentry: a fixture invented from an API's documented shape rather than captured from the live endpoint can keep a unit test green while the production path is dead — and here the fallback branch was even asserted as correct behaviour.Recurred — watchdog sweep 2026-10-28 22:17Z, heal run
heal-Matou-coa-1793225857-497210, evidence/tmp/matou-heal-Matou-coa.LsLAdyon matou-dev-server-01. Same signature0ff1caf1b642as the sweep that filed this ticket, four days on, and the bundle again carried zero fault text:job-log.txt— "job log not fetched: no run URL for this incident (mode=watchdog) — nothing was probed"run-verdict.txt,worker-logs.txt,no-local-evidence.txt— all "no local evidence … the failing leg ran on another swarm pool host"watchdog: streak ()Re-confirmed the cause against this bundle's own
runs.json: the 50 rows carry the keyscreated_at, display_title, event, head_branch, head_sha, id, name, run_number, run_started_at, status, updated_at, url, workflow_id—html_urlappears 0 times, sowatchdog_run_url()'s(.html_url // "")is empty for every row and theselect((.url | length) > 0)can never match. The web URL is in.url(e.g.https://git.matou.nz/Matou/coa/actions/runs/22911for task 258000).Confirming the proposed fix works end to end, by hand with the swarm token:
That one line is the whole root cause of this incident (#175). Taking
.html_url // .urlwould have put it in the bundle automatically instead of costing the agent a manual probe round. Note the row's.urlis already the web URL on this instance, not an API URL, so it needs no rewriting before the/jobs/<n>/attempt/1/logssuffix.One caveat for whoever lands it: job index 0 served the log for single-job runs and for the matrix run 22913, where index 1 was the elitebook-03 leg and index 0 the green bens-mac-04 leg — so a matrix still needs the per-leg loop #188 describes, not just index 0.
Labels unchanged (
bug,ready-for-session). Still unfixed, soESCALATE: yeson this sweep too.Recurred again — watchdog sweep 2026-10-29 07:04Z, heal run
heal-Matou-coa-1793257467-443488, evidence/tmp/matou-heal-Matou-coa.ZXuRgUon matou-dev-server-01, signature0ff1caf1b642(the same one that filed this ticket on 2026-10-24 and recurred 2026-10-28). Five days on, the bundle again carried zero fault text: trigger linewatchdog: streak ()with the empty parens, andjob-log.txtreading "job log not fetched: no run URL for this incident (mode=watchdog) — nothing was probed".Re-confirmed the cause live against today's
runs.json(built from/actions/tasks?limit=50&page=1): 0 of 50 rows carryhtml_url, and.urlis already the web URL (https://git.matou.nz/Matou/coa/actions/runs/22975) — sowatchdog_run_url()'s(.html_url // "")echoes empty on every row andcollect_job_logstakes its[ -z "$run_url" ]branch, exactly as this ticket describes.Hand-fetching
.url+/jobs/<leg>/attempt/1/logsreturned the decisive line on the first try for all three failing runs, and additionally proved "sibling green, this leg red" from the logs themselves (🏁 Job succeededon legs 0 and 2,mkdir … no space left on deviceon leg 1) — which is AC2 of #188, currently unreachable in watchdog mode. Diagnosis went to #175.Unchanged recommendation:
(.html_url // .url // "")inwatchdog_run_url(). Not repaired here —.sandcastle/heal-lib.shis off-limits to the healer by charter, and this repo isLANDING=pr, so it needs the reviewed session PR this ticket is already labelledready-for-sessionfor.Recurred again — watchdog sweep 2026-10-29 14:02Z, heal run
heal-Matou-coa-1793282575-1643122, signature0990ca97e6aa, evidence/tmp/matou-heal-Matou-coa.rwdyxw. Same empty trigger line (watchdog: always-red ()), samejob-log.txt"no run URL for this incident (mode=watchdog)",html_urlabsent from all 50runs.jsonrows. Cause unchanged; not re-litigating it.Two things that make the fix smaller than #175's sixth comment suggests:
1. A plain
GETserves the log — no POST body, nologCursors.→
200, plain text, one<ts> <message>line per row, ready to drop straight intojob-log.txt. That is how this sweep got its fault text (3 lines for the dead leg, ~1.7–2.2 KB for the green ones). No web session, no JSON walk oflogs.stepsLog[].lines[].message.2. The job index is NOT the matrix order, and it wraps. On coa run 23023 (matrix
[matou-workstation, elitebook-03, bens-mac-04]):jobs/0→ bens-mac-04 (task 259900),jobs/1→ elitebook-03 (259890),jobs/2→ matou-workstation (259899),jobs/3→ bens-mac-04 again. So out-of-range silently wraps instead of 404ing, and a fix that assumesmatrix index == job indexwill confidently attach the wrong leg's log.collect_job_logsshould walk indices and key the leg on each log's own🧪 Matrix: map[host:...]line (the dead leg has no such line — it dies before it prints, which is itself the signal), or just concatenate all legs with their task ids.Worth noting the blast radius this sweep measured: with the log route dark, seven consecutive watchdog bundles on #175 carried zero fault text, and each one had to rediscover the same three-line ENOSPC by hand.
Close-report (pr-mode) — PR #183 opened; a human merges.
Ruled by agent under ADR 0174 — veto anytime.
Finding: the code fix already landed on
main. By the time this sessionclaimed the ticket (2026-11-02 15:00Z), the fix had merged ~30 min earlier. The
cause this ticket diagnosed is exactly dev-factory #304; it was fixed
factory-side and vendored back to coa
mainby the FACTORY_REF bumpa2dc353→afc0303in PR #179 (merge8aa3836, 2026-11-02 14:31Z).Proof on current
main:.sandcastle/heal-lib.shwatchdog_run_urlnow readsurl: (.html_url // .url // "")(was
(.html_url // "")ata2dc353, commitd9821cc— confirmed bygit show).tests/heal-lib-test.shcarries theurl-only fixture matching the real/actions/tasksrows, keeps the html_url-wins and neither-key→empty assertions (AC1).tests/heal-test.shcarries the watchdog honesty case (noRUN_URL) and the#304 matrix-gap case (AC2).
heal-lib: 26 groups passed,heal.sh: 32 scenarios passed.Why a PR anyway. The ticket's Notes require the machinery fix to land via
re-vendor as
ready-for-session, "never inside a worker PR" — honoured by #179.The one piece the vendor bump cannot carry is the coa-local docs the ticket
flagged, so PR #183 lands exactly that and nothing more:
documented shape, not captured live, keeps a unit test green while the
production path is dead (and here the dead fallback branch was asserted as
correct). Also refines GOTCHAS 3: the job log IS token-reachable at the run's
web route
<run-url>/jobs/<n>/attempt/1/logs.Commit:
de82991. Evidence waiver (no visible UI surface) is in the PR body;the proof is the two green suites above. Leaving the ticket open with PR #183
open per pr-mode — the human's merge closes #174.
Ruled by agent under ADR 0174 — veto anytime.
Ruling: state →
ready-for-session(categorybugunchanged). The ticket carried onlybug— no state role — so it read as untriaged;ready-for-sessionhad been dropped since the 2026-10-28 sweep.The diagnosed code fix already landed on
mainvia theFACTORY_REFre-vendor in PR #179 (merge8aa3836):watchdog_run_urlnow reads(.html_url // .url // ""), both vendored heal suites are green, and the recurrence sweeps stopped. The only residue is PR #183 (closes #174) — the coa-local docs the re-vendor can't carry (GOTCHAS 25 + STATUS) — awaiting a human/session merge. The machinery lineage and the pr-mode open ticket put it with a session, not a swarm worker.Why it's a two-way door: restoring a state label is revertible and touches no credential, posture, or spend — not on the one-way-door list. What proves it:
.sandcastle/heal-lib.shonmaincarries the fix (commitd9821cc), the two green vendored suites, and the open PR #183.Ruled by agent under ADR 0174 — veto anytime.
Ruling: state →
ready-for-human(categorybugunchanged), correcting the priorready-for-sessionruling on this ticket.Why the change.
ready-for-sessionis not terminal here and provably loops. The diagnosed code fix already landed onmainvia theFACTORY_REFre-vendor in PR #179 (merge8aa3836):watchdog_run_urlnow reads(.html_url // .url // "")and both vendored heal suites are green. The only residue is the coa-local docs the re-vendor cannot carry — PR #183 (closes #174, GOTCHAS 25 + STATUS), which is open and green. By design, a pr-mode ticket with an open agent PR is "handed to review": the session runner deletesready-for-sessionand adds nothing (.sandcastle/session-runner.sh:413-415/:660-663, "#302"). Each triage run then re-reads the stateless ticket as untriaged and re-adds the label; the runner drops it ~10 min later (this issue's timeline: added 15:11Z, 15:39Z; removed 15:49Z). Re-adding it would only restart the loop.## Why human. The sole residue is a human's decision to merge PR #183. The code fix is in; PR #183 carries only coa-local docs (
docs/GOTCHAS.mdentry 25,STATUS.md). It is a routine documentation merge no agent lane will take — the swarm lane does not open docs PRs for abugmachinery ticket and the session drainer hands the open PR back to review. Proposed default: merge PR #183 as-is; the substantive fix is already live onmain.Why relabelling is itself a two-way door: a label change, fully revertible, touching no credential, posture, or spend. What proves it:
watchdog_run_urlonmainat commitd9821cc, the two green vendored heal suites, this issue's label-churn timeline, and.sandcastle/session-runner.sh:413-415/:660-663.