huskies: merge 892

This commit is contained in:
dave
2026-05-12 16:46:37 +00:00
parent c3144b7937
commit b76633b79b
4 changed files with 86 additions and 1 deletions
@@ -2,6 +2,7 @@
use crate::agents::{feature_branch_has_unmerged_changes, move_story_to_done};
use crate::http::context::AppContext;
use crate::pipeline_state::{Stage, read_typed};
use serde_json::Value;
pub(crate) fn tool_accept_story(args: &Value, ctx: &AppContext) -> Result<String, String> {
@@ -12,9 +13,18 @@ pub(crate) fn tool_accept_story(args: &Value, ctx: &AppContext) -> Result<String
let project_root = ctx.services.agents.get_project_root(&ctx.state)?;
// Determine whether the story is in MergeFailure (manual-recovery path).
// For MergeFailure, the feature branch deliberately has unmerged code — the
// operator is accepting the story without a clean merge, so skip the check.
let in_merge_failure = read_typed(story_id)
.ok()
.flatten()
.map(|item| matches!(item.stage, Stage::MergeFailure { .. }))
.unwrap_or(false);
// Bug 226: Refuse to accept if the feature branch has unmerged code.
// The code must be squash-merged via merge_agent_work first.
if feature_branch_has_unmerged_changes(&project_root, story_id) {
if !in_merge_failure && feature_branch_has_unmerged_changes(&project_root, story_id) {
return Err(format!(
"Cannot accept story '{story_id}': feature branch 'feature/story-{story_id}' \
has unmerged changes. Use merge_agent_work to squash-merge the code into \