ask_human nudge to merge main

This commit is contained in:
Ian Gulliver
2026-10-20 08:58:59 -07:00
parent d530ec5edc
commit 3989c2f156
3 changed files with 28 additions and 3 deletions
+19 -2
View File
@@ -11,6 +11,7 @@ import (
"time"
"g.fc.run/ai/byre/internal/api"
"g.fc.run/ai/byre/internal/git"
"g.fc.run/ai/byre/internal/mcp"
"g.fc.run/ai/byre/internal/store"
)
@@ -162,8 +163,24 @@ func (m *Manager) ask(ctx context.Context, l *live, raw json.RawMessage) (string
slog.Error("answer question while away", "item", id, "user", creator.Login, "err", err)
}
return fmt.Sprintf("Question filed in the human's inbox. question_id: %s. End your turn now. The answer will arrive as your next message. "+
"If the human answers it some other way, such as in a chat message, withdraw it with cancel_question and question_id %q.", id, id), nil
filed := fmt.Sprintf("Question filed in the human's inbox. question_id: %s. ", id)
rest := fmt.Sprintf("The answer will arrive as your next message. "+
"If the human answers it some other way, such as in a chat message, withdraw it with cancel_question and question_id %q.", id)
project, err := m.store.GetProject(ctx, task.ProjectId)
if err != nil {
return "", err
}
behind, err := git.Behind(task.WorktreePath, project.DefaultBranch)
if err != nil {
slog.Error("count commits behind default branch", "task", task.Id, "err", err)
}
if behind > 0 {
return filed + fmt.Sprintf("This worktree is %d commits behind %s. While the human answers is a good time to merge %s in: "+
"commit your work if the tree isn't clean, run `git merge %s`, resolve any conflicts, and check the result. Then end your turn. ",
behind, project.DefaultBranch, project.DefaultBranch, project.DefaultBranch) + rest, nil
}
return filed + "End your turn now. " + rest, nil
}
type cancelArgs struct {