Skip to content

Fix sandbox git checkout failure with beads-aware stashing#7

Merged
landovsky merged 1 commit into
mainfrom
fix/sandbox-stashing-v2
Feb 5, 2026
Merged

Fix sandbox git checkout failure with beads-aware stashing#7
landovsky merged 1 commit into
mainfrom
fix/sandbox-stashing-v2

Conversation

@landovsky

Copy link
Copy Markdown
Owner

Summary

Replaces the broken beads sync approach (commit 58ed160) with a proper stashing solution that prevents sandbox git checkout failures.

Problem

The previous fix attempted to auto-run bd sync inside the container, but failed because:

  1. Wrong grep pattern - bd sync output didn't match expected strings
  2. bd sync doesn't commit - it only exports database to JSONL, user must commit separately
  3. Wrong approach - sandbox is ephemeral and should use clean remote state, not preserve local changes

This caused the sandbox to still fail with:

[sandbox] Repository still has uncommitted changes. Please commit or stash:
 M .beads/issues.jsonl

Solution

New beads-aware stashing approach:

  • Automatically stashes uncommitted changes with descriptive timestamp
  • Differentiates messaging between beads-only vs mixed changes
  • Always shows what's being stashed and how to recover
  • Falls back to force clean if stash fails
  • Proceeds with clean remote state (appropriate for ephemeral test environment)

Testing

  • ✅ Tested locally with claude-sandbox local
  • ✅ Verified clean repository works normally
  • ✅ Verified dirty beads files are stashed with appropriate messaging
  • ⏳ Remote execution will be tested after build

🤖 Generated with Claude Code

The previous fix (58ed160) tried to auto-run 'bd sync' inside the container
but had three fatal flaws:
1. Wrong grep pattern - bd sync output didn't match expected strings
2. bd sync doesn't commit - it only exports to JSONL
3. Wrong approach - sandbox is ephemeral and should use clean remote state

New approach:
- Check for uncommitted changes before git checkout
- Stash all changes with descriptive timestamp message
- Differentiate between beads-only vs mixed changes in messaging
- Fallback to force clean if stash fails
- Always proceed with clean remote state

This ensures:
- Sandbox never blocks on dirty working directory
- User work is preserved in git stash
- Clear feedback on what was stashed and how to recover
- Appropriate behavior for ephemeral test environment

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@landovsky
landovsky merged commit e9a3068 into main Feb 5, 2026
1 check passed
@landovsky
landovsky deleted the fix/sandbox-stashing-v2 branch February 5, 2026 08:04
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