fix(workflow): add activity timeouts to prevent BadScheduleActivityAttributes
ci / test (push) Successful in 43s
ci / test (push) Successful in 43s
All ExecuteActivity calls were missing StartToCloseTimeout and ScheduleToCloseTimeout, causing 'BadScheduleActivityAttributes' errors. - Added 10min timeout for git operations (clone, worktree, push, merge) - Added 30min timeout for LLM activities (implementer, which calls Claude) - Git operations use shared ctxWithOptions context - LLM activities get their own implCtx with longer timeout - Added time import
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
|||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
|
"time"
|
||||||
|
|
||||||
"go.temporal.io/sdk/workflow"
|
"go.temporal.io/sdk/workflow"
|
||||||
)
|
)
|
||||||
@@ -18,8 +19,14 @@ func OrchestratorWorkflow(ctx workflow.Context, in OrchestratorInput) (Orchestra
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Step 1: Clone the repository
|
// Step 1: Clone the repository
|
||||||
|
activityOptions := workflow.ActivityOptions{
|
||||||
|
StartToCloseTimeout: 10 * time.Minute,
|
||||||
|
ScheduleToCloseTimeout: 15 * time.Minute,
|
||||||
|
}
|
||||||
|
ctxWithOptions := workflow.WithActivityOptions(ctx, activityOptions)
|
||||||
|
|
||||||
cloneErr := workflow.ExecuteActivity(
|
cloneErr := workflow.ExecuteActivity(
|
||||||
ctx,
|
ctxWithOptions,
|
||||||
"CloneRepoActivity",
|
"CloneRepoActivity",
|
||||||
map[string]interface{}{
|
map[string]interface{}{
|
||||||
"RemoteURL": in.RemoteURL,
|
"RemoteURL": in.RemoteURL,
|
||||||
@@ -55,7 +62,7 @@ func OrchestratorWorkflow(ctx workflow.Context, in OrchestratorInput) (Orchestra
|
|||||||
// Add worktree
|
// Add worktree
|
||||||
var worktreePath string
|
var worktreePath string
|
||||||
wtErr := workflow.ExecuteActivity(
|
wtErr := workflow.ExecuteActivity(
|
||||||
ctx,
|
ctxWithOptions,
|
||||||
"GitWorktreeAddActivity",
|
"GitWorktreeAddActivity",
|
||||||
map[string]interface{}{
|
map[string]interface{}{
|
||||||
"RepoPath": in.TargetRepoPath,
|
"RepoPath": in.TargetRepoPath,
|
||||||
@@ -67,10 +74,16 @@ func OrchestratorWorkflow(ctx workflow.Context, in OrchestratorInput) (Orchestra
|
|||||||
continue // Skip this task on error
|
continue // Skip this task on error
|
||||||
}
|
}
|
||||||
|
|
||||||
// Call implementer to generate code
|
// Call implementer to generate code (longer timeout for LLM calls)
|
||||||
|
implOptions := workflow.ActivityOptions{
|
||||||
|
StartToCloseTimeout: 30 * time.Minute,
|
||||||
|
ScheduleToCloseTimeout: 35 * time.Minute,
|
||||||
|
}
|
||||||
|
implCtx := workflow.WithActivityOptions(ctx, implOptions)
|
||||||
|
|
||||||
var implOutput map[string]interface{}
|
var implOutput map[string]interface{}
|
||||||
implErr := workflow.ExecuteActivity(
|
implErr := workflow.ExecuteActivity(
|
||||||
ctx,
|
implCtx,
|
||||||
"ImplementerActivity",
|
"ImplementerActivity",
|
||||||
map[string]interface{}{
|
map[string]interface{}{
|
||||||
"TaskID": taskID,
|
"TaskID": taskID,
|
||||||
@@ -91,7 +104,7 @@ func OrchestratorWorkflow(ctx workflow.Context, in OrchestratorInput) (Orchestra
|
|||||||
|
|
||||||
// Commit changes
|
// Commit changes
|
||||||
commitErr := workflow.ExecuteActivity(
|
commitErr := workflow.ExecuteActivity(
|
||||||
ctx,
|
ctxWithOptions,
|
||||||
"GitCommitActivity",
|
"GitCommitActivity",
|
||||||
map[string]interface{}{
|
map[string]interface{}{
|
||||||
"WorktreePath": worktreePath,
|
"WorktreePath": worktreePath,
|
||||||
@@ -106,7 +119,7 @@ func OrchestratorWorkflow(ctx workflow.Context, in OrchestratorInput) (Orchestra
|
|||||||
|
|
||||||
// Step 4: Push to remote
|
// Step 4: Push to remote
|
||||||
pushErr := workflow.ExecuteActivity(
|
pushErr := workflow.ExecuteActivity(
|
||||||
ctx,
|
ctxWithOptions,
|
||||||
"GitPushActivity",
|
"GitPushActivity",
|
||||||
map[string]interface{}{
|
map[string]interface{}{
|
||||||
"RepoPath": in.TargetRepoPath,
|
"RepoPath": in.TargetRepoPath,
|
||||||
@@ -125,7 +138,7 @@ func OrchestratorWorkflow(ctx workflow.Context, in OrchestratorInput) (Orchestra
|
|||||||
}
|
}
|
||||||
|
|
||||||
mergeErr := workflow.ExecuteActivity(
|
mergeErr := workflow.ExecuteActivity(
|
||||||
ctx,
|
ctxWithOptions,
|
||||||
"GitSquashMergeActivity",
|
"GitSquashMergeActivity",
|
||||||
map[string]interface{}{
|
map[string]interface{}{
|
||||||
"RepoPath": in.TargetRepoPath,
|
"RepoPath": in.TargetRepoPath,
|
||||||
|
|||||||
Reference in New Issue
Block a user