Add a Discuss button beside Start on TODO items

This commit is contained in:
Ian Gulliver
2026-10-16 08:53:02 -07:00
parent cac24e534f
commit 2bb7833de3
14 changed files with 227 additions and 205 deletions
+1 -1
View File
@@ -254,7 +254,7 @@ func (m *Manager) leadTools(l *live) []mcp.Tool {
if err != nil {
return "", err
}
tasks, err := m.StartTodo(ctx, project, user, args.Title, m.modelOr(args.Model, l), leadActor(user.Login), args.Workflow)
tasks, err := m.StartTodo(ctx, project, user, args.Title, m.modelOr(args.Model, l), leadActor(user.Login), args.Workflow, false)
if err != nil {
return "", err
}
+9 -5
View File
@@ -20,7 +20,7 @@ func (m *Manager) CreateTask(ctx context.Context, project api.Project, title, cr
return m.createTask(ctx, project, api.Task{Title: title, CreatedBy: createdBy}, nil, base, actor)
}
func (m *Manager) StartTodo(ctx context.Context, project api.Project, creator api.User, title, model, actor, workflowName string) ([]api.Task, error) {
func (m *Manager) StartTodo(ctx context.Context, project api.Project, creator api.User, title, model, actor, workflowName string, discuss bool) ([]api.Task, error) {
if creator.GitName == "" || creator.GitEmail == "" {
return nil, ErrNoGitIdentity
}
@@ -48,7 +48,7 @@ func (m *Manager) StartTodo(ctx context.Context, project api.Project, creator ap
started := []api.Task{}
if workflowName != "" {
started, err = m.StartWorkflow(ctx, project, creator, item.Title, project.DefaultBranch, actor, workflowName, todoPrompt(item), &item.Title)
started, err = m.StartWorkflow(ctx, project, creator, item.Title, project.DefaultBranch, actor, workflowName, todoPrompt(item, discuss), &item.Title)
if err != nil {
return nil, err
}
@@ -57,7 +57,7 @@ func (m *Manager) StartTodo(ctx context.Context, project api.Project, creator ap
if err != nil {
return nil, err
}
_, err = m.create(ctx, task, creator, todoPrompt(item), model, actor, nil)
_, err = m.create(ctx, task, creator, todoPrompt(item, discuss), model, actor, nil)
if err != nil {
return nil, fmt.Errorf("task %s created, but its agent did not start: %w", task.Id, err)
}
@@ -69,9 +69,13 @@ func (m *Manager) StartTodo(ctx context.Context, project api.Project, creator ap
return started, nil
}
func todoPrompt(item api.TodoItem) string {
return fmt.Sprintf("Work on this item from %[1]s at the repo root:\n\n%[2]s\n\nWhen the work is done, remove this item from %[1]s in this worktree, so the removal lands in the same merge as the work.",
func todoPrompt(item api.TodoItem, discuss bool) string {
p := fmt.Sprintf("Work on this item from %[1]s at the repo root:\n\n%[2]s\n\nWhen the work is done, remove this item from %[1]s in this worktree, so the removal lands in the same merge as the work.",
todo.File, todo.Markdown(item))
if !discuss {
return p
}
return p + "\n\nThe human wants to talk this item through before any of it is built. Read what you need to understand it, then ask them about its open questions and your proposed approach with ask_human, and change nothing until they have answered."
}
func (m *Manager) createTask(ctx context.Context, project api.Project, t api.Task, frozen *store.FrozenWorkflow, base, actor string) (api.Task, error) {