Repository navigation
feat(server): package and apply a thread's git work - #16734
juliusmarminge wants to merge 1 commit into
Conversation
Thread transfer impact✅ Thread transfer remains within every enforced ceiling.
Baseline: unavailable · PR result: Scenario and decoded snapshot size10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.
Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed. |
9f6425d to
4050d6d
Compare
4050d6d to
d319008
Compare
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>
d319008 to
aa1bad8
Compare
End-to-end run, two real serversTwo Git work round-trip: the laptop thread's worktree had an unpushed commit, a modified
Over Tailscale, a 400 KB unpushed commit plus an edit also arrived with the same Diverged branch: the box's
Opus 5.5 via Claude Code. |
Part of cross-environment orchestration. A handoff carries a thread's code as well as its conversation: commits not on any remote, plus uncommitted edits, deletes and new files. This PR adds the git half. The next PR wires it into the handoff.
Pack (on the sending side)
.envstay behind. The staged/unstaged split is not kept: on arrival everything shows as unstaged.--not --remotes): unpushed commits plus the snapshot.Apply (on the receiving side)
originand verifies again. If they're still missing, it refuses.update-ref.diverged.Verification
peer/handoff/HandoffGit.test.tsruns on real git repos: a bare origin and two clones (the laptop and the box). The four tests:.envarrive exactly. The branch tip matches. Status isD old.ts,M app.ts,?? new.ts, and.envis absent. The laptop's staging and refs are unchanged after packing.Opus 5.5 via Claude Code.
🤖 Generated with Claude Code