From 03d06792dbf392883f36b2cd63a988833a729e51 Mon Sep 17 00:00:00 2001 From: Story Crater Bot <19826264+Riotpiaole@users.noreply.github.com> Date: Sat, 22 Aug 2026 10:05:05 -0700 Subject: [PATCH] fix(workflow): add activity timeouts to prevent BadScheduleActivityAttributes 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 --- statemachine/orchestrator.go | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) 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,