Skip to content

fix(claude-memory-backup): refuse to run off main instead of stranding the backup - #23

Merged
natevick merged 1 commit into
mainfrom
fix/claude-memory-backup-branch-guard
Aug 13, 2026
Merged

fix(claude-memory-backup): refuse to run off main instead of stranding the backup#23
natevick merged 1 commit into
mainfrom
fix/claude-memory-backup-branch-guard

Conversation

@natevick

Copy link
Copy Markdown
Owner

The mirror commit lands on the checked-out branch, but the push names origin main. On any other branch that pair silently strands the backup: the commit goes to the feature branch, push origin main ships an unchanged main, exit 0, and the status file records OK.

Found on 2026-08-13 with ~/.dotfiles-work sitting on feat/selective-prod-tooling.

Now refuses unless on main, and records the branch in the status file — matching the rule this script already follows, that every exit path says whether anything was actually backed up.

Verified: sabotage-tested on a throwaway branch — it skips and names the branch (SKIPPED on-branch:tmp-guard-probe - NOTHING WAS BACKED UP), then backs up normally once back on main (OK 129 files at 0e4d561).

Same class as the bug this script's own header documents: a no-op indistinguishable from success. Worth noting it bit twice today — this script, and then me by hand, committing this very fix to a feature branch and pushing an unchanged main.

Context

This came out of finding that the job was never scheduled on this box at all — the systemd units are chezmoi-ignored here ("agent accounts schedule their own work"), so it had been 11 days and 32 memory files stale while reporting nothing wrong. Now on norm's crontab at 10:15 daily.

🤖 Generated with Claude Code

https://claude.ai/code/session_01MajZk4YHPZ23ZbtHPVJUug

…g the backup

The commit lands on the checked-out branch while the push names `origin main`, so
on any other branch the pair silently strands the mirror: commit goes to the
feature branch, `push origin main` ships an unchanged main, exit 0, status file
says OK. Found on 2026-08-13 with ~/.dotfiles-work sitting on
feat/selective-prod-tooling.

Now refuses unless on main and records the branch in the status file, matching the
script's existing rule that every exit path says whether anything was backed up.
Sabotage-verified on a throwaway branch: it skips and says which branch.

Same class as the bug this script's own header describes — a no-op that was
indistinguishable from success.
@natevick
natevick merged commit 1ab1c69 into main Aug 13, 2026
3 checks passed
@natevick
natevick deleted the fix/claude-memory-backup-branch-guard branch August 21, 2026 22:05
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