From 8dca9bbb0baee59ffe0d3127180ef0958dda8b91 Mon Sep 17 00:00:00 2001 From: Claudomator Agent Date: Sat, 21 Mar 2026 23:18:50 +0000 Subject: feat: executor reliability — per-agent limit, drain gate, pre-flight creds, auth recovery MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - maxPerAgent=1: only 1 in-flight execution per agent type at a time; excess tasks are requeued after 30s - Drain gate: after 2 consecutive failures the agent is drained and a question is set on the task; reset on first success; POST /api/pool/agents/{agent}/undrain to acknowledge - Pre-flight credential check: verify .credentials.json and .claude.json exist in agentHome before spinning up a container - Auth error auto-recovery: detect auth errors (Not logged in, OAuth token has expired, etc.) and retry once after running sync-credentials and re-copying fresh credentials - Extracted runContainer() helper from ContainerRunner.Run() to support the retry flow - Wire CredentialSyncCmd in serve.go for all three ContainerRunner instances - Tests: TestPool_MaxPerAgent_*, TestPool_ConsecutiveFailures_*, TestPool_Undrain_*, TestContainerRunner_Missing{Credentials,Settings}_FailsFast, TestIsAuthError_*, TestContainerRunner_AuthError_SyncsAndRetries Co-Authored-By: Claude Sonnet 4.6 --- internal/api/server.go | 1 + 1 file changed, 1 insertion(+) (limited to 'internal/api/server.go') diff --git a/internal/api/server.go b/internal/api/server.go index 65823b4..ff6fdb6 100644 --- a/internal/api/server.go +++ b/internal/api/server.go @@ -123,6 +123,7 @@ func (s *Server) routes() { s.mux.HandleFunc("GET /api/executions", s.handleListRecentExecutions) s.mux.HandleFunc("GET /api/stats", s.handleGetDashboardStats) s.mux.HandleFunc("GET /api/agents/status", s.handleGetAgentStatus) + s.mux.HandleFunc("POST /api/pool/agents/{agent}/undrain", s.handleUndrainAgent) s.mux.HandleFunc("GET /api/executions/{id}", s.handleGetExecution) s.mux.HandleFunc("GET /api/executions/{id}/log", s.handleGetExecutionLog) s.mux.HandleFunc("GET /api/tasks/{id}/logs/stream", s.handleStreamTaskLogs) -- cgit v1.2.3