diff options
| author | Peter Stone <thepeterstone@gmail.com> | 2026-03-24 21:35:12 +0000 |
|---|---|---|
| committer | Peter Stone <thepeterstone@gmail.com> | 2026-03-24 21:35:12 +0000 |
| commit | e3954992af63440986bd39cce889e9c62e1a6b92 (patch) | |
| tree | fc3360d1a4895ad02d105c44947aec98f263b6f7 /internal/executor/executor.go | |
| parent | bc62c3545bbcf3f9ccc508cdc43ce9ffdb5dfad0 (diff) | |
feat: clone story branch in ContainerRunner (ADR-007)
- Add BranchName field to task.Task (populated from story at execution time)
- Add GetStory to executor Store interface; resolve BranchName from story in both
execute() and executeResume() parallel to RepositoryURL resolution
- Pass --branch <name> to git clone when BranchName is set; default clone otherwise
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'internal/executor/executor.go')
| -rw-r--r-- | internal/executor/executor.go | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/internal/executor/executor.go b/internal/executor/executor.go index 440294c..6489060 100644 --- a/internal/executor/executor.go +++ b/internal/executor/executor.go @@ -33,6 +33,7 @@ type Store interface { UpdateExecutionChangestats(execID string, stats *task.Changestats) error RecordAgentEvent(e storage.AgentEvent) error GetProject(id string) (*task.Project, error) + GetStory(id string) (*task.Story, error) } // LogPather is an optional interface runners can implement to provide the log @@ -275,6 +276,12 @@ func (p *Pool) executeResume(ctx context.Context, t *task.Task, exec *storage.Ex t.RepositoryURL = proj.RemoteURL } } + // Populate BranchName from Story if missing (ADR-007). + if t.BranchName == "" && t.StoryID != "" { + if story, err := p.store.GetStory(t.StoryID); err == nil && story.BranchName != "" { + t.BranchName = story.BranchName + } + } err = runner.Run(ctx, t, exec) exec.EndTime = time.Now().UTC() @@ -715,6 +722,12 @@ func (p *Pool) execute(ctx context.Context, t *task.Task) { t.RepositoryURL = proj.RemoteURL } } + // Populate BranchName from Story if missing (ADR-007). + if t.BranchName == "" && t.StoryID != "" { + if story, err := p.store.GetStory(t.StoryID); err == nil && story.BranchName != "" { + t.BranchName = story.BranchName + } + } // Run the task. err = runner.Run(ctx, t, exec) |
