# fix(session): clear adopted review metadata

`4f4a780`→[main](/content/gh/entireio/cli/commits/main/index.html)·

peyton-alt·3w ago·2 files·+60 added/-2

## Sessions

b95acc5a8b76View transcript

[?\
Adopt Active Sessions Across Repos and WorktreesCodex·GPT-5.5·1 step](/content/gh/entireio/cli/session/019ef6af-f809-76d3-8c95-7d7f0bc0c5ef#timeline-b95acc5a8b76/index.html)

## Changes

2

- cmd/entire/cli

- Msession_adopt.go+6/-2

- Msession_adopt_test.go+54

```
418 unmodified lines

419
420
421
422
422
423
424
425
426
427
428
429
430
431
432
433
434
435
11 unmodified lines

447
448
449
445
450
451
452

418 unmodified lines

adopted.CLIVersion = versioninfo.Version
	adopted.TranscriptPath = source.TranscriptPath
	adopted.BaseCommit = head.Hash().String()
	adopted.AttributionBaseCommit = head.Hash().String()
	adopted.RealignAttributionBase(head.Hash().String())
	adopted.WorktreePath = worktreeRoot
	adopted.WorktreeID = worktreeID
	adopted.Branch = branch
	adopted.LastInteractionTime = &now
	adopted.Phase = session.PhaseActive
	adopted.Kind = ""
	adopted.ReviewSkills = nil
	adopted.ReviewPrompt = ""
	adopted.InvestigateRunID = ""
	adopted.InvestigateTopic = ""
	adopted.EndedAt = nil
	adopted.FilesTouched = filesTouched

11 unmodified lines

adopted.LastCheckpointCommitHash = ""

adopted.FullyCondensed = false
	adopted.DivergenceNoticeShown = false
	adopted.UntrackedFilesAtStart = nil
	adopted.PromptAttributions = nil
	adopted.PendingPromptAttribution = nil
```

Mcmd/entire/cli/session_adopt.go+6/-2

```
743 unmodified lines

744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803

743 unmodified lines

}
}

func TestSessionAdopt_ClearsReviewAndInvestigateMetadata(t *testing.T) {
	for _, tc := range []struct {
		name string
		kind session.Kind
	} {
		{name: "review", kind: session.KindAgentReview},
		{name: "investigate", kind: session.KindAgentInvestigate},
	} {
		t.Run(tc.name, func(t *testing.T) {
			targetRepo := setupAdoptRepo(t)
			testutil.WriteFile(t, targetRepo, "feature.txt", "agent change\n")
			t.Chdir(targetRepo)

adopted, _, err := buildAdoptedSessionState(context.Background(), &session.State {
				SessionID:         "test-adopt-kind-" + tc.name,
				AgentType:         agent.AgentTypeClaudeCode,
				StartedAt:         time.Now().Add(-5 * time.Minute),
				Phase:             session.PhaseActive,
				Kind:              tc.kind,
				ReviewSkills:      []string{ "/review"},
				ReviewPrompt:      "review this branch",
				InvestigateRunID:  "abcdef012345",
				InvestigateTopic:  "Why is adoption misclassified?",
				BaseCommit:        "source-head",
				WorktreePath:      "/source/repo",
				LastCheckpointID:  id.MustCheckpointID("abc123def456"),
				TurnCheckpointIDs: []string{"abc123def456"},
				PromptWindowBase:  3,
				SessionTurnCount:  7,
				AttachedManually:  true,
			})
			if err != nil {
				t.Fatalf("buildAdoptedSessionState failed: %v", err)
			}

if adopted.Kind != "" {
				t.Fatalf("Kind = %q, want empty normal session kind", adopted.Kind)
			}
			if len(adopted.ReviewSkills) != 0 {
				t.Fatalf("ReviewSkills = %v, want empty", adopted.ReviewSkills)
			}
			if adopted.ReviewPrompt != "" {
				t.Fatalf("ReviewPrompt = %q, want empty", adopted.ReviewPrompt)
			}
			if adopted.InvestigateRunID != "" {
				t.Fatalf("InvestigateRunID = %q, want empty", adopted.InvestigateRunID)
			}
			if adopted.InvestigateTopic != "" {
				t.Fatalf("InvestigateTopic = %q, want empty", adopted.InvestigateTopic)
			}
		})
	}
}

func TestSessionAdopt_CloneSourceStateDoesNotShareMutableFields(t *testing.T) {
	lastInteraction := time.Now().Add(-1 * time.Minute)
	endedAt := time.Now()
