feat(work): make agent execution recovery durable
CI / test (push) Failing after 33s
CI / test (pull_request) Failing after 42s

This commit is contained in:
m
2026-08-23 13:10:18 +03:00
parent f9b9765100
commit 284ea88553
14 changed files with 214 additions and 13 deletions
+2 -1
View File
@@ -15,7 +15,8 @@ func (s *canaryStore) SaveDispatchIntent(context.Context, work.AgentDispatchInte
s.writes++
return nil
}
func (s *canaryStore) SaveAgentLease(context.Context, work.AgentLease) error { s.writes++; return nil }
func (s *canaryStore) SaveAgentLease(context.Context, work.AgentLease) error { s.writes++; return nil }
func (s *canaryStore) RenewAgentLease(context.Context, work.AgentLease, time.Time) error { return nil }
func (s *canaryStore) AcceptAgentCallback(context.Context, work.AgentCallback) error {
s.writes++
return nil
@@ -21,6 +21,9 @@ func (s *recordingExecutionStore) SaveAgentLease(context.Context, work.AgentLeas
s.operations = append(s.operations, "lease")
return nil
}
func (s *recordingExecutionStore) RenewAgentLease(context.Context, work.AgentLease, time.Time) error {
return nil
}
func (s *recordingExecutionStore) AcceptAgentCallback(context.Context, work.AgentCallback) error {
s.operations = append(s.operations, "callback")
return nil
@@ -0,0 +1,20 @@
package agent_execution_test
import (
"os"
"strings"
"testing"
)
func TestRecoveryMigrationDefinesBoundedRetryState(t *testing.T) {
payload, err := os.ReadFile("../../database/migrations/042_agent_execution_recovery.sql")
if err != nil {
t.Fatal(err)
}
source := strings.ToLower(string(payload))
for _, fragment := range []string{"set role work_role", "retry_limit integer not null default 3", "retry_limit > 0"} {
if !strings.Contains(source, fragment) {
t.Fatalf("migration is missing %q", fragment)
}
}
}