# fix: reset adopted checkpoint token usage

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

peyton-alt·2w ago·2 files·+5 added/-0 removed

## Sessions

0ed46044b4c8View transcript

[?\
Session Adoption and Worktree Management FixesCodex·1 step](/content/gh/entireio/cli/session/019ef09e-1621-7183-8205-646a383a2faf#timeline-0ed46044b4c8/index.html)

## Changes

2

- cmd/entire/cli

- Msession_adopt.go+1

- Msession_adopt_test.go+4

```
444 unmodified lines

445
446
447
448
449
450
451

444 unmodified lines

adopted.TurnCheckpointIDs = nil
	adopted.LastCheckpointID = id.EmptyCheckpointID
	adopted.LastCheckpointCommitHash = ""
	adopted.CheckpointTokenUsage = nil

adopted.FullyCondensed = false
	adopted.UntrackedFilesAtStart = untrackedFiles
```

Mcmd/entire/cli/session_adopt.go+1

```
623 unmodified lines

624
625
626
627
628
629
630
71 unmodified lines

702
703
704
705
706
707
708
709
710

623 unmodified lines

TurnCheckpointIDs:           []string{"abc123def456"},
		LastCheckpointID:            id.MustCheckpointID("abc123def456"),
		LastCheckpointCommitHash:    "source-commit",
		CheckpointTokenUsage:        &agent.TokenUsage{InputTokens: 100, OutputTokens: 25, APICallCount: 1},
		UntrackedFilesAtStart:       []string{"source-only.txt"},
		PromptWindowBase:            3,
		PromptWindowResetPending:    true,
71 unmodified lines

if adopted.LastCheckpointCommitHash != "" {
		t.Fatalf("LastCheckpointCommitHash = %q, want empty", adopted.LastCheckpointCommitHash)
	}
	if adopted.CheckpointTokenUsage != nil {
		t.Fatalf("CheckpointTokenUsage = %#v, want nil for first target checkpoint", adopted.CheckpointTokenUsage)
	}

commitMsgFile := filepath.Join(targetRepo, "COMMIT_EDITMSG")
	if err := os.WriteFile(commitMsgFile, []byte("add target feature\n"), 0o600); err != nil {
```
