Update agent tests for the ctx-cancel suspend contract
Rewrite the WithStopSignal-driven test in restore_test.go to use a cancellable ctx. Update agent_test.go's "context cancellation" case from asserting "cannot complete" failure to asserting a SuspendedError. Add cancel_test.go covering both pre-first-turn cancel (no LLM call, empty checkpoint persisted) and mid-run cancel from inside a tool (just-completed turn preserved in the checkpoint, second LLM call suppressed). Signed-off-by: Aurélien Sibiril <81782+aureliensibiril@users.noreply.github.com>
This commit is contained in:
@@ -476,9 +476,8 @@ func TestRestore(t *testing.T) {
|
||||
|
||||
store := newMemoryCheckpointer()
|
||||
|
||||
stopCh := make(chan struct{})
|
||||
close(stopCh)
|
||||
ctx := agent.WithStopSignal(context.Background(), stopCh)
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
cancel()
|
||||
|
||||
_, err := ag.Run(
|
||||
ctx,
|
||||
|
||||
Reference in New Issue
Block a user