huskies: merge 963

This commit is contained in:
dave
2026-05-13 12:47:09 +00:00
parent 93f774fcbb
commit 9a6963ac04
4 changed files with 46 additions and 26 deletions
+21 -18
View File
@@ -9,9 +9,9 @@ use std::path::Path;
/// Agent assignment embedded in a pipeline stage item.
#[derive(Clone, Debug, Serialize)]
pub struct AgentAssignment {
pub agent_name: String,
pub agent_name: crate::config::AgentName,
pub model: Option<String>,
pub status: String,
pub status: crate::agents::AgentStatus,
}
/// A story/bug/spike item as it appears in a pipeline stage listing.
@@ -27,9 +27,9 @@ pub struct UpcomingStory {
/// True when the item is held in QA for human review.
#[serde(skip_serializing_if = "Option::is_none")]
pub review_hold: Option<bool>,
/// QA mode for this item: "human", "server", or "agent".
/// QA mode for this item.
#[serde(skip_serializing_if = "Option::is_none")]
pub qa: Option<String>,
pub qa: Option<crate::io::story_metadata::QaMode>,
/// Number of retries at the current pipeline stage.
#[serde(skip_serializing_if = "Option::is_none")]
pub retry_count: Option<u32>,
@@ -42,9 +42,9 @@ pub struct UpcomingStory {
/// Story numbers this story depends on.
#[serde(skip_serializing_if = "Option::is_none")]
pub depends_on: Option<Vec<u32>>,
/// Epic this item belongs to (numeric ID as string, e.g. "880").
/// Epic this item belongs to.
#[serde(skip_serializing_if = "Option::is_none")]
pub epic_id: Option<String>,
pub epic_id: Option<crate::crdt_state::EpicId>,
}
/// Validation outcome for a single story.
@@ -117,10 +117,8 @@ pub fn load_pipeline_state(ctx: &AppContext) -> Result<PipelineState, String> {
} else {
None
};
let qa = view
.as_ref()
.and_then(|v| v.qa_mode().map(|q| q.as_str().to_string()));
let epic_id = view.as_ref().and_then(|v| v.epic().map(|e| e.to_string()));
let qa = view.as_ref().and_then(|v| v.qa_mode());
let epic_id = view.as_ref().and_then(|v| v.epic());
let merge_failure = crate::crdt_state::read_merge_job(sid).and_then(|j| j.error);
let story = UpcomingStory {
@@ -217,16 +215,19 @@ fn build_active_agent_map(ctx: &AppContext) -> HashMap<String, AgentAssignment>
if !matches!(agent.status, AgentStatus::Pending | AgentStatus::Running) {
continue;
}
let Ok(agent_name) = agent.agent_name.parse::<crate::config::AgentName>() else {
continue;
};
let model = config_opt
.as_ref()
.and_then(|cfg| cfg.find_agent(&agent.agent_name))
.and_then(|cfg| cfg.find_agent(agent_name.as_str()))
.and_then(|ac| ac.model.clone());
map.insert(
agent.story_id.clone(),
AgentAssignment {
agent_name: agent.agent_name,
agent_name,
model,
status: agent.status.to_string(),
status: agent.status,
},
);
}
@@ -244,8 +245,7 @@ pub fn load_upcoming_stories(_ctx: &AppContext) -> Result<Vec<UpcomingStory>, St
.filter(|item| matches!(item.stage, Stage::Backlog))
.map(|item| {
let sid = &item.story_id.0;
let epic_id =
crate::crdt_state::read_item(sid).and_then(|v| v.epic().map(|e| e.to_string()));
let epic_id = crate::crdt_state::read_item(sid).and_then(|v| v.epic());
UpcomingStory {
story_id: item.story_id.0.clone(),
name: if item.name.is_empty() {
@@ -412,8 +412,8 @@ mod tests {
"running agent should appear on work item"
);
let agent = item.agent.as_ref().unwrap();
assert_eq!(agent.agent_name, "coder-1");
assert_eq!(agent.status, "running");
assert_eq!(agent.agent_name, crate::config::AgentName::Coder1);
assert_eq!(agent.status, crate::agents::AgentStatus::Running);
}
#[test]
@@ -480,7 +480,10 @@ mod tests {
item.agent.is_some(),
"pending agent should appear on work item"
);
assert_eq!(item.agent.as_ref().unwrap().status, "pending");
assert_eq!(
item.agent.as_ref().unwrap().status,
crate::agents::AgentStatus::Pending
);
}
#[test]