Skip to content

feat(fleet): commit-attic — work-loss hardening (never lose a committed slice) - #12

Merged
convenientlymike merged 1 commit into
mainfrom
feat/commit-attic-work-loss-hardening
Sep 11, 2026
Merged

convenientlymike merged 1 commit into
mainfrom
feat/commit-attic-work-loss-hardening

Conversation

@convenientlymike

Copy link
Copy Markdown
Owner

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:

  • Auto-backup on commit (post-commit hook → attic backup): writes a GC-proof ref refs/attic/<agent>/<epoch>-<sha> (a reset can't drop it; git gc keeps 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.
  • Pre-reset guard (reference-transaction hook → 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.
  • CLI: fleet.sh attic install | list | recover <sha>.
  • Doctrine it pairs with: each agent commits to a dedicated per-slice branch; the coordinator integrates via batch-land — never reset a shared branch carrying others' work.

Forcing function — .fleet/bin/selftest-attic.sh (hermetic, wired into CI)

Each guarantee BITES, each with a control that fires:

check guarantee control
A1 attic backup makes a ref + patch —
A2/A3 guard BLOCKS an un-atticed rewind allows a fast-forward
A4 guard ALLOWS an atticed (recoverable) rewind FLEET_ATTIC_FORCE=1 escapes
A5 a dropped commit is recoverable (attic recover) —
A6 ignores non-branch refs (no self-block) —
A7 install writes both executable hooks —

Verification

  • shellcheck --severity=warning install.sh .fleet/bin/*.sh — clean
  • selftest-attic.sh — 9/9, deterministic
  • selftest-collateral / selftest-brain-retire / selftest-labels — green (no regression)

🤖 Generated with Claude Code

…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>
@convenientlymike
convenientlymike merged commit 3accd0a into main Sep 11, 2026
4 checks passed
@convenientlymike
convenientlymike deleted the feat/commit-attic-work-loss-hardening branch September 11, 2026 07:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant