Commit 7f4d43d
fix(agent-branch-start): verify worktree exists before printing Ready: (#577)
`git worktree add` has been observed to return exit code 0 with the
target directory missing on disk. The script then ran OpenSpec /
dependency-symlink init against the phantom path, eventually printing
"[agent-branch-start] Ready:" and returning success. Callers cd into
the vanished directory, claim file locks against it, and silently
lose every subsequent edit until the next finish step complains
about a missing tree.
Two defensive checks added:
1. Right after `git worktree add` returns 0 — fail fast before the
init phase touches anything in the phantom path.
2. At the top of `print_agent_next_steps` — covers the case where
the dir gets cleaned up by something during init (less likely,
but cheap to verify).
Both report the branch name and expected path, and tell the operator
to run `git worktree prune` before retry.
Co-authored-by: NagyVikt <nagy.viktordp@gmail.com>1 parent afc3428 commit 7f4d43d
1 file changed
Lines changed: 21 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
417 | 417 | | |
418 | 418 | | |
419 | 419 | | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
420 | 434 | | |
421 | 435 | | |
422 | 436 | | |
| |||
864 | 878 | | |
865 | 879 | | |
866 | 880 | | |
| 881 | + | |
| 882 | + | |
| 883 | + | |
| 884 | + | |
| 885 | + | |
| 886 | + | |
| 887 | + | |
867 | 888 | | |
868 | 889 | | |
869 | 890 | | |
| |||
0 commit comments