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>
46 lines
2.1 KiB
Go
46 lines
2.1 KiB
Go
package handlers
|
|
|
|
import "time"
|
|
|
|
// Handler operation timeout categories.
|
|
//
|
|
// Use these constants instead of inline magic numbers in context.WithTimeout calls.
|
|
// Choose the category that matches the operation's characteristics:
|
|
//
|
|
// - TimeoutFastLookup: simple reads, single-resource fetches, health checks
|
|
// - TimeoutStandard: single-service writes, K8s ops, DNS record ops
|
|
// - TimeoutHeavyWrite: multi-step writes with git operations
|
|
// - TimeoutOrchestration: multi-service coordination (create project, deploy)
|
|
// - TimeoutLongRunning: agent/command execution, async tasks
|
|
const (
|
|
// TimeoutFastLookup is for simple reads and lookups (DB queries, K8s get/list, health checks).
|
|
// 5 seconds. If a read takes longer, something is wrong.
|
|
TimeoutFastLookup = 5 * time.Second
|
|
|
|
// TimeoutLookup is for API lookups that may involve a remote call (Woodpecker list, template fetch).
|
|
// 10 seconds. Slightly more headroom for external API calls.
|
|
TimeoutLookup = 10 * time.Second
|
|
|
|
// TimeoutStandard is for single-service write operations (K8s apply, DNS create, git push).
|
|
// 30 seconds. Most write operations complete well within this.
|
|
TimeoutStandard = 30 * time.Second
|
|
|
|
// TimeoutHeavyWrite is for multi-step write operations (component add with git clone + template + push).
|
|
// 60 seconds. Git operations over network can be slow.
|
|
TimeoutHeavyWrite = 60 * time.Second
|
|
|
|
// TimeoutOrchestration is for operations that coordinate multiple services sequentially
|
|
// (project creation: repo + DNS + template + CI activation).
|
|
// 90 seconds. Longest synchronous handler operation.
|
|
TimeoutOrchestration = 90 * time.Second
|
|
|
|
// TimeoutLongRunning is for agent/command execution that streams output.
|
|
// 10 minutes. Claude Code commands can run extended operations.
|
|
TimeoutLongRunning = 10 * time.Minute
|
|
|
|
// TimeoutAgentExecution is for synchronous agent execution via /sdlc/execute.
|
|
// Accommodates medium-tier actions (20m) plus headroom for classify + post-processing.
|
|
// Heavy actions are dispatched async and return immediately.
|
|
TimeoutAgentExecution = 22 * time.Minute
|
|
)
|