Summary
When using bd sync (or the beads tracker in ralph-tui), if the current git branch hasn't been pushed to the remote yet, bd sync's git pull fails and silently overwrites the local JSONL with the main branch version — destroying all locally-created beads.
Steps to Reproduce
- Create a new local branch:
git checkout -b my-feature
- Do NOT push to remote
- Create beads:
bd create --type=epic --title="My Feature" ... + child beads
- Verify beads exist:
bd list shows them
- Run
ralph-tui run --tracker beads --epic <id> (or bd sync)
- Beads are gone —
bd list no longer shows them
Expected Behavior
- If git pull fails (branch not on remote), local state should be preserved
bd sync should not silently destroy local beads on pull failure
- At minimum, a warning/error should surface before any destructive operation
Actual Behavior
bd sync attempts git pull → fails (fatal: couldn't find remote ref <branch>)
- JSONL gets reset to the main branch version (which doesn't have the new beads)
- DB reimports from the (now empty) JSONL
- All locally-created beads are silently lost
- No error surfaced to the user
Additional Context
bd version: 0.47.1 (279192c5)
ralph-tui version: 0.7.1
- The bd daemon also triggers this via its auto-sync cycle, making beads disappear even between manual
bd list calls
- Sync state shows the failure:
"failure_reason": "git pull failed: exit status 1\nfatal: couldn't find remote ref add-email-signup\n"
- Workaround: push branch to remote before creating beads, or use
--no-daemon and avoid bd sync
Suggested Fix
When git pull fails, bd sync should:
- Not modify the local JSONL — preserve whatever was there before the sync attempt
- Log a clear warning: "Git pull failed — local state preserved, push branch to enable sync"
- Optionally: skip the pull step entirely when the branch has no upstream tracking ref
Summary
When using
bd sync(or the beads tracker in ralph-tui), if the current git branch hasn't been pushed to the remote yet,bd sync's git pull fails and silently overwrites the local JSONL with the main branch version — destroying all locally-created beads.Steps to Reproduce
git checkout -b my-featurebd create --type=epic --title="My Feature" ...+ child beadsbd listshows themralph-tui run --tracker beads --epic <id>(orbd sync)bd listno longer shows themExpected Behavior
bd syncshould not silently destroy local beads on pull failureActual Behavior
bd syncattempts git pull → fails (fatal: couldn't find remote ref <branch>)Additional Context
bdversion: 0.47.1 (279192c5)ralph-tuiversion: 0.7.1bd listcalls"failure_reason": "git pull failed: exit status 1\nfatal: couldn't find remote ref add-email-signup\n"--no-daemonand avoidbd syncSuggested Fix
When git pull fails,
bd syncshould: