From aaa9e85dd400a78ee89d9a1d74b3a13e735d48eb Mon Sep 17 00:00:00 2001 From: Sam Catlow Date: Mon, 24 Aug 2026 11:52:37 +1000 Subject: [PATCH] fix(agentexec): recover omitted finish calls --- go.mod | 2 +- go.sum | 2 ++ internal/agentexec/inprocess.go | 1 + internal/agentexec/inprocess_test.go | 3 +++ 4 files changed, 7 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 1cb4857e8..8ad268b0a 100644 --- a/go.mod +++ b/go.mod @@ -72,7 +72,7 @@ require ( github.com/moby/moby/client v0.5.1 github.com/nats-io/nats-server/v2 v2.14.4 github.com/nats-io/nats.go v1.52.0 - github.com/samcharles93/ai-sdk v0.1.21 + github.com/samcharles93/ai-sdk v0.1.22 github.com/traefik/yaegi v0.16.1 golang.org/x/net v0.57.0 golang.org/x/term v0.45.0 diff --git a/go.sum b/go.sum index be948513b..eab955d28 100644 --- a/go.sum +++ b/go.sum @@ -130,6 +130,8 @@ github.com/samcharles93/ai-sdk v0.1.20 h1:Z52dyMN293aV8Cpgjdyyd2zw6oNF5FSXKWfCux github.com/samcharles93/ai-sdk v0.1.20/go.mod h1:a4JYsUrwGsmm2eiXgrpcKExtYe7uHQ5zsHDbbkcPB6o= github.com/samcharles93/ai-sdk v0.1.21 h1:V/OqLnoWuZQ/8qw6MiVZuQU5qVLkULGex6WMQYCbCg4= github.com/samcharles93/ai-sdk v0.1.21/go.mod h1:a4JYsUrwGsmm2eiXgrpcKExtYe7uHQ5zsHDbbkcPB6o= +github.com/samcharles93/ai-sdk v0.1.22 h1:IIV1HVOzCKMQl5MvZ23WzEzaOyHpnT8QcoN8ihFi9Xc= +github.com/samcharles93/ai-sdk v0.1.22/go.mod h1:a4JYsUrwGsmm2eiXgrpcKExtYe7uHQ5zsHDbbkcPB6o= github.com/sergi/go-diff v1.4.0 h1:n/SP9D5ad1fORl+llWyN+D6qoUETXNZARKjyY2/KVCw= github.com/sergi/go-diff v1.4.0/go.mod h1:A0bzQcvG0E7Rwjx0REVgAGH58e96+X0MeOfepqsbeW4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= diff --git a/internal/agentexec/inprocess.go b/internal/agentexec/inprocess.go index b768e60a9..bd29eb4f4 100644 --- a/internal/agentexec/inprocess.go +++ b/internal/agentexec/inprocess.go @@ -105,6 +105,7 @@ func (r *InProcessRunner) Run(ctx context.Context, workspace string, req Request MaxSteps: req.Budget.MaxSteps, WallClock: req.Budget.WallClock, }, + Completion: agentloop.CompletionForceFinish, ReadOnly: req.ReadOnly, ProtectPaths: protectionMatcher(req.Protection, req.ReadOnly), Extra: mergeToolSets( diff --git a/internal/agentexec/inprocess_test.go b/internal/agentexec/inprocess_test.go index 211818231..bebaf674f 100644 --- a/internal/agentexec/inprocess_test.go +++ b/internal/agentexec/inprocess_test.go @@ -67,6 +67,9 @@ func TestInProcessRunnerMapsRequestAndCapturesOutput(t *testing.T) { if cfg.ProtectPaths == nil || !cfg.ProtectPaths("nested/file_test.go") || !cfg.ProtectPaths("view_templ.go") { t.Fatal("declarative path protection was not applied") } + if cfg.Completion != agentloop.CompletionForceFinish { + t.Fatalf("Completion = %q, want forced finish recovery", cfg.Completion) + } if !strings.Contains(cfg.ExtraRules, "Confine discovery to /workspace") || !strings.Contains(cfg.ExtraRules, "unless the mission explicitly requests") { t.Fatalf("project discovery rule missing from ExtraRules: %q", cfg.ExtraRules)