Simplify code found by simplicity audit of d6be98f

This commit is contained in:
Ian Gulliver
2026-10-23 13:05:14 -07:00
parent c337799147
commit 3c2932c8fb
26 changed files with 180 additions and 225 deletions
+6 -6
View File
@@ -81,7 +81,7 @@ func (m *Manager) forkTool(l *live) mcp.Tool {
if err != nil {
return "", err
}
_, _, err = m.Message(ctx, sessionID, agentActor, args.Prompt, "", "", "", "")
_, _, err = m.Message(ctx, sessionID, agentActor, Prompt{Text: args.Prompt})
if err != nil {
return "", fmt.Errorf("task %s forked, but its agent did not start: %w", t.Id, err)
}
@@ -153,7 +153,7 @@ func (m *Manager) AnswerAgain(ctx context.Context, creator api.User, create api.
}
func (m *Manager) fork(ctx context.Context, src api.Task, project api.Project, n int, creator api.User, title string) (api.Task, string, error) {
if creator.GitName == "" || creator.GitEmail == "" {
if !creator.HasGitIdentity() {
return api.Task{}, "", ErrNoGitIdentity
}
if src.Status != api.TaskStatusActive {
@@ -192,8 +192,8 @@ func (m *Manager) fork(ctx context.Context, src api.Task, project api.Project, n
}, snap.CommitSha, creator, srcSess, at)
}
func (m *Manager) Continue(ctx context.Context, srcSess api.AgentSession, src api.Task, project api.Project, creator api.User, text, model, effort, sendID, client string, images ...string) (api.Task, error) {
if creator.GitName == "" || creator.GitEmail == "" {
func (m *Manager) Continue(ctx context.Context, srcSess api.AgentSession, src api.Task, project api.Project, creator api.User, p Prompt) (api.Task, error) {
if !creator.HasGitIdentity() {
return api.Task{}, ErrNoGitIdentity
}
if src.Status == api.TaskStatusActive {
@@ -209,7 +209,7 @@ func (m *Manager) Continue(ctx context.Context, srcSess api.AgentSession, src ap
unlock := m.lockDelivery("continue:" + srcSess.Id)
defer unlock()
ctx = context.WithoutCancel(ctx)
prior, sent, err := m.priorSend(ctx, sendID)
prior, sent, err := m.priorSend(ctx, p.SendID)
if err != nil {
return api.Task{}, err
}
@@ -235,7 +235,7 @@ func (m *Manager) Continue(ctx context.Context, srcSess api.AgentSession, src ap
if err != nil {
return api.Task{}, err
}
_, _, err = m.Message(ctx, sessionID, creator.Login, text, model, effort, sendID, client, images...)
_, _, err = m.Message(ctx, sessionID, creator.Login, p)
if err != nil {
return api.Task{}, fmt.Errorf("task %s created, but its agent did not start: %w", t.Id, err)
}