Fork tasks from snapshots; snapshot only when text follows tool calls
This commit is contained in:
@@ -92,12 +92,12 @@ func TestSnapshots(t *testing.T) {
|
||||
|
||||
write("tracked.txt", "two\n")
|
||||
write("untracked.txt", "new\n")
|
||||
err = m.takeSnapshot(ctx, l, api.SnapshotTriggerToolCall)
|
||||
err = m.takeSnapshot(ctx, l, api.SnapshotTriggerMessage, 0)
|
||||
if err != nil {
|
||||
t.Fatalf("snapshot: %v", err)
|
||||
}
|
||||
snaps := snapshots()
|
||||
if len(snaps) != 1 || snaps[0].N != 1 || snaps[0].Trigger != api.SnapshotTriggerToolCall || snaps[0].AgentSessionId != "s1" {
|
||||
if len(snaps) != 1 || snaps[0].N != 1 || snaps[0].Trigger != api.SnapshotTriggerMessage || snaps[0].AgentSessionId != "s1" {
|
||||
t.Fatalf("after the first change: %+v", snaps)
|
||||
}
|
||||
first := snaps[0]
|
||||
@@ -128,7 +128,7 @@ func TestSnapshots(t *testing.T) {
|
||||
t.Fatalf("snapshot staged files in the real index: %s", staged)
|
||||
}
|
||||
|
||||
err = m.takeSnapshot(ctx, l, api.SnapshotTriggerTimer)
|
||||
err = m.takeSnapshot(ctx, l, api.SnapshotTriggerMessage, 1)
|
||||
if err != nil {
|
||||
t.Fatalf("unchanged snapshot: %v", err)
|
||||
}
|
||||
@@ -137,7 +137,7 @@ func TestSnapshots(t *testing.T) {
|
||||
}
|
||||
|
||||
write("untracked.txt", "newer\n")
|
||||
m.snapshotSoon(l, api.SnapshotTriggerTurnEnd)
|
||||
m.snapshotSoon(l, api.SnapshotTriggerTurnEnd, 0)
|
||||
deadline := time.After(30 * time.Second)
|
||||
for created := false; !created; {
|
||||
select {
|
||||
@@ -170,7 +170,7 @@ func TestSnapshots(t *testing.T) {
|
||||
t.Fatalf("snapshot rows after discard: %+v", snaps)
|
||||
}
|
||||
|
||||
m.snapshotSoon(l, api.SnapshotTriggerToolCall)
|
||||
m.snapshotSoon(l, api.SnapshotTriggerMessage, 0)
|
||||
if refs := gitIn(repo, "for-each-ref", "refs/byre/"); refs != "" {
|
||||
t.Fatalf("snapshot taken after discard:\n%s", refs)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user