Add ready_for_merge tool and prompt agents for it after review

This commit is contained in:
Ian Gulliver
2026-10-19 08:48:20 -07:00
parent ab61287367
commit c7858e4d6a
8 changed files with 233 additions and 7 deletions
@@ -0,0 +1 @@
ALTER TABLE tasks ADD COLUMN ready_prompt_n INTEGER NOT NULL DEFAULT 0;
+28
View File
@@ -746,6 +746,34 @@ func (s *Store) SetTaskSummary(ctx context.Context, id, summary, actor string) e
})
}
func (s *Store) ReadyPromptN(ctx context.Context, id string) (int, error) {
n := 0
err := s.db.QueryRowContext(ctx, `SELECT ready_prompt_n FROM tasks WHERE id = ?`, id).Scan(&n)
if errors.Is(err, sql.ErrNoRows) {
return 0, ErrNotFound
}
return n, err
}
func (s *Store) SetReadyPromptN(ctx context.Context, id string, snapshotN int) error {
_, err := s.db.ExecContext(ctx, `UPDATE tasks SET ready_prompt_n = ? WHERE id = ?`, snapshotN, id)
return err
}
func (s *Store) MarkReady(ctx context.Context, id, overview, actor string) error {
return s.write(ctx, func(tx *sql.Tx, emit emitFunc) error {
projectID := ""
err := tx.QueryRowContext(ctx, `SELECT project_id FROM tasks WHERE id = ? AND status = ?`, id, string(api.TaskStatusActive)).Scan(&projectID)
if errors.Is(err, sql.ErrNoRows) {
return ErrNotFound
}
if err != nil {
return err
}
return emit(api.Event{Kind: "task.ready", ProjectId: &projectID, TaskId: &id, Actor: actor, Payload: map[string]any{"id": id, "overview": overview}})
})
}
func (s *Store) TaskSummary(ctx context.Context, id string) (string, error) {
summary := ""
err := s.db.QueryRowContext(ctx, `SELECT summary FROM tasks WHERE id = ?`, id).Scan(&summary)