All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
Add TimeoutAgentExecution (22m) to handlers for synchronous SDLC
execution, and TimeoutAgent{Default,Medium,Heavy} (12/22/47m) to
workers for tiered agent task execution. Aligns with SDLC action
complexity tiers and prevents inline duration literals.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
44 lines
1.9 KiB
Go
44 lines
1.9 KiB
Go
package worker
|
|
|
|
import "time"
|
|
|
|
// Worker operation timeout categories.
|
|
//
|
|
// Use these constants instead of inline magic numbers in context.WithTimeout calls.
|
|
// Choose the category that matches the operation's characteristics:
|
|
//
|
|
// - TimeoutQuickOp: simple DB queries, metrics refresh, deregistration
|
|
// - TimeoutHealthCheck: parallel health checks against external systems
|
|
// - TimeoutMaintenance: maintenance operations (requeue, cleanup, mark stale)
|
|
// - TimeoutWorkExecution: long-running work execution (commands, builds)
|
|
const (
|
|
// TimeoutQuickOp is for simple, fast operations (metrics refresh, deregister, quick queries).
|
|
// 5 seconds. These should complete nearly instantly.
|
|
TimeoutQuickOp = 5 * time.Second
|
|
|
|
// TimeoutHealthCheck is for health checks against external systems (registry, CI, git).
|
|
// 10 seconds. Multiple parallel checks with headroom for slow responses.
|
|
TimeoutHealthCheck = 10 * time.Second
|
|
|
|
// TimeoutMaintenance is for maintenance operations (requeue stale tasks, cleanup old data).
|
|
// 30 seconds. These may involve multiple DB operations.
|
|
TimeoutMaintenance = 30 * time.Second
|
|
|
|
// TimeoutWorkExecution is the default timeout for executing work items
|
|
// (commands, builds, agent tasks). Used when no spec-level timeout is provided.
|
|
// 10 minutes. Long-running operations that stream output.
|
|
TimeoutWorkExecution = 10 * time.Minute
|
|
|
|
// TimeoutAgentDefault is for standard agent tasks (artifact generation).
|
|
// 12 minutes. Slightly above TimeoutWorkExecution to account for overhead.
|
|
TimeoutAgentDefault = 12 * time.Minute
|
|
|
|
// TimeoutAgentMedium is for agent tasks requiring codebase analysis (review, audit).
|
|
// 22 minutes. Matches medium SDLC action tier plus overhead.
|
|
TimeoutAgentMedium = 22 * time.Minute
|
|
|
|
// TimeoutAgentHeavy is for long-running agent tasks (implementation, fixes, QA).
|
|
// 47 minutes. Matches heavy SDLC action tier plus overhead.
|
|
TimeoutAgentHeavy = 47 * time.Minute
|
|
)
|