Snapshot task worktrees to hidden refs as agents work
This commit is contained in:
@@ -187,6 +187,24 @@ func TestTurnAndFollowUp(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
if !has(events, "snapshot.created") {
|
||||
events = append(events, e.waitFor("snapshot", func(ev api.Event) bool { return ev.Kind == "snapshot.created" })...)
|
||||
}
|
||||
snaps, err := e.store.ListSnapshots(e.ctx, e.task.Id)
|
||||
if err != nil || len(snaps) == 0 {
|
||||
t.Fatalf("no snapshots after a turn that wrote a file: %+v %v", snaps, err)
|
||||
}
|
||||
latest := snaps[len(snaps)-1]
|
||||
if ref := gitOut(t, e.repo, "rev-parse", git.SnapshotRef(e.task.Id, latest.N)); ref != latest.CommitSha {
|
||||
t.Fatalf("snapshot ref %s, want %s", ref, latest.CommitSha)
|
||||
}
|
||||
if got := gitOut(t, e.repo, "show", latest.CommitSha+":hi.txt"); strings.TrimSpace(got) != "hi" {
|
||||
t.Fatalf("hi.txt in the latest snapshot: %q", got)
|
||||
}
|
||||
if snaps[0].Trigger != api.SnapshotTriggerToolCall {
|
||||
t.Fatalf("first snapshot trigger %s, want tool_call", snaps[0].Trigger)
|
||||
}
|
||||
|
||||
window := 0
|
||||
for _, ev := range events {
|
||||
if ev.Kind == "session.context" {
|
||||
|
||||
Reference in New Issue
Block a user