Fix repeated stream finishes and preserve cancellation causes
This commit is contained in:
1 parent
3170b28251
commit
019a38f111
5 files changed
+68
-2
No files matched your search
@@ -0,0 +1,18 @@
|
||||
package runtime
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestSteeringPreservesProtocolCancellationCause(t *testing.T) {
|
||||
cause := errors.New("duplicate tool call ID")
|
||||
ctx, cancel := context.WithCancelCause(context.Background())
|
||||
cancel(cause)
|
||||
ctx = WithSteering(ctx, func(context.Context) (*SteeringMessage, error) { t.Fatal("called after cancellation"); return nil, nil })
|
||||
_, err := (&Runtime{}).applySteering(ctx, nil)
|
||||
if !errors.Is(err, cause) {
|
||||
t.Fatalf("lost cause: %v", err)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user