fix(session): preserve target untracked files on adopt · Entire
fix(session): preserve target untracked files on adopt
1b1026c→main·peyton-alt·3w ago·3 files·+16 added/-1 removed
Sessions
7d71da57444eView transcript
Changes
3
cmd/entire/cli
Msession_adopt.go+5/-1
Msession_adopt_test.go+5
strategy
- Mcommon.go+6
408 unmodified lines
409
410
411
412
413
414
415
416
417
418
28 unmodified lines
447
448
449
446
450
451
452
453
408 unmodified lines
if err != nil {
return nil, nil, err
}
untrackedFiles, err := strategy.CollectUntrackedFiles(ctx)
if err != nil {
untrackedFiles = nil
}
now := time.Now()
adopted := cloneAdoptSourceState(source)
28 unmodified lines
adopted.LastCheckpointCommitHash = ""
adopted.FullyCondensed = false
adopted.UntrackedFilesAtStart = nil
adopted.UntrackedFilesAtStart = untrackedFiles
adopted.PromptAttributions = nil
adopted.PendingPromptAttribution = nil
// Preserve cumulative turn/context metrics for the continuing agent session,
Mcmd/entire/cli/session_adopt.go+5/-1
623 unmodified lines
624
625
626
627
628
629
630
2 unmodified lines
633
634
635
636
637
638
639
52 unmodified lines
692
693
694
695
696
697
698
699
700
623 unmodified lines
TurnCheckpointIDs: []string{"abc123def456"},
LastCheckpointID: id.MustCheckpointID("abc123def456"),
LastCheckpointCommitHash: "source-commit",
UntrackedFilesAtStart: []string{"source-only.txt"},
PromptWindowBase: 3,
PromptWindowResetPending: true,
}); err != nil {
2 unmodified lines
testutil.WriteFile(t, targetRepo, targetRelPath, "package src\n")
testutil.GitAdd(t, targetRepo, targetRelPath)
testutil.WriteFile(t, targetRepo, "target-notes.txt", "user notes\n")
t.Chdir(targetRepo)
var out bytes.Buffer
52 unmodified lines
if adopted.TurnID != "" {
t.Fatalf("TurnID = %q, want empty target-local turn ID", adopted.TurnID)
}
if len(adopted.UntrackedFilesAtStart) != 1 || adopted.UntrackedFilesAtStart[0] != "target-notes.txt" {
t.Fatalf("UntrackedFilesAtStart = %v, want target worktree snapshot [target-notes.txt]", adopted.UntrackedFilesAtStart)
}
if !adopted.LastCheckpointID.IsEmpty() {
t.Fatalf("LastCheckpointID = %s, want empty", adopted.LastCheckpointID.String())
}
Mcmd/entire/cli/session_adopt_test.go+5
1556 unmodified lines
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1556 unmodified lines
return files, nil
}
// CollectUntrackedFiles collects untracked, non-ignored paths relative to the
// repository root.
func CollectUntrackedFiles(ctx context.Context) ([]string, error) {
return collectUntrackedFiles(ctx)
}
// NOTE: The following git tree helper functions have been moved to checkpoint/ package:
// - FlattenTree -> checkpoint.FlattenTree
// - CreateBlobFromContent -> checkpoint.CreateBlobFromContent
Mcmd/entire/cli/strategy/common.go+6