Keep the pane on the Project tab after Start and hold off the lead
This commit is contained in:
@@ -23,7 +23,7 @@ const leadGuidance = `You are the human's lead agent in byre, shown in the left
|
||||
- Discussing a task's work, what its agent did or is doing, or whether it is ready to merge: its transcript tab. A specific file in its worktree: its files tab.
|
||||
- The changes tab only when the human asks to see the diff; they rarely want it.
|
||||
- Show, don't tell. What the right pane shows, the human reads there: never repeat, quote or paraphrase a task agent's question, choices, context or report in chat. Add only what the pane doesn't say, such as your recommendation and why, or how it connects to other work.
|
||||
- Don't move the pane for things that don't need the human, and don't pull it away from what they are looking at unless the new thing is more urgent. While the human is working in the right pane, show is refused unless it is on the project tab or what it shows is finished: say in chat what you would have shown, and carry on.
|
||||
- Don't move the pane for things that don't need the human, and don't pull it away from what they are looking at unless the new thing is more urgent. While the human is working in the right pane, show is refused unless it is on the project tab or what it shows is finished. It is also refused on the project tab right after the human starts a TODO item there, since they are likely to start more. When show is refused, say in chat what you would have shown, and carry on.
|
||||
- Questions from task agents: answer one yourself with answer_question only when the answer is clear, for example the agent's recommendation is plainly right given what the human has said, or the human already decided it. Otherwise show it to the human with your recommendation and wait. When the human tells you an answer, give it with answer_question. Say which questions you answered and how.
|
||||
- Reports: read them and show the human only what matters: work finished and ready to merge, problems, decisions made. Stay quiet about routine progress.
|
||||
- Reviews: after each new snapshot of a task, a reviewer agent from the other vendor reviews the change. The results are on the task's reviews tab, read_transcript shows each review's findings, and a question shows the review of the turn that asked it. They are for the human to look at when they want; mention one only when its findings matter to what the human is deciding.
|
||||
@@ -87,6 +87,8 @@ func (m *Manager) createLead(ctx context.Context, owner api.User, prompt, model,
|
||||
}
|
||||
|
||||
func (m *Manager) MessageLead(ctx context.Context, user api.User, text, model string, images []string) (api.AgentSession, error) {
|
||||
m.setStartedTodo(user.Login, false)
|
||||
|
||||
m.leadMu.Lock()
|
||||
defer m.leadMu.Unlock()
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -43,6 +43,7 @@ type Manager struct {
|
||||
rateLimits map[api.AgentSessionVendor]map[string]any
|
||||
leadAnswered map[string]bool
|
||||
paneFocused map[string]bool
|
||||
startedTodo map[string]bool
|
||||
|
||||
deliverMu sync.Mutex
|
||||
leadMu sync.Mutex
|
||||
@@ -101,6 +102,7 @@ func New(st *store.Store, worktreeRoot, leadRoot, codexHome string) *Manager {
|
||||
rateLimits: map[api.AgentSessionVendor]map[string]any{},
|
||||
leadAnswered: map[string]bool{},
|
||||
paneFocused: map[string]bool{},
|
||||
startedTodo: map[string]bool{},
|
||||
signals: make(chan api.Event, 1024),
|
||||
snaps: map[string]*snapState{},
|
||||
mergeHolders: map[string]string{},
|
||||
|
||||
@@ -56,6 +56,9 @@ func (m *Manager) StartTodo(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)
|
||||
}
|
||||
if actor == creator.Login {
|
||||
m.setStartedTodo(creator.Login, true)
|
||||
}
|
||||
return task, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user