Keep the pane on the Project tab after Start and hold off the lead

This commit is contained in:
Ian Gulliver
2026-10-15 19:40:44 -07:00
parent e447d7a3cd
commit 6bf7a36c51
8 changed files with 27 additions and 7 deletions
+15 -1
View File
@@ -300,7 +300,8 @@ func (m *Manager) leadTools(l *live) []mcp.Tool {
"Tabs: transcript, changes, files, terminal (a shell in the task's worktree), preview (the dev servers the task's agent exposed with expose_port), inbox (the task's open items), reviews (the task's reviews by reviewer agents), project (the project's dashboard: its active tasks and its TODO.md items); with only project_id, only project shows anything. "+
"Omit both task_id and project_id to clear the pane. "+
"If the pane already shows that task (or project) on that tab, only the tab order changes and you are told so, even while the human is working in the pane. "+
"Otherwise refused while the human is working in the right pane, unless it is on the project tab or what it shows is finished (a merged or discarded task, or an inbox tab with nothing left).",
"Otherwise refused while the human is working in the right pane, unless it is on the project tab or what it shows is finished (a merged or discarded task, or an inbox tab with nothing left). "+
"Also refused while the pane is on the project tab and the human's last action was starting a TODO item there, until they switch task or tab or message you.",
`{"type": "object", "properties": {
"task_id": {"type": "string"},
"project_id": {"type": "string", "description": "Ignored when task_id is given."},
@@ -329,7 +330,11 @@ func (m *Manager) leadTools(l *live) []mcp.Tool {
}
m.mu.Lock()
focused := m.paneFocused[user.Login]
startedTodo := m.startedTodo[user.Login]
m.mu.Unlock()
if startedTodo && current.Tab == api.TabProject {
return "", fmt.Errorf("%w: the human just started a TODO item from the project tab and is likely to start more; tell them in chat instead", ErrConflict)
}
if focused && current.Tab != api.TabProject {
finished, err := m.paneFinished(ctx, current)
if err != nil {
@@ -382,6 +387,9 @@ func (m *Manager) SetFocus(ctx context.Context, login string, f api.Focus, actor
return fmt.Errorf("project %s: %w", *f.ProjectId, err)
}
}
if actor == login {
m.setStartedTodo(login, false)
}
return m.store.SetFocus(ctx, login, f, actor)
}
@@ -428,6 +436,12 @@ func (m *Manager) SetPaneFocus(login string, focused bool) {
m.paneFocused[login] = focused
}
func (m *Manager) setStartedTodo(login string, started bool) {
m.mu.Lock()
defer m.mu.Unlock()
m.startedTodo[login] = started
}
func (m *Manager) modelOr(model string, l *live) string {
if model != "" {
return model