Repository navigation
feat(fleet): commit-attic — work-loss hardening (never lose a committed slice) - #12
Merged
Merged
Conversation
…ed slice) Every commit is auto-backed-up so a branch reset / checkout -f / gc can NEVER silently lose committed work — it is always recoverable. Operator-greenlit 2026-09-11 after a SHARED lane branch was repeatedly `reset --hard origin/main`, dropping in-flight slice commits from HEAD (recovered by hand via reflog). Two layers + a CLI (.fleet/bin/attic.sh, lazy-loaded by fleet.sh `attic`): - AUTO-BACKUP-ON-COMMIT (a post-commit hook → `fleet.sh attic backup`): writes a GC-proof ref refs/attic/<agent>/<epoch>-<sha> (a reset can't drop it; gc keeps a ref's commit reachable) AND a browsable patch + meta under the git-common state dir (<state>/commit-attic/<agent>/). <agent> = the fleet session id, else branch. - PRE-RESET GUARD (a reference-transaction hook → `fleet.sh attic guard`): BLOCKS a branch REWIND that would drop a commit not recoverable from the attic. A fast-forward, and a rewind whose dropped commits are all atticed, pass; non-branch refs (incl. refs/attic/*) are ignored so our own backups never self-block. Escape hatch: FLEET_ATTIC_FORCE=1. - fleet.sh attic install | list | recover <sha>. Doctrine it pairs with: each agent commits to a DEDICATED per-slice branch; integrate via batch-land — never reset a shared branch carrying others' work. Forcing function: .fleet/bin/selftest-attic.sh (hermetic, wired into CI) — 9 checks, each with a control that fires: backup makes a ref+patch; the guard BLOCKS an un-atticed rewind, ALLOWS a fast-forward / an atticed rewind / a FORCE escape, IGNORES non-branch refs; a dropped commit is recoverable; install writes both executable hooks. shellcheck clean; collateral/brain-retire/labels selftests still green (no regression). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
A shared lane branch was repeatedly
reset --hard origin/main, dropping in-flight slice commits from HEAD (recovered by hand via reflog, 3×). Operator-greenlit hardening so committed work can never be silently lost.Fix — an auto-backup attic + a pre-reset guard
fleet.sh attic(.fleet/bin/attic.sh, lazy-loaded), installable per repo:post-commithook →attic backup): writes a GC-proof refrefs/attic/<agent>/<epoch>-<sha>(a reset can't drop it;git gckeeps a ref's commit reachable) and a browsable patch + metadata under the git-common state dir (<state>/commit-attic/<agent>/).<agent>= the fleet session id, else the branch.reference-transactionhook →attic guard): BLOCKS a branch rewind that would drop a commit not recoverable from the attic. Passes: a fast-forward, a rewind whose dropped commits are all atticed, and any non-branch ref (incl.refs/attic/*— so backups never self-block). Escape:FLEET_ATTIC_FORCE=1.fleet.sh attic install | list | recover <sha>.Forcing function —
.fleet/bin/selftest-attic.sh(hermetic, wired into CI)Each guarantee BITES, each with a control that fires:
attic backupmakes a ref + patchFLEET_ATTIC_FORCE=1escapesattic recover)installwrites both executable hooksVerification
shellcheck --severity=warning install.sh .fleet/bin/*.sh— cleanselftest-attic.sh— 9/9, deterministicselftest-collateral/selftest-brain-retire/selftest-labels— green (no regression)🤖 Generated with Claude Code