feat: adopt active sessions across repos and worktrees#1472
feat: adopt active sessions across repos and worktrees#1472peyton-alt wants to merge 18 commits into
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 6add2ba. Configure here.
There was a problem hiding this comment.
Pull request overview
This PR adds an explicit entire session adopt subcommand to copy (“adopt”) an in-progress agent session that’s currently tracked under a different repo/worktree into the current repo/worktree so the commit hooks can find local session state and reliably add an Entire-Checkpoint trailer.
Changes:
- Add
entire session adopt [session-id] --from <source-worktree>command wiring under thesessiongroup. - Implement adoption logic that locates the source worktree’s
.git/entire-sessions, selects an adoptable session, and writes a target-local session state seeded with current file changes. - Add unit tests covering cross-repo adoption, source resolution from a nested path, and
PrepareCommitMsgtrailer insertion after adoption.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| cmd/entire/cli/sessions.go | Adds the adopt subcommand to session help text and registers the command. |
| cmd/entire/cli/session_adopt.go | Implements the adopt command, source store resolution, session selection, and target-local state writing. |
| cmd/entire/cli/session_adopt_test.go | Adds tests for adoption behavior and hook trailer behavior after adoption. |
53264b9 to
2bed72c
Compare
Entire-Checkpoint: 7fb3d4d78c7f
Entire-Checkpoint: b7f863b91041
Entire-Checkpoint: 0d316d428771
Entire-Checkpoint: a946a346b0a7
Entire-Checkpoint: c555c03f3864
Entire-Checkpoint: 6fb8304acd8d
Entire-Checkpoint: db8b4bffc8b4
Entire-Checkpoint: 616df3aa9473
Entire-Checkpoint: ae0dfea989e0
Entire-Checkpoint: b8bd53b01bba
Entire-Checkpoint: 48521e055655
2bed72c to
db9ada8
Compare
Entire-Checkpoint: 296b9c8f3d4c
Entire-Checkpoint: d52beee4662f
Entire-Checkpoint: 433a8df1c11a
Entire-Checkpoint: 9ac13d9e6d9e
Entire-Checkpoint: 90af7f32f5e5
Entire-Checkpoint: 03f1aba5f48f

Trail: https://entire.io/gh/entireio/cli/trails/613/adopt-active-sessions-across-repos-and-worktrees
Summary
Adds
entire session adopt [session-id] --from <source-worktree>so an active agent session can be explicitly anchored into the repo/worktree where the next commit is about to happen.This addresses the case we hit where hooks were firing correctly, but the commit happened in a repo/worktree that did not have matching local session state, so the commit had nothing to link and missed the
Entire-Checkpointtrailer.What changed
session adoptsubcommand underentire session..git/entire-sessionsstore.--fromworktree, usingWorktreeIDwhen available and canonical path fallback otherwise.FilesTouchedfrom current target repo changes so the next commit can pass the staged-file overlap check.AttachedManuallyfalse because adoption is notentire session attach.This closes the sibling-worktree gap from #573 through an explicit agent/user command, without adding hook-time automatic matching across worktrees.
Verification
GOCACHE=/private/tmp/entire-go-cache go test ./cmd/entire/cli -run TestSessionAdopt -count=1GOCACHE=/private/tmp/entire-go-cache go test ./cmd/entire/cli -run TestSessionAdopt_MovesSameStoreSessionIntoCurrentWorktree -count=1GOCACHE=/private/tmp/entire-go-cache go test ./cmd/entire/cli -run 'Test(SessionAdopt|PrepareCommitMsg)' -count=1GOCACHE=/private/tmp/entire-go-cache go test ./cmd/entire/cli -count=1mise run lintmise run checkmise run checkpassed locally after rebasing on currentmain, including lint, integration tests, Vogon canary, and roger-roger canary.Latest commit/checkpoint:
db9ada812c38dc67e0750d4e2633662316ffb5bf-Entire-Checkpoint: 48521e055655Push output confirmed
entire/checkpoints/v1was already up to date on the checkpoint remote.Caveats
This is explicit adoption, not automatic discovery. Agents or users should run it from the target repo/worktree before committing, and the source transcript path must still be readable on the same machine.