huskies: merge 871
This commit is contained in:
@@ -44,6 +44,19 @@ pub(crate) fn tool_update_story(args: &Value, ctx: &AppContext) -> Result<String
|
||||
Some(&front_matter)
|
||||
};
|
||||
|
||||
// Capture the agent value before moving front_matter into the file writer,
|
||||
// so we can mirror it into the CRDT register below.
|
||||
let agent_for_crdt = args
|
||||
.get("agent")
|
||||
.and_then(|v| v.as_str())
|
||||
.or_else(|| {
|
||||
args.get("front_matter")
|
||||
.and_then(|v| v.as_object())
|
||||
.and_then(|o| o.get("agent"))
|
||||
.and_then(|v| v.as_str())
|
||||
})
|
||||
.map(str::to_string);
|
||||
|
||||
let root = ctx.state.get_project_root()?;
|
||||
|
||||
// Only call update_story_in_file when there is something left to write.
|
||||
@@ -51,6 +64,12 @@ pub(crate) fn tool_update_story(args: &Value, ctx: &AppContext) -> Result<String
|
||||
update_story_in_file(&root, story_id, user_story, description, front_matter_opt)?;
|
||||
}
|
||||
|
||||
// Mirror the agent assignment into the CRDT register so the in-memory
|
||||
// pipeline state stays consistent with the front-matter.
|
||||
if let Some(ref a) = agent_for_crdt {
|
||||
crate::crdt_state::set_agent(story_id, Some(a));
|
||||
}
|
||||
|
||||
// Bug 503: warn if any depends_on in the (now updated) story points at an archived story.
|
||||
let stage = crate::pipeline_state::read_typed(story_id)
|
||||
.ok()
|
||||
|
||||
Reference in New Issue
Block a user