healer: job_ran_here() is repo-scoped, not run-scoped — a fresh swarm lock on the healer host makes every elitebook-03-pinned red report as a local pre-Sandcastle fault (regression of #2048) #2079

Open
opened 2026-10-28 23:07:12 +00:00 by matou-build-agent · 3 comments

Filed by the healer (heal-Matou-idss-1793228556-722259, watchdog pass of 2026-10-28 23:02 UTC, signature ef220fc58024, workflow release-publish, evidence /tmp/matou-heal-Matou-idss.sOm6xl on matou-dev-server-01, swarm lock free). The fault is in .sandcastle/heal.sh, which the heal charter forbids me to modify — hence a ticket. Protected path (.sandcastle/), so ready-for-human.

This is a regression of the fix that closed #2048. That fix taught the healer not to blame another pool host when local evidence says the job ran here. The predicate it added is repo-scoped, not workflow- or task-scoped, so it now fires for any recent job of this repo on this host and the healer is told the opposite of the truth.

What happened this pass

The watchdog keyed on release-publish always-red. release-publish is pinned runs-on: elitebook-03 and every failing tick ran there (runner 7e46ef4a, tasks 258067/258101/258103/258104) — the real fault is #2076, elitebook-03's disk full. But heal.sh wrote this into run-verdict.txt, worker-logs.txt and no-local-evidence.txt, the three files the charter names as ground truth to read FIRST:

no worker log or fresh verdict for run watchdog in the last 2 hours, but local evidence (workdir lock / runner journal) shows THIS repo's job ran on this host — the fault was in the job BEFORE Sandcastle span, outside the verdict seam, NOT a leg on another pool host (healer-host: matou-dev-server-01)

Every clause after "but" is false for the run under investigation. The investigation is pointed at a pre-Sandcastle span on matou-dev-server-01 that does not exist.

Root cause — heal.sh:209

job_ran_here() {
  [ -n "$(find "$HEAL_WORKDIR_LOCK" -newermt "-$RUN_WINDOW" 2>/dev/null)" ] && return 0
  local slug="${FORGEJO_API##*/repos/}"
  [ -f "$EVIDENCE/runner-journal.txt" ] && [ -n "$slug" ] \
    && grep -qiE "repo is ($slug|$REPO_TAG)\b" "$EVIDENCE/runner-journal.txt" 2>/dev/null && return 0
  return 1
}

Both legs answer "did ANY Matou/idss job touch this host in the last 2 h?", never "did THIS run's job land here?":

  • Lock leg (the one that fired). /tmp/matou-workdir-Matou-idss.lock mtime was 22:45:55Z — the swarm leg (task 258082), 12 min before the 23:02 heal. One shared per-repo lock, so a green swarm tick on this host vouches for a red release-publish tick on another.
  • Journal leg. runner-journal.txt has 10 repo is Matou/idss lines (257901 … 258110) and none of them is a release-publish task. The grep cannot tell, because the journal line carries only the repo, not the workflow.

So on any multi-host repo the predicate is ~always true, and the else branch (#135's honest "ran on another pool host") is effectively dead whenever the healer host also runs swarm.

Why it matters

release-publish and reseed-publish are pinned to elitebook-03 and the healer never runs there, so every red on those two rails gets this inverted verdict. It cost this pass real work and would have produced a wrong diagnosis without the run's own job log. Combined with #2045 (one wedged host bills one investigation per workflow name), a single dark host now bills repeated Opus passes and each one is handed a misdirection.

Suggested fix

Scope the predicate to the run under investigation instead of the repo:

  • Carry the task/run id into the journal match — the runner logs received task <id> of job <name>, which pins both workflow and host. The healer already knows run_number, and POST /Matou/idss/actions/runs/<n>/jobs/0/attempt/1 returns the task id and the runner uuid.
  • Or compare the run's runner against this host's own runner uuid and let locality fall out of that.
  • Failing both, make the message conditional rather than assertive ("no local artefacts; this repo ran other jobs here, so locality is undetermined") so the ground-truth file never states a locality it has not established. A hedge the agent can test beats a false certainty it cannot.

Worth a unit test in .sandcastle/tests/ pinning the shape: fresh workdir lock + journal with a different workflow's task ⇒ not job_ran_here.

Filed by the healer (`heal-Matou-idss-1793228556-722259`, watchdog pass of 2026-10-28 23:02 UTC, signature `ef220fc58024`, workflow `release-publish`, evidence `/tmp/matou-heal-Matou-idss.sOm6xl` on `matou-dev-server-01`, swarm lock `free`). The fault is in `.sandcastle/heal.sh`, which the heal charter forbids me to modify — hence a ticket. Protected path (`.sandcastle/`), so `ready-for-human`. This is a regression of the fix that closed #2048. That fix taught the healer not to blame another pool host when local evidence says the job ran here. The predicate it added is **repo-scoped, not workflow- or task-scoped**, so it now fires for *any* recent job of this repo on this host and the healer is told the opposite of the truth. ## What happened this pass The watchdog keyed on `release-publish` always-red. `release-publish` is pinned `runs-on: elitebook-03` and every failing tick ran there (runner `7e46ef4a`, tasks 258067/258101/258103/258104) — the real fault is #2076, `elitebook-03`'s disk full. But `heal.sh` wrote this into `run-verdict.txt`, `worker-logs.txt` and `no-local-evidence.txt`, the three files the charter names as ground truth to read FIRST: > no worker log or fresh verdict for run watchdog in the last 2 hours, but local evidence (workdir lock / runner journal) shows THIS repo's job ran on this host — the fault was in the job BEFORE Sandcastle span, outside the verdict seam, **NOT a leg on another pool host** (healer-host: matou-dev-server-01) Every clause after "but" is false for the run under investigation. The investigation is pointed at a pre-Sandcastle span on `matou-dev-server-01` that does not exist. ## Root cause — `heal.sh:209` ```sh job_ran_here() { [ -n "$(find "$HEAL_WORKDIR_LOCK" -newermt "-$RUN_WINDOW" 2>/dev/null)" ] && return 0 local slug="${FORGEJO_API##*/repos/}" [ -f "$EVIDENCE/runner-journal.txt" ] && [ -n "$slug" ] \ && grep -qiE "repo is ($slug|$REPO_TAG)\b" "$EVIDENCE/runner-journal.txt" 2>/dev/null && return 0 return 1 } ``` Both legs answer "did ANY `Matou/idss` job touch this host in the last 2 h?", never "did THIS run's job land here?": - **Lock leg (the one that fired).** `/tmp/matou-workdir-Matou-idss.lock` mtime was `22:45:55Z` — the `swarm` leg (task 258082), 12 min before the 23:02 heal. One shared per-repo lock, so a green `swarm` tick on this host vouches for a red `release-publish` tick on another. - **Journal leg.** `runner-journal.txt` has 10 `repo is Matou/idss` lines (257901 … 258110) and **none** of them is a `release-publish` task. The grep cannot tell, because the journal line carries only the repo, not the workflow. So on any multi-host repo the predicate is ~always true, and the `else` branch (#135's honest "ran on another pool host") is effectively dead whenever the healer host also runs `swarm`. ## Why it matters `release-publish` and `reseed-publish` are pinned to `elitebook-03` and the healer never runs there, so **every** red on those two rails gets this inverted verdict. It cost this pass real work and would have produced a wrong diagnosis without the run's own job log. Combined with #2045 (one wedged host bills one investigation per workflow name), a single dark host now bills repeated Opus passes and each one is handed a misdirection. ## Suggested fix Scope the predicate to the run under investigation instead of the repo: - Carry the task/run id into the journal match — the runner logs `received task <id> of job <name>`, which pins both workflow and host. The healer already knows `run_number`, and `POST /Matou/idss/actions/runs/<n>/jobs/0/attempt/1` returns the task id and the runner uuid. - Or compare the run's runner against this host's own runner uuid and let locality fall out of that. - Failing both, make the message *conditional* rather than assertive ("no local artefacts; this repo ran other jobs here, so locality is undetermined") so the ground-truth file never states a locality it has not established. A hedge the agent can test beats a false certainty it cannot. Worth a unit test in `.sandcastle/tests/` pinning the shape: fresh workdir lock + journal with a different workflow's task ⇒ not `job_ran_here`.
Author
Member

Live instance 10 days on, and the pool-busy case makes the predicate fire unconditionally. Watchdog pass of 2026-11-07 12:02 UTC (heal-Matou-idss-1794052978-1200740, signature 50dc0fb56753, workflow triage, evidence /tmp/matou-heal-Matou-idss.1mm7dY on matou-dev-server-01, swarm lock free). Still unfixed, still in .sandcastle/heal.sh which the charter forbids me to edit — no repair, just this datapoint.

This pass keyed on triage run 61694 / task 281778, whose own job log is unambiguous:

2026-11-07T11:35:43.8208753Z Runner 73a6cc98-3960-4a27-ac53-0c3890c73887 (version:v12.13.1) received task 281778 of job triage, triggered by event: schedule
2026-11-07T11:35:43.8255787Z workflow prepared
2026-11-07T11:35:43.8258290Z mkdir /home/swarm/.cache/act/6e419dac0f53b5f1: no space left on device

That is #2174 on bens-mac-04 — runner 73a6cc98, runner home /home/swarm. This host's runner home is /home/dev and /home/swarm does not exist here at all. heal.sh nevertheless wrote the local claim into all three ground-truth files:

… but local evidence (workdir lock / runner journal) shows THIS repo's job ran on this host — the fault was in the job BEFORE Sandcastle span, outside the verdict seam, NOT a leg on another pool host

The pool-busy case is worse than the filing describes

The filing frames it as "a fresh swarm lock on the healer host" tipping the predicate. But the second signal — grep -qiE "repo is ($slug|$REPO_TAG)\b" over runner-journal.txt (heal.sh:318) — is enough on its own whenever this host ran any Matou/idss task in the 2-hour window. In this bundle's journal that is five of them:

11:15:53 task 281758 repo is Matou/idss   ← matou-workstation leg, success
11:24:49 task 281771 repo is Matou/idss
11:39:51 task 281787 repo is Matou/idss
11:45:44 task 281804 repo is Matou/idss
11:55:05 task 281819 repo is Matou/idss

Task 281778 — the one under investigation — is absent (281779/281781/281782 are present; it was never offered to this runner). So on a healthy, busy pool host the predicate returns true for every remote-leg incident, regardless of the lock. The journal line it greps already carries task <id>, so scoping the grep to the run's own task id rather than the repo slug would be an exact fix for this half.

A cheap discriminator while that lands

In this bundle, run duration separates the two hosts perfectly: a pre-step ENOSPC death on bens-mac-04 is 2–8s (22 of them), real work on this host is 34–265s (9 of them), with no overlap. A leg that died in under ~10s cannot have reached git-setup.sh, let alone a pre-Sandcastle span — so it cannot be the "#2048 shape" the local claim asserts, whatever the journal says.

**Live instance 10 days on, and the pool-busy case makes the predicate fire unconditionally.** Watchdog pass of 2026-11-07 12:02 UTC (`heal-Matou-idss-1794052978-1200740`, signature `50dc0fb56753`, workflow `triage`, evidence `/tmp/matou-heal-Matou-idss.1mm7dY` on `matou-dev-server-01`, swarm lock `free`). Still unfixed, still in `.sandcastle/heal.sh` which the charter forbids me to edit — no repair, just this datapoint. This pass keyed on `triage` run 61694 / task **281778**, whose own job log is unambiguous: ``` 2026-11-07T11:35:43.8208753Z Runner 73a6cc98-3960-4a27-ac53-0c3890c73887 (version:v12.13.1) received task 281778 of job triage, triggered by event: schedule 2026-11-07T11:35:43.8255787Z workflow prepared 2026-11-07T11:35:43.8258290Z mkdir /home/swarm/.cache/act/6e419dac0f53b5f1: no space left on device ``` That is #2174 on bens-mac-04 — runner `73a6cc98`, runner home `/home/swarm`. This host's runner home is `/home/dev` and **`/home/swarm` does not exist here at all**. `heal.sh` nevertheless wrote the local claim into all three ground-truth files: > … but local evidence (workdir lock / runner journal) shows THIS repo's job ran on this host — the fault was in the job BEFORE Sandcastle span, outside the verdict seam, **NOT a leg on another pool host** ## The pool-busy case is worse than the filing describes The filing frames it as "a fresh swarm lock on the healer host" tipping the predicate. But the **second** signal — `grep -qiE "repo is ($slug|$REPO_TAG)\b"` over `runner-journal.txt` (`heal.sh:318`) — is enough on its own whenever this host ran *any* `Matou/idss` task in the 2-hour window. In this bundle's journal that is five of them: ``` 11:15:53 task 281758 repo is Matou/idss ← matou-workstation leg, success 11:24:49 task 281771 repo is Matou/idss 11:39:51 task 281787 repo is Matou/idss 11:45:44 task 281804 repo is Matou/idss 11:55:05 task 281819 repo is Matou/idss ``` **Task 281778 — the one under investigation — is absent** (281779/281781/281782 are present; it was never offered to this runner). So on a healthy, busy pool host the predicate returns true for *every* remote-leg incident, regardless of the lock. The journal line it greps already carries `task <id>`, so scoping the grep to the run's own task id rather than the repo slug would be an exact fix for this half. ## A cheap discriminator while that lands In this bundle, run **duration** separates the two hosts perfectly: a pre-step ENOSPC death on bens-mac-04 is **2–8s** (22 of them), real work on this host is **34–265s** (9 of them), with no overlap. A leg that died in under ~10s cannot have reached `git-setup.sh`, let alone a pre-Sandcastle span — so it cannot be the "#2048 shape" the local claim asserts, whatever the journal says.
Author
Member

Fired again — and this pass found a one-command disproof the fix could key on. Watchdog pass of 2026-11-07 17:03 UTC (heal-Matou-idss-1794071174-2666054, signature e2c0a0a76977, workflow resume-asks, evidence /tmp/matou-heal-Matou-idss.XoNrfT on matou-dev-server-01, swarm lock free). Still unfixed, still in .sandcastle/heal.sh which the charter forbids me to edit — no repair, just this datapoint.

The real fault was #2174 (bens-mac-04 ENOSPC at workflow prepared, run 61813/task 282316). heal.sh:406 wrote the opposite into all three ground-truth files:

… local evidence (workdir lock / runner journal) shows THIS repo's job ran on this host — the fault was in the job BEFORE Sandcastle span, outside the verdict seam, NOT a leg on another pool host

job_ran_here (heal.sh:311) is unconditionally true on this host: the swarm matrix pins an idss leg here every ~7 min, so grep "repo is Matou/idss" over runner-journal.txt always hits. Confirmed in this bundle — the journal shows idss tasks 282283/282292/282301/282338/282344/282354 inside the window, none of them run 61813.

The cheap run-scoped signals, both already in the bundle or one command away:

  1. job-log.txt line 1 names the runner UUID that actually took the task — 73a6cc98-3960-4a27-ac53-0c3890c73887. This host's .runner is 4ff4a71f-283a-41d7-8063-3bd52f91f633 (name matou-workstation). A UUID mismatch is proof the leg ran elsewhere, and it needs no journal heuristic at all.
  2. The ENOSPC path is /home/swarm/.cache/act/…, i.e. $HOME=/home/swarm. On this host getent passwd swarm exits 2 — there is no swarm user, /home/ holds only dev and restic-bkp, and the runner unit is User=dev / WorkingDirectory=/home/dev/forgejo-runner. A path under a nonexistent local home cannot be a local fault.

Either check would have flipped this pass. (1) is strictly better: it is run-scoped by construction, where the journal grep is only ever repo-scoped.

Unrelated minor in the same bundle: job-log.txt carries 20 identical blocks, job 0 … job 19, all showing the same single task 282316 — the per-leg fetch loops a fixed leg count over a single-job workflow. Harmless, but it pads the bundle ~20x and reads at a glance like a 20-leg matrix.

**Fired again — and this pass found a one-command disproof the fix could key on.** Watchdog pass of 2026-11-07 17:03 UTC (`heal-Matou-idss-1794071174-2666054`, signature `e2c0a0a76977`, workflow `resume-asks`, evidence `/tmp/matou-heal-Matou-idss.XoNrfT` on `matou-dev-server-01`, swarm lock `free`). Still unfixed, still in `.sandcastle/heal.sh` which the charter forbids me to edit — **no repair**, just this datapoint. The real fault was #2174 (bens-mac-04 ENOSPC at `workflow prepared`, run 61813/task 282316). `heal.sh:406` wrote the opposite into all three ground-truth files: > … local evidence (workdir lock / runner journal) shows THIS repo's job ran on this host — the fault was in the job BEFORE Sandcastle span, outside the verdict seam, **NOT a leg on another pool host** `job_ran_here` (heal.sh:311) is unconditionally true on this host: the swarm matrix pins an `idss` leg here every ~7 min, so `grep "repo is Matou/idss"` over `runner-journal.txt` always hits. Confirmed in this bundle — the journal shows idss tasks 282283/282292/282301/282338/282344/282354 inside the window, **none of them run 61813**. **The cheap run-scoped signals, both already in the bundle or one command away:** 1. `job-log.txt` line 1 names the runner UUID that actually took the task — `73a6cc98-3960-4a27-ac53-0c3890c73887`. This host's `.runner` is `4ff4a71f-283a-41d7-8063-3bd52f91f633` (name `matou-workstation`). A UUID mismatch is proof the leg ran elsewhere, and it needs no journal heuristic at all. 2. The ENOSPC path is `/home/swarm/.cache/act/…`, i.e. `$HOME=/home/swarm`. On this host `getent passwd swarm` exits 2 — **there is no `swarm` user**, `/home/` holds only `dev` and `restic-bkp`, and the runner unit is `User=dev` / `WorkingDirectory=/home/dev/forgejo-runner`. A path under a nonexistent local home cannot be a local fault. Either check would have flipped this pass. (1) is strictly better: it is run-scoped by construction, where the journal grep is only ever repo-scoped. Unrelated minor in the same bundle: `job-log.txt` carries 20 identical blocks, `job 0` … `job 19`, all showing the same single task 282316 — the per-leg fetch loops a fixed leg count over a single-job workflow. Harmless, but it pads the bundle ~20x and reads at a glance like a 20-leg matrix.
Author
Member

Third witnessed instance, this time with the pool host proven to be a different
machine — watchdog pass heal-Matou-idss-1794178165-1106924 (signature
41b6590dc14b, workflow triage, evidence /tmp/matou-heal-Matou-idss.NjySHN
on matou-dev-server-01, swarm lock free, so the lock-mtime arm was not
the one that fired).

run-verdict.txt, worker-logs.txt and no-local-evidence.txt all read:

no worker log or fresh verdict for run watchdog in the last 2 hours, but local
evidence (workdir lock / runner journal) shows THIS repo's job ran on this host
— the fault was in the job BEFORE Sandcastle span, outside the verdict seam,
NOT a leg on another pool host

Every clause after the comma is wrong. The failing run (62391, task 285264) died
at workflow prepared with mkdir /home/swarm/.cache/act/15a55bf87b52f9a8: no space left on device on runner 73a6cc98-3960-4a27-ac53-0c3890c73887 — i.e.
bens-mac-04 (#2174). Disproof from the bundle itself:

  • runner-journal.txt has no task 285264 at all; it jumps 285261 → 285269.
  • It also never names runner 73a6cc98… (grep -c → 0). This host's runner is
    4ff4a71f-283a-41d7-8063-3bd52f91f633, name: matou-workstation, labels
    matou-workstation:host + swarm:host, HOME=/home/dev.
  • /home/swarm does not exist on this host, and there is no swarm user —
    ls -1 /home/ is dev, restic-bkp.

The reason the predicate still fired with a free lock is the second arm,
heal.sh:314:

grep -qiE "repo is ($slug|$REPO_TAG)\b" "$EVIDENCE/runner-journal.txt"

matou-workstation is the healthy pool host, so it takes a Matou/idss task
roughly every four minutes — 10 such lines in this 24-minute journal, none of
them the failing task. Over a 2-hour RUN_WINDOW the grep is therefore
unconditionally true on any busy host, which makes the cross-host branch
(heal.sh:408) effectively dead code on exactly the hosts that gather bundles.
Repo-scope is not the only gap: the predicate needs the run's own task id (the
journal prints it) or the runner uuid, both of which are already in
job-log.txt's first line.

Flagging because the cost is not cosmetic — the bundle's three highest-trust
files actively assert the opposite of ground truth, and a diagnosis agent that
believes them starts hunting a local pre-Sandcastle fault on a host that never
saw the job. I did not touch heal.sh (healer charter forbids it).

Third witnessed instance, this time with the pool host proven to be a *different* machine — watchdog pass `heal-Matou-idss-1794178165-1106924` (signature `41b6590dc14b`, workflow `triage`, evidence `/tmp/matou-heal-Matou-idss.NjySHN` on `matou-dev-server-01`, swarm lock **`free`**, so the lock-mtime arm was not the one that fired). `run-verdict.txt`, `worker-logs.txt` and `no-local-evidence.txt` all read: > no worker log or fresh verdict for run watchdog in the last 2 hours, but local > evidence (workdir lock / runner journal) shows THIS repo's job ran on this host > — the fault was in the job BEFORE Sandcastle span, outside the verdict seam, > NOT a leg on another pool host Every clause after the comma is wrong. The failing run (62391, task 285264) died at `workflow prepared` with `mkdir /home/swarm/.cache/act/15a55bf87b52f9a8: no space left on device` on runner `73a6cc98-3960-4a27-ac53-0c3890c73887` — i.e. `bens-mac-04` (#2174). Disproof from the bundle itself: - `runner-journal.txt` has no task 285264 at all; it jumps 285261 → 285269. - It also never names runner `73a6cc98…` (`grep -c` → 0). This host's runner is `4ff4a71f-283a-41d7-8063-3bd52f91f633`, `name: matou-workstation`, labels `matou-workstation:host` + `swarm:host`, `HOME=/home/dev`. - `/home/swarm` does not exist on this host, and there is no `swarm` user — `ls -1 /home/` is `dev`, `restic-bkp`. The reason the predicate still fired with a free lock is the second arm, `heal.sh:314`: ```bash grep -qiE "repo is ($slug|$REPO_TAG)\b" "$EVIDENCE/runner-journal.txt" ``` `matou-workstation` is the healthy pool host, so it takes a `Matou/idss` task roughly every four minutes — 10 such lines in this 24-minute journal, none of them the failing task. Over a 2-hour `RUN_WINDOW` the grep is therefore unconditionally true on *any* busy host, which makes the cross-host branch (`heal.sh:408`) effectively dead code on exactly the hosts that gather bundles. Repo-scope is not the only gap: the predicate needs the run's own task id (the journal prints it) or the runner uuid, both of which are already in `job-log.txt`'s first line. Flagging because the cost is not cosmetic — the bundle's three highest-trust files actively assert the opposite of ground truth, and a diagnosis agent that believes them starts hunting a local pre-Sandcastle fault on a host that never saw the job. I did not touch `heal.sh` (healer charter forbids it).
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/idss#2079
No description provided.