rehearsal healer hard-resets the shared swarm checkout — give it a dedicated clone (session-runner pattern) #576
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#576
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?
Bug — rehearsal healer hard-resets the SHARED swarm checkout
rehearsal-report.sh:25pointsREHEARSAL_CHECKOUTat/home/dev/swarm/Matou/ourcloud— the same checkout peer sessions work in (unpushed peer work has lived there before).rehearsal-heal-lib.shrunsgit reset --hardthere on five separate paths; the only guard is a dirty-tree refusal atrehearsal-report.sh:98— a TOCTOU check with no lock.session-runner.sh:134-141already ruled the opposite way for exactly this reason ("NEVER the shared swarm checkout — peers work there") and uses a dedicated clone. The healer predates that lesson.Fix
Give the rehearsal healer its own dedicated clone (mirror the session-runner pattern: separate directory, fresh reset each heal, push through the same verified-push rails).
REHEARSAL_CHECKOUTdefault moves off the shared path.Two-way door; agent-shaped — the healer's own rails (
rehearsal-heal-lib.shcaps + verified push) are untouched. Filed ready-for-human per Ben's instruction — re-arm at will.Blocked — this fix is entirely a protected
.sandcastle/change (needs a session, not a swarm worker)The whole deliverable lives inside protected paths:
.sandcastle/rehearsal-report.sh(theREHEARSAL_CHECKOUTdefault at line 25).sandcastle/rehearsal-heal-lib.sh(thegit reset --hardrails).sandcastle/is a fingerprinted protected directory (protected-paths-lib.sh,PP_PROTECTED_DIRS_DEFAULT=".sandcastle .forgejo", #445). A swarm worker that edits any file there has the change rolled back and the run failed loud — the boundary is an outcome check, not a blocklist, so there is no way for me to ship this fix. The healer scripts are not in the exempt set (PP_EXEMPT_GLOBSonly covers the*matou-heal-*evidence dirs, not the machinery itself).Why session (ADR 0174)
Per
docs/agents/triage-labels.mdand the verbatim escape path inprotected-paths-lib.sh: a protected.sandcastle/path per #445 needs an interactive agent session's standing, not Ben —ready-for-session, notready-for-agent. The queue (list-ready-tasks.sh) reads onlyready-for-agent, so this was mislabeled and is invisible-by-design to workers otherwise.The fix itself is well-scoped and sound (mirror
session-runner.sh:134-141: dedicated clone off the shared/home/dev/swarm/Matou/ourcloudpath, fresh reset per heal, same verified-push rails). It just has to be executed by a session, which has the standing to touch.sandcastle/.Swapping
ready-for-agent→ready-for-sessionand releasing the swarm claim.Ruled by agent under ADR 0174 — veto anytime.
Ruling: two-way door. This is a commit/config change (default
REHEARSAL_CHECKOUTvalue + the checkout-bootstrap logic intry_heal()), fully revertible bygit revert, and provable by the two offline test suites plus a live probe — none of it touches a one-way door (no credential, no security-posture widening, no member-facing trust surface, no data destruction).What landed (commit
dced853):REHEARSAL_CHECKOUTno longer defaults to/home/dev/swarm/Matou/ourcloud(the shared swarm checkout peer sessions work in). It now defaults to$HOME/rehearsal-heal/ourcloud— a dedicated clone, mirroringsession-runner.sh's own pattern. NewREHEARSAL_HEAL_REPOnames the clone source.try_heal()clones on first use, then doesfetch+reset --hard origin/main+clean -fdbefore every heal attempt (not just once) — same shape assession-runner.sh:135-141. This replaces the old dirty-tree TOCTOU refusal: on a dedicated checkout there's no peer left to race, and a self-reset means a session killed mid-run (thetimeout 1800around the claude call has no cleanup trap) self-heals on the next attempt instead of wedging the healer forever.heal_rails/heal_push(caps, single-commit rule, self-mod guard, verified push with rebase-retry) are untouched, per the ticket's ask.Proof:
bash .sandcastle/tests/rehearsal-healer-test.sh— 12 cases green. Case 12 (the rebase-conflict path) was rewritten to race the origin push during the simulated heal session (via the claude shim, using a throwaway clone) rather than before it starts, since the checkout is now always caught up toorigin/mainbefore the healer session begins — the race window moved to exactly whereheal_push's own fetch+rebase-before-push already lives, and the test now exercises that.bash .sandcastle/tests/rehearsal-report-test.sh— 25 cases green (updated to point the clone source at a nonexistent local path for the legacy no-checkout cases, keeping the suite hermetic/network-free).git clone https://git.matou.nz/Matou/ourcloud.git ~/rehearsal-heal/ourcloud(using the host's stored credential helper, no token embedded) succeeded, and a follow-upfetch+reset --hard origin/main+clean -fdagainst it also succeeded — the exact sequencetry_heal()runs, proven against the real remote, not just shimmed.Closing.