agent-harness / tasks /patches /TASK_CR_006_tests.patch
cuber12's picture
Publish agent harness research code and paper artifacts
d61821a verified
Raw
History Blame Contribute Delete
909 Bytes
diff --git a/functions/concrete/run/runner_test.go b/functions/concrete/run/runner_test.go
index a7ee7f0f..bf65bfa2 100644
--- a/functions/concrete/run/runner_test.go
+++ b/functions/concrete/run/runner_test.go
@@ -180,6 +180,23 @@ func TestClassifyScriptContextError(t *testing.T) {
}
}
+func TestClassifyScriptContextError_UserCancelUnwrapsContextCanceled(t *testing.T) {
+ r := testRunner(t, nil)
+
+ jobCtx, jobCancel := context.WithCancel(t.Context())
+ defer jobCancel()
+
+ scriptCtx, scriptCancel := context.WithCancel(t.Context())
+ scriptCancel()
+ defer scriptCancel()
+
+ err := r.classifyScriptContextError(jobCtx, scriptCtx, nil)
+
+ require.ErrorIs(t, err, ErrJobCanceled)
+ require.ErrorIs(t, err, context.Canceled,
+ "step-runner needs errors.Is(err, context.Canceled) to detect user cancellation")
+}
+
func TestWithTimeout(t *testing.T) {
tests := []struct {
name string