fix(claude-memory-backup): refuse to run off main instead of stranding the backup - #23
Merged
Merged
Conversation
…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.
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.
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 mainships an unchangedmain, exit 0, and the status file recordsOK.Found on 2026-08-13 with
~/.dotfiles-worksitting onfeat/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