storkit: merge 356_story_start_command_should_say_queued_not_error_when_all_coders_are_busy

This commit is contained in:
Dave
2026-03-20 16:02:20 +00:00
parent 87958b0a2a
commit a6dcd48da9

View File

@@ -165,6 +165,12 @@ pub async fn handle_start(
info.agent_name info.agent_name
) )
} }
Err(e) if e.contains("All coder agents are busy") => {
format!(
"**{story_name}** has been queued in `work/2_current/` and will start \
automatically when a coder becomes available."
)
}
Err(e) => { Err(e) => {
format!("Failed to start **{story_name}**: {e}") format!("Failed to start **{story_name}**: {e}")
} }
@@ -312,6 +318,42 @@ mod tests {
); );
} }
#[tokio::test]
async fn handle_start_says_queued_not_error_when_all_coders_busy() {
use crate::agents::{AgentPool, AgentStatus};
use std::sync::Arc;
let tmp = tempfile::tempdir().unwrap();
let project_root = tmp.path();
let sk = project_root.join(".storkit");
let backlog = sk.join("work/1_backlog");
std::fs::create_dir_all(&backlog).unwrap();
std::fs::write(
sk.join("project.toml"),
"[[agent]]\nname = \"coder-1\"\nstage = \"coder\"\n",
)
.unwrap();
std::fs::write(
backlog.join("356_story_test.md"),
"---\nname: Test Story\n---\n",
)
.unwrap();
let agents = Arc::new(AgentPool::new_test(3000));
agents.inject_test_agent("other-story", "coder-1", AgentStatus::Running);
let response = handle_start("Timmy", "356", None, project_root, &agents).await;
assert!(
!response.contains("Failed"),
"response must not say 'Failed' when coders are busy: {response}"
);
assert!(
response.to_lowercase().contains("queue") || response.to_lowercase().contains("available"),
"response must mention queued/available state: {response}"
);
}
#[test] #[test]
fn start_command_is_registered() { fn start_command_is_registered() {
use crate::matrix::commands::commands; use crate::matrix::commands::commands;