Switch to prefixed IDs and tell agents which Mac a message came from

This commit is contained in:
Ian Gulliver
2026-10-20 23:15:19 -07:00
parent f1296ba13d
commit 59bf17189d
42 changed files with 770 additions and 145 deletions
+6 -5
View File
@@ -10,6 +10,7 @@ import (
"g.fc.run/ai/byre/internal/api"
"g.fc.run/ai/byre/internal/git"
"g.fc.run/ai/byre/internal/ids"
"g.fc.run/ai/byre/internal/store"
"g.fc.run/ai/byre/internal/todo"
)
@@ -18,7 +19,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) StartTask(ctx context.Context, project api.Project, creator api.User, title, prompt, model string, images []string) (api.Task, error) {
func (m *Manager) StartTask(ctx context.Context, project api.Project, creator api.User, title, prompt, model, client string, images []string) (api.Task, error) {
if creator.GitName == "" || creator.GitEmail == "" {
return api.Task{}, ErrNoGitIdentity
}
@@ -33,13 +34,13 @@ func (m *Manager) StartTask(ctx context.Context, project api.Project, creator ap
if err != nil {
return api.Task{}, fmt.Errorf("task %s created, but its agent did not start: %w", task.Id, err)
}
imgs, compacting, err := m.recordMessage(ctx, sess, task, creator.Login, prompt, "", images)
imgs, compacting, err := m.recordMessage(ctx, sess, task, creator.Login, prompt, "", client, images)
if err != nil {
m.failStart(ctx, sess.Id, creator.Login, err)
return api.Task{}, fmt.Errorf("task %s created, but its agent did not start: %w", task.Id, err)
}
go func() {
err := m.deliver(context.Background(), sess, task, creator.Login, prompt, imgs, compacting)
err := m.deliver(context.Background(), sess, task, creator.Login, client, prompt, imgs, compacting)
if err != nil {
slog.Error("start task agent", "task", task.Id, "err", err)
}
@@ -84,7 +85,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, discuss), 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)
}
@@ -108,7 +109,7 @@ func todoPrompt(item api.TodoItem, discuss bool) string {
const discussPrompt = "The human wants to discuss this item with you before any of it is built, to judge whether it should be built at all and in what shape. Zoom out before going into detail. Read what you need to understand it, then give your view: what problem it solves and whether that is worth solving, whether we should do it, what the alternatives are (another approach, a smaller change, or nothing), and how you would approach it, with the trade-offs and doubts you see. Talk it over in your final messages, where the human replies in the chat, and use ask_human as often as it helps. Each question belongs to that zoomed-out discussion, such as whether to do it, which alternative, or what shape, rather than the narrow details of getting it built, and later questions can build on earlier answers. Keep the conversation going turn by turn, and change nothing until they tell you to build it."
func (m *Manager) createTask(ctx context.Context, project api.Project, t api.Task, frozen *store.FrozenWorkflow, base, actor string) (api.Task, error) {
t.Id = store.NewID()
t.Id = ids.New(ids.Task)
t.ProjectId = project.Id
if t.MergeTitle == "" {
t.MergeTitle = t.Title