mirror of
https://github.com/tiennm99/goclaw.git
synced 2026-10-20 02:17:24 +00:00
feat(webhooks): configurable agent run timeout (default 600s) (#1267)
Replace the hardcoded 30s webhook agent-run deadline with a configurable
timeout (default 600s, cap 3600s) for both the async worker and the
sync/test HTTP handler. Legitimate multi-step runs were dying at 30s
mid-tool-call; the same request over WebSocket completed fine.
- internal/webhooks/timeout.go: ResolveTimeoutSec helper (<=0 → 600s, cap 3600s)
- WorkerConfig.AsyncAgentTimeout (async worker) + WebhookLLMHandler.syncTimeout
(sync + admin test), wired from config
- config keys gateway.webhook_{async,sync}_timeout_sec, also settable via
GOCLAW_WEBHOOK_{ASYNC,SYNC}_TIMEOUT_SEC env (env overrides config)
- tests: timeout bounds + config file/env override
This commit is contained in:
1 parent
eaa011dae3
commit
a10464290d
11 files changed
+127
-8
No files matched your search
@@ -0,0 +1,24 @@
|
||||
package webhooks
|
||||
|
||||
import "time"
|
||||
|
||||
const (
|
||||
// DefaultAgentTimeout is the fallback webhook agent-run deadline when config is unset.
|
||||
DefaultAgentTimeout = 600 * time.Second
|
||||
// MaxAgentTimeout caps the configurable webhook agent-run deadline (1h) so a config
|
||||
// typo cannot hold worker/lane slots indefinitely.
|
||||
MaxAgentTimeout = 3600 * time.Second
|
||||
)
|
||||
|
||||
// ResolveTimeoutSec converts a config value (seconds) into a bounded duration:
|
||||
// <= 0 → DefaultAgentTimeout; > 3600 → MaxAgentTimeout; otherwise the value.
|
||||
func ResolveTimeoutSec(sec int) time.Duration {
|
||||
if sec <= 0 {
|
||||
return DefaultAgentTimeout
|
||||
}
|
||||
d := time.Duration(sec) * time.Second
|
||||
if d > MaxAgentTimeout {
|
||||
return MaxAgentTimeout
|
||||
}
|
||||
return d
|
||||
}
|
||||
Reference in new issue
Block a user