Fork tasks from snapshots; snapshot only when text follows tool calls
This commit is contained in:
+11
-15
@@ -17,7 +17,7 @@ import (
|
||||
)
|
||||
|
||||
func (m *Manager) CreateTask(ctx context.Context, project api.Project, title, createdBy, base, actor string) (api.Task, error) {
|
||||
return m.createTask(ctx, project, title, createdBy, base, actor, nil)
|
||||
return m.createTask(ctx, project, api.Task{Title: title, CreatedBy: createdBy}, base, actor)
|
||||
}
|
||||
|
||||
func (m *Manager) StartTodo(ctx context.Context, project api.Project, creator api.User, title, model, actor string) (api.Task, error) {
|
||||
@@ -47,7 +47,7 @@ func (m *Manager) StartTodo(ctx context.Context, project api.Project, creator ap
|
||||
}
|
||||
}
|
||||
|
||||
task, err := m.createTask(ctx, project, item.Title, creator.Login, project.DefaultBranch, actor, &item.Title)
|
||||
task, err := m.createTask(ctx, project, api.Task{Title: item.Title, CreatedBy: creator.Login, TodoItem: &item.Title}, project.DefaultBranch, actor)
|
||||
if err != nil {
|
||||
return api.Task{}, err
|
||||
}
|
||||
@@ -64,20 +64,16 @@ func todoPrompt(item api.TodoItem) string {
|
||||
todo.File, todo.Markdown(item))
|
||||
}
|
||||
|
||||
func (m *Manager) createTask(ctx context.Context, project api.Project, title, createdBy, base, actor string, todoItem *string) (api.Task, error) {
|
||||
id := store.NewID()
|
||||
t := api.Task{
|
||||
Id: id,
|
||||
ProjectId: project.Id,
|
||||
Title: title,
|
||||
MergeTitle: title,
|
||||
Branch: "byre/" + id,
|
||||
WorktreePath: filepath.Join(m.worktreeRoot, project.Id, id),
|
||||
Status: api.TaskStatusActive,
|
||||
CreatedBy: createdBy,
|
||||
CreatedAt: time.Now().UTC(),
|
||||
TodoItem: todoItem,
|
||||
func (m *Manager) createTask(ctx context.Context, project api.Project, t api.Task, base, actor string) (api.Task, error) {
|
||||
t.Id = store.NewID()
|
||||
t.ProjectId = project.Id
|
||||
if t.MergeTitle == "" {
|
||||
t.MergeTitle = t.Title
|
||||
}
|
||||
t.Branch = "byre/" + t.Id
|
||||
t.WorktreePath = filepath.Join(m.worktreeRoot, project.Id, t.Id)
|
||||
t.Status = api.TaskStatusActive
|
||||
t.CreatedAt = time.Now().UTC()
|
||||
|
||||
var err error
|
||||
t.BaseRef, err = git.AddWorktree(project.RepoPath, t.WorktreePath, t.Branch, base)
|
||||
|
||||
Reference in New Issue
Block a user