CBox setup-worktree ROOT_WORKTREE_PATH fallback
Problem
The cbox worktree setup copies .env from the root worktree into new sandbox worktrees, but this step fails when the ROOT_WORKTREE_PATH environment variable is unset — which is the default case for most operator environments. The failure silently skips .env provisioning, leaving the sandbox without required configuration (e.g., SECRET_KEY, DATABASE_URL, API keys). Sandboxes then fail at runtime with confusing missing-config errors that don't point back to the real cause. The setup should derive the root worktree path from git metadata when the env var is absent, rather than silently skipping the copy.
Context
Possible Solutions
Plan
Implementation Progress
Implementation notes
- Added
_resolve_root_worktree_path(repo_path, worktree_dir)tolibs/cbox/cbox/cli.py. _run_worktree_setup(...)now resolvesROOT_WORKTREE_PATHwith fallback order: 1. existingROOT_WORKTREE_PATHenv var (if valid) 2. providedrepo_path3. derived root fromgit rev-parse --git-common-dir- Added tests in
libs/cbox/test_sandbox_start.pyfor: - existing behavior (
repo_pathexpansion) - env-var preference when valid
- git-common-dir fallback resolution
Review Feedback
- [ ] Review cleared