sandcastle: HEAL_WORKDIR default is $HOME-relative so the healer hook survives any pool host (#171) #180

Open
matou-build-agent wants to merge 1 commit from agent/issue-171 into main

closes #171

Make the healer hook's HEAL_WORKDIR default $HOME-relative so the
on-failure Investigate failure (healer) step can run on any pool host,
not only one whose runner HOME is /home/dev.

Cause

.sandcastle/swarm-identity.sh:8 defaulted to the absolute
/home/dev/swarm/Matou/coa. heal.sh does mkdir -p "$HEAL_WORKDIR/.sandcastle/.state/healer"
under set -e, so on bens-mac-04 (runner HOME ≠ /home/dev) the healer hook
aborted on its first mkdir — before reading any evidence — emitting one line,
mkdir: cannot create directory '/home/dev': Permission denied. Because the
step's Mattermost fallback ends || true, the step then reported success
and the fault was invisible in the run list (runs 16694/16701/16705,
2026-10-09); it surfaced an hour later as the watchdog's empty
watchdog: streak () from another host. The per-role half of GOTCHAS 2 biting
again — the sibling Matou/idss already used the $HOME-relative form and its
healer ran fine on the same host off the identical underlying fault.

Fix

  • .sandcastle/swarm-identity.sh: default HEAL_WORKDIR to
    $HOME/swarm/Matou/coa (matching Matou/idss); no /home/ literal remains.
  • docs/GOTCHAS.md: new entry 25 — a healer hook that dies in its own mkdir
    is silent by construction (the || true fallback swallows the exit and the
    run looks green), so the hook's own failure must be read from the step log,
    not the step status. GOTCHAS 3 amended with the per-step log endpoint
    (POST …/runs/<n>/jobs/<idx>/attempt/1 + logCursors) used to obtain the
    quoted lines.
  • STATUS.md: header + milestone log updated in the same commit.

Verification

  • grep /home/ .sandcastle/swarm-identity.sh → none (acceptance 1).
  • Under a non-/home/dev HOME, HEAL_WORKDIR resolves to
    <HOME>/swarm/Matou/coa, so heal.sh's mkdir -p succeeds and the hook
    reaches its evidence collector (acceptance 2).
  • bash .sandcastle/tests/swarm-identity-test.sh → 7 groups passed.
  • bash .sandcastle/check-harness-drift.sh → OK (swarm-identity.sh is the
    per-repo layer, not in FACTORY_MANIFEST).

Scope / residue

  • swarm-identity.sh is per-repo but the same bug is factory-side; the next
    .sandcastle re-vendor must carry this fix back deliberately (ticket note).
  • The underlying DNS fault on bens-mac-04 is a separate host issue, out of
    scope — this change is only about the healer being able to report it.

Two-way door (revertible one-line config, provable by the identity + heal
seams) — ruled by agent under ADR 0002, veto anytime.

Screenshots: none — harness/machinery fix with no visible UI surface; proven by the shell seams above.

closes #171 Make the healer hook's `HEAL_WORKDIR` default `$HOME`-relative so the on-failure `Investigate failure (healer)` step can run on any pool host, not only one whose runner HOME is `/home/dev`. ## Cause `.sandcastle/swarm-identity.sh:8` defaulted to the absolute `/home/dev/swarm/Matou/coa`. `heal.sh` does `mkdir -p "$HEAL_WORKDIR/.sandcastle/.state/healer"` under `set -e`, so on `bens-mac-04` (runner HOME ≠ `/home/dev`) the healer hook aborted on its first `mkdir` — before reading any evidence — emitting one line, `mkdir: cannot create directory '/home/dev': Permission denied`. Because the step's Mattermost fallback ends `|| true`, the step then reported **success** and the fault was invisible in the run list (runs 16694/16701/16705, 2026-10-09); it surfaced an hour later as the watchdog's empty `watchdog: streak ()` from another host. The per-role half of GOTCHAS 2 biting again — the sibling `Matou/idss` already used the `$HOME`-relative form and its healer ran fine on the same host off the identical underlying fault. ## Fix - `.sandcastle/swarm-identity.sh`: default `HEAL_WORKDIR` to `$HOME/swarm/Matou/coa` (matching `Matou/idss`); no `/home/` literal remains. - `docs/GOTCHAS.md`: new entry 25 — a healer hook that dies in its own `mkdir` is silent by construction (the `|| true` fallback swallows the exit and the run looks green), so the hook's own failure must be read from the step log, not the step status. GOTCHAS 3 amended with the per-step log endpoint (`POST …/runs/<n>/jobs/<idx>/attempt/1` + `logCursors`) used to obtain the quoted lines. - `STATUS.md`: header + milestone log updated in the same commit. ## Verification - `grep /home/ .sandcastle/swarm-identity.sh` → none (acceptance 1). - Under a non-`/home/dev` HOME, `HEAL_WORKDIR` resolves to `<HOME>/swarm/Matou/coa`, so `heal.sh`'s `mkdir -p` succeeds and the hook reaches its evidence collector (acceptance 2). - `bash .sandcastle/tests/swarm-identity-test.sh` → 7 groups passed. - `bash .sandcastle/check-harness-drift.sh` → OK (`swarm-identity.sh` is the per-repo layer, not in `FACTORY_MANIFEST`). ## Scope / residue - `swarm-identity.sh` is per-repo but the same bug is factory-side; the next `.sandcastle` re-vendor must carry this fix back deliberately (ticket note). - The underlying DNS fault on `bens-mac-04` is a separate host issue, out of scope — this change is only about the healer being able to *report* it. Two-way door (revertible one-line config, provable by the identity + heal seams) — ruled by agent under ADR 0002, veto anytime. **Screenshots:** none — harness/machinery fix with no visible UI surface; proven by the shell seams above.
The on-failure healer step aborted in mkdir before diagnosing on any host
whose runner HOME is not /home/dev; the || true fallback then reported the
step green. Default HEAL_WORKDIR to $HOME/swarm/Matou/coa (matching
Matou/idss). GOTCHAS 25 (silent mkdir death) + GOTCHAS 3 amendment (per-step
log endpoint). STATUS.md header + log updated.

Advances #171.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Factory-Account: d631bd58e1e9
All checks were successful
ci / seam (pull_request) Successful in 38s
This pull request has changes conflicting with the target branch.
  • STATUS.md
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin agent/issue-171:agent/issue-171
git switch agent/issue-171

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch main
git merge --no-ff agent/issue-171
git switch agent/issue-171
git rebase main
git switch main
git merge --ff-only agent/issue-171
git switch agent/issue-171
git rebase main
git switch main
git merge --no-ff agent/issue-171
git switch main
git merge --squash agent/issue-171
git switch main
git merge --ff-only agent/issue-171
git switch main
git merge agent/issue-171
git push origin main
Sign in to join this conversation.
No reviewers
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/coa!180
No description provided.