feat(server): package and apply a thread's git work

A handoff has to carry the thread's code, not only its conversation:
commits not on any remote, plus uncommitted edits, deletes and new files.
HandoffGit packs that as one git bundle. The working tree goes in as a
snapshot commit on the branch tip, made in a private index as checkpoints
are, so the user's staging is untouched; ignored files stay behind. The
bundle holds only what no remote has, and over 50 MiB the handoff is
refused with "push the branch".

Applying it fetches the base from origin when the bundle needs it, creates
a new worktree on the branch, restores the snapshot and resets the index to
the tip so the changes show as uncommitted. An existing branch only moves
forward, with a compare-and-swap ref update, and never while another
checkout has it at a different commit. Any failing step undoes the ones
before it.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
75b2c90834Julius Marminge committed on 10/20/2026, 11:07:03 PMparent48dea79
2 files changedLine totals unavailable