From 3f008b7777901ffcc93d20f6f5db7824b2c916cf Mon Sep 17 00:00:00 2001 From: Dave Date: Mon, 23 Feb 2026 18:05:26 +0000 Subject: [PATCH] Fix invalid model names and preserve worktrees for debugging model = "sonnet-4.6" is not a valid Claude CLI model identifier, causing all coder/qa/mergemaster agents to get 404 errors from the API and exit immediately with no work done. Change to "claude-sonnet-4-6". Also disable automatic worktree cleanup on archive so agent work can be inspected post-mortem. Co-Authored-By: Claude Opus 4.6 --- .story_kit/project.toml | 10 +++++----- server/src/agents.rs | 24 +++++++++++++----------- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/.story_kit/project.toml b/.story_kit/project.toml index 1e6a576..eb2b371 100644 --- a/.story_kit/project.toml +++ b/.story_kit/project.toml @@ -51,7 +51,7 @@ system_prompt = "You are a supervisor agent. Read CLAUDE.md and .story_kit/READM [[agent]] name = "coder-1" role = "Full-stack engineer. Implements features across all components." -model = "sonnet-4.6" +model = "claude-sonnet-4-6" max_turns = 50 max_budget_usd = 5.00 prompt = "You are working in a git worktree on story {{story_id}}. Read CLAUDE.md first, then .story_kit/README.md to understand the dev process. The story details are in your prompt above. Follow the SDTW process through implementation and verification (Steps 1-3). The worktree and feature branch already exist - do not create them. Check .mcp.json for MCP tools. Do NOT accept the story or merge - commit your work and stop. If the user asks to review your changes, tell them to run: cd \"{{worktree_path}}\" && git difftool {{base_branch}}...HEAD\n\nIMPORTANT: Commit all your work before your process exits. The server will automatically run acceptance gates (cargo clippy + tests) when your process exits and advance the pipeline based on the results." @@ -60,7 +60,7 @@ system_prompt = "You are a full-stack engineer working autonomously in a git wor [[agent]] name = "coder-2" role = "Full-stack engineer. Implements features across all components." -model = "sonnet-4.6" +model = "claude-sonnet-4-6" max_turns = 50 max_budget_usd = 5.00 prompt = "You are working in a git worktree on story {{story_id}}. Read CLAUDE.md first, then .story_kit/README.md to understand the dev process. The story details are in your prompt above. Follow the SDTW process through implementation and verification (Steps 1-3). The worktree and feature branch already exist - do not create them. Check .mcp.json for MCP tools. Do NOT accept the story or merge - commit your work and stop. If the user asks to review your changes, tell them to run: cd \"{{worktree_path}}\" && git difftool {{base_branch}}...HEAD\n\nIMPORTANT: Commit all your work before your process exits. The server will automatically run acceptance gates (cargo clippy + tests) when your process exits and advance the pipeline based on the results." @@ -69,7 +69,7 @@ system_prompt = "You are a full-stack engineer working autonomously in a git wor [[agent]] name = "coder-3" role = "Full-stack engineer. Implements features across all components." -model = "sonnet-4.6" +model = "claude-sonnet-4-6" max_turns = 50 max_budget_usd = 5.00 prompt = "You are working in a git worktree on story {{story_id}}. Read CLAUDE.md first, then .story_kit/README.md to understand the dev process. The story details are in your prompt above. Follow the SDTW process through implementation and verification (Steps 1-3). The worktree and feature branch already exist - do not create them. Check .mcp.json for MCP tools. Do NOT accept the story or merge - commit your work and stop. If the user asks to review your changes, tell them to run: cd \"{{worktree_path}}\" && git difftool {{base_branch}}...HEAD\n\nIMPORTANT: Commit all your work before your process exits. The server will automatically run acceptance gates (cargo clippy + tests) when your process exits and advance the pipeline based on the results." @@ -87,7 +87,7 @@ system_prompt = "You are a senior full-stack engineer working autonomously in a [[agent]] name = "qa" role = "Reviews coder work in worktrees: runs quality gates, generates testing plans, and reports findings." -model = "sonnet-4.6" +model = "claude-sonnet-4-6" max_turns = 40 max_budget_usd = 4.00 prompt = """You are the QA agent for story {{story_id}}. Your job is to review the coder's work in the worktree and produce a structured QA report. @@ -153,7 +153,7 @@ system_prompt = "You are a QA agent. Your job is read-only: review code quality, [[agent]] name = "mergemaster" role = "Merges completed coder work into master, runs quality gates, archives stories, and cleans up worktrees." -model = "sonnet-4.6" +model = "claude-sonnet-4-6" max_turns = 30 max_budget_usd = 3.00 prompt = """You are the mergemaster agent for story {{story_id}}. Your job is to merge the completed coder work into master using the merge_agent_work MCP tool. diff --git a/server/src/agents.rs b/server/src/agents.rs index b0ca6d4..8118891 100644 --- a/server/src/agents.rs +++ b/server/src/agents.rs @@ -714,18 +714,20 @@ impl AgentPool { if let Err(e) = move_story_to_archived(&project_root, story_id) { eprintln!("[pipeline] Failed to archive '{story_id}': {e}"); } - let config = - crate::config::ProjectConfig::load(&project_root).unwrap_or_default(); - if let Err(e) = - worktree::remove_worktree_by_story_id(&project_root, story_id, &config) - .await - { - eprintln!( - "[pipeline] Failed to remove worktree for '{story_id}': {e}" - ); - } + // TODO: Re-enable worktree cleanup once we have persistent agent logs. + // Removing worktrees destroys evidence needed to debug empty-commit agents. + // let config = + // crate::config::ProjectConfig::load(&project_root).unwrap_or_default(); + // if let Err(e) = + // worktree::remove_worktree_by_story_id(&project_root, story_id, &config) + // .await + // { + // eprintln!( + // "[pipeline] Failed to remove worktree for '{story_id}': {e}" + // ); + // } eprintln!( - "[pipeline] Story '{story_id}' archived and worktree cleaned up." + "[pipeline] Story '{story_id}' archived. Worktree preserved for inspection." ); } else { eprintln!(