You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 5748958
Browse filesBrowse the repository at this point in the historyBrowse files
fix(worktree): spawn-failure status + byte-preserving binary patch
Cycle-2 review of PR #11 (Codex found two more fail-open paths; Claude subagent
verified the cycle-1 fixes clean but missed these). Both confirmed empirically.
1. process.mjs runCommand still normalized a spawn failure to status:0. The
cycle-1 fix covered `signal !== null` but not `error` (ENOENT/EAGAIN/
maxBuffer — spawnSync returns status:null, signal:null, error:set). A
missing/failed git op still read as success (status ?? 0 → 0), so worktree
cleanup could destroy the only copy. Now: `failed = signal != null || error`;
failed => status 1. (Codex critical)
2. git.mjs applyWorktreePatch round-tripped the patch through a JS string.
runCommand decodes stdout as UTF-8, replacing invalid bytes (0xff, NUL,
legacy encodings) with U+FFFD; git apply then applied the corrupted patch
as "success" and the source worktree was destroyed — silent data loss for
any binary or non-UTF-8 file Codex touched. Now byte-preserving: write the
patch via `git diff --cached --binary --output=<file>` (git→file, no JS
string), detect empty by file size, apply. (Codex critical)
Regression tests:
- process.test.mjs: ENOENT spawn failure => non-zero status.
- worktree.test.mjs: keep round-trips a raw 0xff byte without U+FFFD corruption.
Verified: worktree 14/14, process 5/5, git 11/11 green; full npm test 157 pass /
4 pre-existing (unchanged, unrelated).
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_0189cGaohsYdpkB4otKZnpAt
0 commit comments