Skip to content

fix(agent): swarm merge reads raw status paths and both sides of a rename - #500

Merged
mrnasil merged 2 commits into
mainfrom
fix/swarm-status-paths
Nov 25, 2026
Merged

mrnasil merged 2 commits into
mainfrom
fix/swarm-status-paths

Conversation

@mrnasil

@mrnasil mrnasil commented Nov 25, 2026

Copy link
Copy Markdown
Member

Two ways a swarm worker's changes failed to reach the main checkout.

Non-ASCII names. git status --porcelain C-quotes any path with non-ASCII characters ("src/\303\266dev.rs"). The parser stripped the quotes but left the escapes, so no file matched. A worker's edit to ödev.rs was then dropped with no conflict and no note. Status is now read with -z, which gives raw, NUL-separated paths.

Renames. For a staged rename (git mv a.rs b.rs), only the new path was kept, so the main checkout ended up with both a.rs and b.rs. Both sides are now merged, and the old path goes through the normal deletion check (it is removed only if main still matches the base). A copy keeps its source.

Tests:

  • a unit test of the -z parser covering a plain entry, a rename, a copy, a non-ASCII name and malformed entries;
  • an end-to-end merge in which a worker creates ödev.rs and renames a.txt → c.txt, and main gets both changes with no a.txt left behind.

All 33 swarm worktree tests pass, and swarm_worktree.rs has 100% line coverage.

🤖 Generated with Claude Code

…name

- `git status --porcelain` C-quotes non-ASCII names
  (`"src/\303\266dev.rs"`). Stripping the quotes left the escapes in, so
  no file matched and a worker's edit to `ödev.rs` was dropped with no
  conflict and no note. Status is now read with `-z`: raw paths,
  NUL-separated.
- A staged rename kept only the new path, so the old file stayed in the
  main checkout next to the new one. Both sides are now merged; the old
  path goes through the normal deletion check.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@mrnasil
mrnasil enabled auto-merge (squash) November 25, 2026 15:53
@mrnasil
mrnasil merged commit fe870a6 into main Nov 25, 2026
7 checks passed
@mrnasil
mrnasil deleted the fix/swarm-status-paths branch November 25, 2026 23:39
@mrnasil mrnasil mentioned this pull request Nov 26, 2026
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