diff --git a/statemachine/orchestrator.go b/statemachine/orchestrator.go index 781d057..5e21440 100644 --- a/statemachine/orchestrator.go +++ b/statemachine/orchestrator.go @@ -5,6 +5,7 @@ import ( "io/ioutil" "path/filepath" "strings" + "time" "go.temporal.io/sdk/workflow" ) @@ -18,8 +19,14 @@ func OrchestratorWorkflow(ctx workflow.Context, in OrchestratorInput) (Orchestra } // Step 1: Clone the repository + activityOptions := workflow.ActivityOptions{ + StartToCloseTimeout: 10 * time.Minute, + ScheduleToCloseTimeout: 15 * time.Minute, + } + ctxWithOptions := workflow.WithActivityOptions(ctx, activityOptions) + cloneErr := workflow.ExecuteActivity( - ctx, + ctxWithOptions, "CloneRepoActivity", map[string]interface{}{ "RemoteURL": in.RemoteURL, @@ -55,7 +62,7 @@ func OrchestratorWorkflow(ctx workflow.Context, in OrchestratorInput) (Orchestra // Add worktree var worktreePath string wtErr := workflow.ExecuteActivity( - ctx, + ctxWithOptions, "GitWorktreeAddActivity", map[string]interface{}{ "RepoPath": in.TargetRepoPath, @@ -67,10 +74,16 @@ func OrchestratorWorkflow(ctx workflow.Context, in OrchestratorInput) (Orchestra 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{} implErr := workflow.ExecuteActivity( - ctx, + implCtx, "ImplementerActivity", map[string]interface{}{ "TaskID": taskID, @@ -91,7 +104,7 @@ func OrchestratorWorkflow(ctx workflow.Context, in OrchestratorInput) (Orchestra // Commit changes commitErr := workflow.ExecuteActivity( - ctx, + ctxWithOptions, "GitCommitActivity", map[string]interface{}{ "WorktreePath": worktreePath, @@ -106,7 +119,7 @@ func OrchestratorWorkflow(ctx workflow.Context, in OrchestratorInput) (Orchestra // Step 4: Push to remote pushErr := workflow.ExecuteActivity( - ctx, + ctxWithOptions, "GitPushActivity", map[string]interface{}{ "RepoPath": in.TargetRepoPath, @@ -125,7 +138,7 @@ func OrchestratorWorkflow(ctx workflow.Context, in OrchestratorInput) (Orchestra } mergeErr := workflow.ExecuteActivity( - ctx, + ctxWithOptions, "GitSquashMergeActivity", map[string]interface{}{ "RepoPath": in.TargetRepoPath,