story-kit: instruct coder agents to find root causes for bugs (story 252)
Add "Bug Workflow: Root Cause First" guidance to all coder agent prompts and system prompts. Adds a test ensuring all coder-stage agents include root cause, git bisect/log, and anti-workaround instructions. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -632,6 +632,48 @@ name = "coder"
|
||||
assert_eq!(config.watcher, WatcherConfig::default());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn coder_agents_have_root_cause_guidance() {
|
||||
// Load the actual project.toml and verify all coder-stage agents
|
||||
// include root cause investigation guidance for bugs.
|
||||
let manifest_dir = std::path::Path::new(env!("CARGO_MANIFEST_DIR"));
|
||||
let project_root = manifest_dir.parent().unwrap();
|
||||
let config = ProjectConfig::load(project_root).unwrap();
|
||||
|
||||
let coder_agents: Vec<_> = config
|
||||
.agent
|
||||
.iter()
|
||||
.filter(|a| a.stage.as_deref() == Some("coder"))
|
||||
.collect();
|
||||
|
||||
assert!(
|
||||
!coder_agents.is_empty(),
|
||||
"Expected at least one coder-stage agent in project.toml"
|
||||
);
|
||||
|
||||
for agent in coder_agents {
|
||||
let prompt = &agent.prompt;
|
||||
let system_prompt = agent.system_prompt.as_deref().unwrap_or("");
|
||||
let combined = format!("{prompt} {system_prompt}");
|
||||
|
||||
assert!(
|
||||
combined.contains("root cause"),
|
||||
"Coder agent '{}' must mention 'root cause' in prompt or system_prompt",
|
||||
agent.name
|
||||
);
|
||||
assert!(
|
||||
combined.contains("git bisect") || combined.contains("git log"),
|
||||
"Coder agent '{}' must mention 'git bisect' or 'git log' for bug investigation",
|
||||
agent.name
|
||||
);
|
||||
assert!(
|
||||
combined.to_lowercase().contains("do not") || combined.contains("surgical"),
|
||||
"Coder agent '{}' must discourage adding abstractions/workarounds",
|
||||
agent.name
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn watcher_config_preserved_in_legacy_format() {
|
||||
let toml_str = r#"
|
||||
|
||||
Reference in New Issue
Block a user