Protected-paths enforcement: tree-fingerprint diff around swarm workers, rollback + loud fail #445
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#445
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?
Context
Learning L3 of
docs/research/2026-08-11-software-factory-learnings.md:git-fenceblocks specific commands by name (ablocklist), but nothing stops a worker from editing the machinery that judges
its work —
.sandcastle/scripts,.forgejo/workflows, git admin dirs. #239(in-sandbox
git worktree repaircorrupting shared.git/worktrees) and the93c6afbregression were both this class. SSSF enforces a boundary onoutcomes: fingerprint the tree before/after the agent, attribute every
appeared/vanished/changed path to it, roll back unauthorized changes, fail the
phase loudly. Comparing change-sets (not watching writes) also catches
git checkoutreverts.What to build
In the swarm harness, around each worker run:
(
git status --porcelain+ HEAD sha; include.forgejo/and.sandcastle/explicitly).snapshot again and diff the two.
.sandcastle/,.forgejo/,.git/admin paths (hooks, worktrees,config) — is rolled back (tracked:
git checkout --; untracked: delete)and the run FAILS loudly naming every path and what happened to it.
session's uncommitted work must never be collateral (shared-worktree
hazard).
git-fencestays as defence-in-depth; it is no longer the boundary.Caveat — the escape path (REQUIRED, ruled by Ben 2026-08-11)
A worker will sometimes be right that the machinery needs changing. When a
swarm worker, in the course of any ticket, identifies an improvement or bug
fix required in a protected path, it must NOT edit the protected path.
Instead it must:
symptom, proposed fix, and the ticket it was working when it found it;
ready-for-human(the human-requirement label) — ahuman rules on machinery changes before any agent touches them;
or report
blockedin its close report naming the filed issue.This escape path must be spelled out in the worker prompt so the worker
routes instead of improvising, and the enforcement failure message must
point to it ("protected path — file a ready-for-human issue instead").
Acceptance criteria
.sandcastle/with testsunder
.sandcastle/tests/(fixture: worker writes into.sandcastle/,run rolls it back and fails naming the path)
worker is attributed and reported
ready-for-humanlabel)exempted from the protected set (they are runtime, not machinery)
References
docs/research/2026-08-11-software-factory-learnings.md(L3)adw_modules/permissions.py+references/config.md("writes and protected_files") in
disler/super-simple-software-factoryswarm-claim host=matou-dev-server-01 run=4824
(automated multi-host claim — lowest live claim id works this ticket)
Landed in
e57b0e2onmain.What shipped (all acceptance criteria):
.sandcastle/protected-paths-lib.sh— the fingerprint snapshot/diff/rollback library (SSSFpermissions.pymodel).pp_snapshotfingerprints every file under.sandcastle/+.forgejo/by sha256 of its working-tree bytes (plus a blob copy for restore);pp_attributeddiffs before/after change-sets naming every protected path that appeared/vanished/changed (change-set comparison catches agit checkoutrevert);pp_rollbackrestores each to its pre-run content (created→deleted, changed/deleted→restored);pp_enforcecomposes them and fails loud naming each path AND the escape path..sandcastle/tests/protected-paths-lib-test.sh— 27 checks: create rolled-back-and-named (fixture: worker writes into.sandcastle/), revert attributed with pre-run content restored, pre-existing dirty protected+non-protected paths provably untouched by rollback, exempt runtime not attributed.prompt.mdrule 9) carries the escape path verbatim (file a separateready-for-humanissue, do not edit the machinery).PP_EXEMPT_GLOBSdefault*matou-heal-*); the healer’s own "never edits itself" rails are unchanged.Wiring:
run-swarm.shsnapshots before/after the sandcastle run and enforces behindPP_ENFORCE(default OFF). Rationale: the ordinary swarm still runs machinery tickets directly today (this very commit is one), so a live rollback would revert legitimate work — the flip toPP_ENFORCE=1is a one-line cutover once machinery is routed through the human-gated escape path.git-fencestays as defence-in-depth..git/admin is declared protected (pp_is_protectedreturns true) but deliberately not fingerprinted by default — the host churns.git/under normal git ops; that dir stays git-fence’s job.Follow-ups (noted in STATUS.md): cross-repo manifest propagation to matou-app; the
PP_ENFORCE=1cutover.ready-for-sessionticket whose standing is host-specific is claimed by every host that cannot do it (#743 burned both attempts) #746idss-rental-expires-tag on a LIVE rental once the broker actually deploys (#741's broker half is merged but not installed) #745workflow_runevent here, and all 4 broker-deploy runs in history were manual #874seam), not workflow (ci) #1045dashgetter in the three provision/re-apply drives #1251preflight-red(the #20 probe has no retry), and the empty verdict error block sends the healer chasing a guard that never broke #1359timeout, so auth faults and remote degradation are indistinguishable in the evidence #1462rehearsal-report.shdrifted - bdb42ff6’s token-leak fix must land in dev-factory (which still leaks) and ride back on a FACTORY_REF bump #1683testingrelease of kindfeature— a test aid so the ask-me-first review path is walked on a real community (the rail only ever cutspatch) #1973invalid-policy— the #12 policy gate's label check has a 6s retry budget, records no verdict error line, and blames a policy file that is valid (the #1359 defect in the other preflight gate) #2052%%in a .mermaid source only reds in CI (GOTCHAS #143, 2nd time) #2068reset --hard origin/mainmid-run is attributed to the worker and DELETES main-owned machinery (run 57327 lost #2099) #2104reset --hard origin/mainmid-run is attributed to the worker and DELETES main-owned machinery (run 57327 lost #2099) #2104reset --hard origin/mainmid-run is attributed to the worker and DELETES main-owned machinery (run 57327 lost #2099) #2104