diff options
| author | Peter Stone <thepeterstone@gmail.com> | 2026-03-26 04:57:37 +0000 |
|---|---|---|
| committer | Peter Stone <thepeterstone@gmail.com> | 2026-03-26 04:57:37 +0000 |
| commit | 5410069ae36bc5df5d7cc950fce5d2c5a251618a (patch) | |
| tree | 27af725f0d323cb9f7f318a1e8553af2262d7084 /internal/api/stories.go | |
| parent | b6e420a62a3e7e81a6f5d2819f12cca11b82e572 (diff) | |
fix: set RepositoryURL on tasks created via story approve
handleApproveStory was creating tasks without RepositoryURL, causing
executions to fail with "task has no repository_url". Now looks up
the project's RemoteURL and sets it on all tasks and subtasks.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'internal/api/stories.go')
| -rw-r--r-- | internal/api/stories.go | 59 |
1 files changed, 34 insertions, 25 deletions
diff --git a/internal/api/stories.go b/internal/api/stories.go index fcf8c48..3d9d25a 100644 --- a/internal/api/stories.go +++ b/internal/api/stories.go @@ -247,22 +247,30 @@ func (s *Server) handleApproveStory(w http.ResponseWriter, r *http.Request) { return } + var repoURL string + if input.ProjectID != "" { + if proj, err := s.store.GetProject(input.ProjectID); err == nil { + repoURL = proj.RemoteURL + } + } + taskIDs := make([]string, 0, len(input.Tasks)) var prevTaskID string for _, tp := range input.Tasks { t := &task.Task{ - ID: uuid.New().String(), - Name: tp.Name, - Project: input.ProjectID, - StoryID: story.ID, - Agent: task.AgentConfig{Type: "claude", Instructions: tp.Instructions}, - Priority: task.PriorityNormal, - Tags: []string{}, - DependsOn: []string{}, - Retry: task.RetryConfig{MaxAttempts: 1, Backoff: "exponential"}, - State: task.StatePending, - CreatedAt: time.Now().UTC(), - UpdatedAt: time.Now().UTC(), + ID: uuid.New().String(), + Name: tp.Name, + Project: input.ProjectID, + RepositoryURL: repoURL, + StoryID: story.ID, + Agent: task.AgentConfig{Type: "claude", Instructions: tp.Instructions}, + Priority: task.PriorityNormal, + Tags: []string{}, + DependsOn: []string{}, + Retry: task.RetryConfig{MaxAttempts: 1, Backoff: "exponential"}, + State: task.StatePending, + CreatedAt: time.Now().UTC(), + UpdatedAt: time.Now().UTC(), } if prevTaskID != "" { t.DependsOn = []string{prevTaskID} @@ -276,19 +284,20 @@ func (s *Server) handleApproveStory(w http.ResponseWriter, r *http.Request) { var prevSubtaskID string for _, sub := range tp.Subtasks { st := &task.Task{ - ID: uuid.New().String(), - Name: sub.Name, - Project: input.ProjectID, - StoryID: story.ID, - ParentTaskID: t.ID, - Agent: task.AgentConfig{Type: "claude", Instructions: sub.Instructions}, - Priority: task.PriorityNormal, - Tags: []string{}, - DependsOn: []string{}, - Retry: task.RetryConfig{MaxAttempts: 1, Backoff: "exponential"}, - State: task.StatePending, - CreatedAt: time.Now().UTC(), - UpdatedAt: time.Now().UTC(), + ID: uuid.New().String(), + Name: sub.Name, + Project: input.ProjectID, + RepositoryURL: repoURL, + StoryID: story.ID, + ParentTaskID: t.ID, + Agent: task.AgentConfig{Type: "claude", Instructions: sub.Instructions}, + Priority: task.PriorityNormal, + Tags: []string{}, + DependsOn: []string{}, + Retry: task.RetryConfig{MaxAttempts: 1, Backoff: "exponential"}, + State: task.StatePending, + CreatedAt: time.Now().UTC(), + UpdatedAt: time.Now().UTC(), } if prevSubtaskID != "" { st.DependsOn = []string{prevSubtaskID} |
