Add lead wake_on tool to wake the lead on a task's merge or discard

This commit is contained in:
Ian Gulliver
2026-10-21 12:10:25 -07:00
parent 9ab1c0d079
commit 8c16bc3fb0
4 changed files with 101 additions and 4 deletions
+24 -1
View File
@@ -408,7 +408,7 @@ func (m *Manager) leadTools(l *live) []mcp.Tool {
"Merge a task as the human: its agent merges the default branch in, then byre squashes it into one commit, pushes it to origin and closes the task. "+
"While another task in the project is merging, byre holds the merge and starts it when that one is done. "+
"For a subtask, target parent instead asks its parent task's agent to merge it into the parent's branch, and the subtask closes once the parent has. "+
"Refused for a task with active subtasks. Only when the human asks. You get a signal when it is merged; failures show as errors in the task's transcript, and you get a signal for each."+stoppedRefusal,
"Refused for a task with active subtasks. Only when the human asks. Its merged signal arrives only alongside another signal unless you call wake_on for the task; failures show as errors in the task's transcript, and you get a signal for each."+stoppedRefusal,
`{"type": "object", "properties": {
"task_id": {"type": "string"},
"target": {"type": "string", "enum": ["main", "parent"], "description": "Default main."}
@@ -489,6 +489,29 @@ func (m *Manager) leadTools(l *live) []mcp.Tool {
return fmt.Sprintf("Discarding %s: its agent gets a turn to write the task summary, and byre discards the task when that turn ends.", task.Id), nil
}),
tool("wake_on",
"Make an active task's next merged or discarded signal wake you, once, whoever merged or discarded it. "+
"Without it, a merge or discard by the human only arrives alongside another signal. Use it when something waits on that task closing, "+
"for example \"after that merge, deploy\".",
taskOnly,
func(ctx context.Context, user api.User, raw json.RawMessage) (string, error) {
task, _, err := m.taskArg(ctx, raw)
if err != nil {
return "", err
}
if task.Background {
return "", fmt.Errorf("%w: %s is a background task, whose signals never reach you", ErrInvalid, task.Id)
}
err = m.store.AddLeadWake(ctx, user.Login, task.Id)
if errors.Is(err, store.ErrNotFound) {
return "", fmt.Errorf("%w: %s has already been merged or discarded", ErrInvalid, task.Id)
}
if err != nil {
return "", err
}
return fmt.Sprintf("You'll be woken when %s is merged or discarded.", task.Id), nil
}),
tool("show",
"Point the human's right pane at a task, or at a project with no task, and select one of its tabs. The tabs' order is fixed. "+
"Whenever the human asks you to show something (\"show me that when you can\") or you want to show something, call show right away; never hold back because you expect a refusal, since only a refused show arranges byre's signal to try again. "+