fix(prompts): correct five prompt claims that contradicted the tool allowlists
Audited all 12 prompt kinds against the code they drive. Every real defect sat on the boundary between prompt text and the --allowedTools the launcher passes. - Planning: "Use nothing else" after a six-tool list forbade the brainstorming Skill the same prompt demands two paragraphs earlier. WindowsTerminalLauncher allowlists mcp__claudedo__*,Read,Grep,Glob,WebFetch,WebSearch,Skill -- name them, and tell the planner to ground subtasks in the repo with Read/Grep/Glob. - System: SuggestImprovement is only allowlisted when ParentTaskId is null and PlanningPhase is None, and TaskRunMcpService throws for any child, but this prompt reaches every run. Planning children were told to use a tool they lack. - MergeHelperExecute: derived "effective max-turns" from task/list/preset by hand, which misses TaskRunner's MaxTurnsCeiling clamp. Call get_effective_run_config instead -- built for exactly this and reports the clamp. - MergeHelperExecute: quoted the override-slot error as the raw lowercase throw rather than the string ExternalMcpService actually surfaces. - Refine: listed Read/Grep/Glob unconditionally though RefinePrompt.BuildArgs only appends them when a repo is available. Two findings deliberately left open, both needing a code decision rather than a prompt edit: the System prompt's worktree claim is false for a list without a WorkingDir (task runs in a plain sandbox dir), and 'fable' is missing from both the prompt's cost ordering and ModelRegistry.ByCostAscending.
This commit is contained in:
@@ -206,11 +206,56 @@ public class PromptFilesTests
|
||||
[Fact]
|
||||
public void DefaultFor_merge_helper_checks_effective_max_turns_before_queuing()
|
||||
{
|
||||
// Must delegate to get_effective_run_config rather than re-deriving the
|
||||
// task/list/preset chain: TaskRunner.ResolveMaxTurns clamps the result to
|
||||
// AppSettings.MaxTurnsCeiling, so a hand-derived number can exceed what actually runs.
|
||||
var d = PromptFiles.DefaultFor(PromptKind.MergeHelperExecute);
|
||||
Assert.Contains("effective max-turns", d);
|
||||
Assert.Contains("get_list_config", d);
|
||||
Assert.Contains("get_effective_run_config", d);
|
||||
Assert.Contains("clamped", d);
|
||||
Assert.Contains("set_task_config", d);
|
||||
Assert.Contains("get_task_config", d);
|
||||
Assert.DoesNotContain("get_list_config", d);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void DefaultFor_merge_helper_execute_quotes_the_override_slot_error_verbatim()
|
||||
{
|
||||
// ExternalMcpService.RunTaskNow rewraps OverrideSlotService's raw lowercase throw.
|
||||
var d = PromptFiles.DefaultFor(PromptKind.MergeHelperExecute);
|
||||
Assert.Contains("Override slot busy. Try again later.", d);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void DefaultFor_system_scopes_suggest_improvement_to_top_level_tasks()
|
||||
{
|
||||
// TaskRunner only allowlists SuggestImprovement when ParentTaskId is null AND
|
||||
// PlanningPhase is None, and TaskRunMcpService throws for any child -- but this
|
||||
// prompt reaches every run, including planning children.
|
||||
var d = PromptFiles.DefaultFor(PromptKind.System);
|
||||
Assert.Contains("SuggestImprovement", d);
|
||||
Assert.Contains("standalone top-level task", d);
|
||||
Assert.Contains("improvements are one layer deep", d);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void DefaultFor_planning_names_every_allowlisted_tool_and_claims_no_exclusivity()
|
||||
{
|
||||
// WindowsTerminalLauncher allowlists mcp__claudedo__*,Read,Grep,Glob,WebFetch,
|
||||
// WebSearch,Skill. The prompt used to say "Use nothing else" right after telling the
|
||||
// session to invoke the brainstorming skill -- forbidding its own first instruction.
|
||||
var d = PromptFiles.DefaultFor(PromptKind.Planning);
|
||||
Assert.DoesNotContain("Use nothing else", d);
|
||||
Assert.Contains("Skill", d);
|
||||
Assert.Contains("Grep", d);
|
||||
Assert.Contains("WebSearch", d);
|
||||
Assert.Contains("Write, Edit or Bash", d);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void DefaultFor_refine_gates_the_read_tools_on_an_available_repo()
|
||||
{
|
||||
// RefinePrompt.BuildArgs only appends Read/Grep/Glob when canReadRepo is true.
|
||||
var d = PromptFiles.DefaultFor(PromptKind.Refine);
|
||||
Assert.Contains("only when a repository is available", d);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
||||
Reference in New Issue
Block a user