rehearsal healer: rebase before push so heals survive a moved origin/main (3 heals lost to non-fast-forward) #460
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#460
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?
Problem
The rehearsal healer diagnoses and fixes reds correctly, commits locally, and
pushes — but when anything else advances
origin/mainbetween the healer's baseand its push, the push is rejected non-fast-forward and the fix never lands.
The script-side rail correctly catches the missing-on-origin commit and falls
through to filing, so the invariant holds and no fake-heal ships — but the healer
is effectively neutered to diagnosis-only whenever there is concurrent push
activity (an operator sitting on the harness, or the swarm draining tickets).
Every "heal" then becomes a filed ticket + a full swarm round-trip anyway, which
is exactly the latency the healer was built to avoid.
Evidence — three consecutive drives, three lost heals (2026-08-11/12)
20260811T221125ZserverSettingsrename)healer-claude.err)20260811T232725Z235c30f9origin/main20260812T000306Zst.Nodevsst.ClanNode)d68e840origin/mainIn each case the diagnosis was right and later re-implemented verbatim by the
swarm from the filed ticket. The only thing that failed was landing the push
while
origin/mainmoved underneath (e.g.#447/a234766landing on top of the#451base the healer had branched from).Note: this is distinct from the healer's judgment declines (e.g. #458), which
are correct and out of scope here — those are
action:"file"by design. Thisticket is only about heals the healer committed and lost to the race.
Fix
Make the healer's push survive a moved
origin/mainby rebasing immediatelybefore pushing, inside the existing
heal_railsin.sandcastle/rehearsal-heal-lib.sh(after the diff-cap/self-mod checks, beforethe final push +
git ls-remoteverification):git fetch origin maingit rebase origin/main(orgit pull --rebase origin main).git rebase --abort,git reset --hardto thepre-session head, and fall through to filing (a conflicting fix is no longer
"small and certain"). This preserves the existing invariant.
git diff --stat origin/main..HEAD):a clean rebase can only shrink or preserve the healer's own diff, but re-check
so a surprising rebase result still trips the cap → reset + file.
git ls-remoteverification that the healed commit isactually on
origin/mainbefore treating the red as healed.(another push landed during our rebase); a second failure → reset + file, so
this never spins.
The self-modification guard still applies unchanged: the rebased diff must not
touch
^\.sandcastle/rehearsal-or^\.forgejo/workflows/.Test
Extend the reporter's offline harness (fake run dir, stubbed
claude, stubbedgit remote): a case where
origin/mainadvances by one unrelated commit betweenthe healer's base and its push. Assert the heal now lands (commit present on
the fake origin,
#378commented, drive left armed) instead of falling tofiling. Keep the existing conflict case asserting reset + file.
Out of scope
re-running the cap post-rebase.
Relates to the rehearsal healer design
(
docs/superpowers/specs/2026-08-10-rehearsal-healer-design.md) and the standingdrive issue #378. Discovered while watching the own-VPS control-plane arc
(#443 → #457 → #458).
Triage:
bug/ready-for-agent. Verified: the three cited healer commits(
235c30f9,d68e840, and the third from20260811T221125Z) exist as looseobjects in the repo but are not ancestors of
main— confirmed withgit merge-base --is-ancestor. The three drive timestamps in the evidencetable line up with the
created_atof the filed tickets (#451, #456, #457).No existing fetch/rebase step exists in the healer's push path today, so
this isn't already implemented. No
.out-of-scope/entry matches thisrequest.
One correction to the issue text: step 4 of the Fix section says to "keep
the existing
git ls-remoteverification" — that verification is describedin the design spec but was never actually implemented; the current push
step only checks the
git pushexit code. See "Out of scope" below.Agent Brief
Category: bug
Summary: The healer's push step doesn't survive a moved
origin/main—correct heals are lost to non-fast-forward pushes instead of landing.
Current behavior:
The healer validates its local commit (single commit, diff-cap, no
self-modification) and then pushes it directly to
origin/main. If anothercommit lands on
origin/mainafter the healer's session started (anoperator on the harness, or the swarm draining tickets concurrently), the
push is rejected non-fast-forward. The local commit is then reverted and the
drive falls through to the filing flow — a correct diagnosis is discarded
and has to be independently re-diagnosed and re-implemented via a full
ticket + swarm round-trip, which is exactly the latency the healer exists to
avoid.
Desired behavior:
Before pushing, fetch
origin/mainand rebase the healer's commit onto it.On a clean rebase, re-run the existing diff-cap check (≤3 files, ≤60 changed
lines) against the rebased diff before pushing — a clean rebase can only
shrink or preserve the original diff, but a surprising rebase result should
still trip the cap. The self-modification guard (never touching the
healer's own harness/workflow paths) must also be re-checked against the
post-rebase diff. Then push:
armed).
and fall through to the existing filing path unchanged — a conflicting
fix is no longer "small and certain."
retry the fetch→rebase→push cycle exactly once more; a second failure
falls through to filing rather than retrying indefinitely.
Key interfaces:
heal_railsinthe healer's rails library) — needs to be re-runnable against a diff range
that reflects the post-rebase commit, not just the original one.
step inserted before the push, with the bounded (one) retry on
non-fast-forward described above.
claude,stubbed git remote) — needs a way to simulate
origin/mainadvancingbetween the healer's base and its push.
Acceptance criteria:
base relative to
origin/mainis rebased onto latestorigin/mainbefore pushing, and the push succeeds when the rebase is clean.
re-evaluated against the rebased diff; a cap breach post-rebase
reverts and falls to filing exactly as a pre-rebase breach does today.
diff.
the existing filing path, leaving no partial/conflicted state.
origin/mainmoves again during the rebase, thefetch→rebase→push sequence is retried exactly once; a second failure
falls through to filing.
origin/mainadvancing by oneunrelated commit between the healer's base and its push → the heal
now lands (rebased commit present on the fake origin, drive left
armed) instead of falling to filing, and (b) the existing
rebase-conflict case still reverts + files.
Out of scope:
no change needed.
list, or the commit-message keyword scrub, beyond re-running the existing
diff-cap check post-rebase.
git ls-remotecheckthat the pushed commit is actually on
origin/main). The issue textrefers to this as "the existing" verification, but no such check
currently exists in the codebase — don't add one as part of this ticket
unless it's structurally required to implement the retry-once semantics
above.
Blocked — machinery change in a protected path; a swarm worker cannot land this.
The entire fix for this ticket lives inside
.sandcastle/:.sandcastle/rehearsal-heal-lib.sh(heal_rails);.sandcastle/rehearsal-report.sh..sandcastle/(and.forgejo/) are protected paths — the healer/harness that judges swarm work..sandcastle/protected-paths-lib.sh(PP_PROTECTED_DIRS_DEFAULT=".sandcastle .forgejo", shipped by #445) fingerprints the protected set before and after every swarm run, attributes any create/delete/change under it, rolls it back, and fails the run loud — andgit-fencebackstops on top. So a Sandcastle worker physically cannot deliver this change: every edit it needs is rolled back before the commit lands, and the run reds.Per
CLAUDE.mdrule 9, a change to protected machinery is ruled on and made by a human, not by a swarm agent. This ticket is a legitimate machinery bug (the triage note above verified the three lost heals and that no fetch/rebase step exists today), but it was labelledready-for-agentin error — it is aready-for-humanitem.To re-arm: a human implements the fetch→rebase→push (with the post-rebase diff-cap + self-mod re-check, conflict→reset+file, and one bounded non-fast-forward retry) plus the offline-harness case directly against
.sandcastle/, or explicitly authorises an agent to touch the protected paths for this ticket. Swappingready-for-agent→ready-for-humanand releasing my claim (run 4869) so it stops looping through the agent queue.Re-blocked — same protected-path ruling as #6344 still stands (run 5065).
This ticket returned to the agent queue and I (run 5065,
matou-dev-server-01) claimed it, but nothing has changed since ben's ruling in #6344: the entire deliverable lives in protected.sandcastle/paths —.sandcastle/rehearsal-heal-lib.sh(heal_rails);.sandcastle/rehearsal-report.sh/.sandcastle/tests/..sandcastle/is a fingerprinted protected directory (PP_PROTECTED_DIRS_DEFAULT=".sandcastle .forgejo", #445): every create/change under it is attributed to the worker, rolled back, and the run failed loud. These are also the exact^\.sandcastle/rehearsal-paths the healer's own self-modification guard forbids. Per CLAUDE.md rule 9 a swarm agent must not edit protected machinery, and no comment here has added the explicit human authorization #6344 named as the alternative re-arm path.So a Sandcastle worker still physically cannot deliver this. Re-routing
ready-for-agent→ready-for-humanand releasing my claim (run 5065) so it stops looping through the agent queue. To re-arm: a human implements the change directly against.sandcastle/, or explicitly authorizes an agent to touch the protected paths for this ticket (state that here).