A parallel session silently wiped all git stashes while another session was mid-work #7
crowcreation
started this conversation in
Session Architecture
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
I had five git stashes parked from different work streams. A long-running session had just committed and was about to triage the remaining stashes to decide what to keep, recover, or discard.
Between the commit and the triage step, a different parallel session ran its own close-out workflow. That workflow included a
git stash clearas part of cleanup. By the time my session rangit stash list, everything was gone. The reflog forrefs/stashwas gone too. No error. No warning. The session that wiped them had no idea the other session cared about them.I recovered the important ones from dangling commits (
git fsck --no-reflog), but only because garbage collection hadn't run yet. Timing saved me, not design.This was the ninth stash-loss incident in three weeks. Nine.
Drift mode: State staleness (two sessions operating on the same shared state without coordination)
What broke: Git stashes are a shared, global resource in a repository. When multiple sessions share a working directory, any session can destroy stashes created by any other session. There is no ownership model for stashes. The cleanup workflow was doing what cleanup workflows should do -- tidying up. But it had no visibility into whether another session had unfinished business with those stashes.
How it was detected: The triage step expected 5 stashes and found 0. Traced backwards through parallel session logs to find which one ran the clear.
What changed: Two things. First, a rule: no session may run
git stash clearorgit stash dropon stashes it didn't create. Second, and more fundamentally: this incident class is what drove the adoption of per-session worktrees. When each session has its own working directory, stashes are session-local. The coordination problem disappears because the shared surface area disappears.Pattern: Shared mutable global state is the root cause of most parallel-session failures. Git's working tree, index, stash stack, and HEAD are all global by default. Rules help ("don't touch what you didn't create"), but isolation is the structural fix. If you're running parallel AI sessions, isolate them at the filesystem level, not the convention level.
All reactions