huskies: merge 962
This commit is contained in:
@@ -16,9 +16,7 @@ pub(super) fn read_story_front_matter_agent(
|
||||
// Story 929: agent name comes from the CRDT register. The previous
|
||||
// YAML fallback is gone — post-891 every story has its CRDT entry,
|
||||
// and any story without one is treated as having no pinned agent.
|
||||
crate::crdt_state::read_item(story_id)
|
||||
.and_then(|w| w.agent().map(str::to_string))
|
||||
.filter(|s| !s.is_empty())
|
||||
crate::crdt_state::read_item(story_id).and_then(|w| w.agent().map(|a| a.to_string()))
|
||||
}
|
||||
|
||||
/// Return `true` if the story is in `Stage::ReviewHold`.
|
||||
|
||||
@@ -130,7 +130,8 @@ impl AgentPool {
|
||||
|
||||
// Read the preferred agent from the story's front matter before acquiring
|
||||
// the lock. (See validation::read_front_matter_agent.)
|
||||
let front_matter_agent: Option<String> = read_front_matter_agent(story_id, agent_name);
|
||||
let front_matter_agent: Option<crate::config::AgentName> =
|
||||
read_front_matter_agent(story_id, agent_name);
|
||||
|
||||
// Atomically resolve agent name, check availability, and register as
|
||||
// Pending. When `agent_name` is `None` the first idle coder is
|
||||
@@ -158,12 +159,12 @@ impl AgentPool {
|
||||
// (bug 379). Mirrors the auto_assign selection logic.
|
||||
if let Some(ref pref) = front_matter_agent {
|
||||
let stage_matches = config
|
||||
.find_agent(pref)
|
||||
.find_agent(pref.as_str())
|
||||
.map(|cfg| agent_config_stage(cfg) == PipelineStage::Coder)
|
||||
.unwrap_or(false);
|
||||
if stage_matches {
|
||||
if auto_assign::is_agent_free(&agents, pref) {
|
||||
pref.clone()
|
||||
if auto_assign::is_agent_free(&agents, pref.as_str()) {
|
||||
pref.to_string()
|
||||
} else {
|
||||
return Err(format!(
|
||||
"Preferred agent '{pref}' from story front matter is busy; \
|
||||
|
||||
@@ -56,14 +56,15 @@ pub(super) fn validate_agent_stage(
|
||||
/// `start_agent` honour an explicit `agent: coder-opus` written by the
|
||||
/// `assign` command (bug 379). Returns `None` when an explicit agent_name
|
||||
/// was already supplied or when the story has no front-matter preference.
|
||||
pub(super) fn read_front_matter_agent(story_id: &str, agent_name: Option<&str>) -> Option<String> {
|
||||
pub(super) fn read_front_matter_agent(
|
||||
story_id: &str,
|
||||
agent_name: Option<&str>,
|
||||
) -> Option<crate::config::AgentName> {
|
||||
if agent_name.is_some() {
|
||||
return None;
|
||||
}
|
||||
// Story 929: the agent pin lives in the CRDT typed register; the
|
||||
// legacy YAML fallback is gone — post-891 every story has its CRDT
|
||||
// entry and any story without one has no pinned agent.
|
||||
crate::crdt_state::read_item(story_id)
|
||||
.and_then(|w| w.agent().map(str::to_string))
|
||||
.filter(|s| !s.is_empty())
|
||||
crate::crdt_state::read_item(story_id).and_then(|w| w.agent())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user