Tell agents to shorten a merge title over 72 characters
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"regexp"
|
||||
"unicode/utf8"
|
||||
|
||||
"g.fc.run/misc/byre/internal/api"
|
||||
"g.fc.run/misc/byre/internal/claude"
|
||||
@@ -92,6 +93,15 @@ func (m *Manager) taskGuidance(ctx context.Context, task api.Task) (string, erro
|
||||
return g + forkGuidance(task, src), nil
|
||||
}
|
||||
|
||||
func longTitleGuidance(task api.Task) string {
|
||||
n := utf8.RuneCountInString(task.MergeTitle)
|
||||
if n <= maxMergeTitle {
|
||||
return ""
|
||||
}
|
||||
return fmt.Sprintf("\n- This task's merge commit title, %q, is %d characters, over the %d allowed, so Merge will refuse it. Early in your first turn, call set_merge_title with a one-line title of at most %d characters that describes the work.",
|
||||
task.MergeTitle, n, maxMergeTitle, maxMergeTitle)
|
||||
}
|
||||
|
||||
func subtaskGuidance(parent api.Task) string {
|
||||
return fmt.Sprintf("\n- This task is a subtask of byre task %q (%s), whose agent created it and manages it. Your final message at the end of each turn is sent to that agent, which may answer with more instructions. "+
|
||||
"Your work reaches %s's branch or the default branch when the subtask is merged.",
|
||||
|
||||
@@ -680,6 +680,9 @@ func (m *Manager) startLive(ctx context.Context, sess api.AgentSession, task api
|
||||
return nil, err
|
||||
}
|
||||
tools := append([]mcp.Tool{m.askTool(l), m.cancelQuestionTool(l), m.setMergeTitleTool(l), m.stopMergeTool(l), m.setTaskSummaryTool(l), m.searchClosedTool(l), m.exposePortTool(l)}, m.subtaskTools(l)...)
|
||||
if sess.Role == api.Implementer {
|
||||
g += longTitleGuidance(task)
|
||||
}
|
||||
if sess.Role == api.Implementer && task.WorkflowStage != nil {
|
||||
frozen, err := m.store.TaskWorkflow(ctx, task.Id)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user