huskies: merge 866
This commit is contained in:
@@ -104,8 +104,6 @@ pub(crate) fn should_block_story(
|
||||
max_retries: u32,
|
||||
stage_label: &str,
|
||||
) -> Option<String> {
|
||||
use crate::io::story_metadata::write_blocked_in_content;
|
||||
|
||||
if max_retries == 0 {
|
||||
return None;
|
||||
}
|
||||
@@ -119,23 +117,16 @@ pub(crate) fn should_block_story(
|
||||
}
|
||||
|
||||
if new_count >= max_retries {
|
||||
let reason =
|
||||
format!("Retry limit exceeded ({new_count}/{max_retries}) at {stage_label} stage");
|
||||
slog_warn!(
|
||||
"[pipeline] Story '{story_id}' reached retry limit ({new_count}/{max_retries}) \
|
||||
at {stage_label} stage. Marking as blocked."
|
||||
);
|
||||
if let Some(contents) = crate::db::read_content(story_id) {
|
||||
let blocked = write_blocked_in_content(&contents);
|
||||
crate::db::write_content(story_id, &blocked);
|
||||
let stage = crate::pipeline_state::read_typed(story_id)
|
||||
.ok()
|
||||
.flatten()
|
||||
.map(|i| i.stage.dir_name().to_string())
|
||||
.unwrap_or_else(|| "2_current".to_string());
|
||||
crate::db::write_item_with_content(story_id, &stage, &blocked);
|
||||
if let Err(e) = crate::agents::lifecycle::transition_to_blocked(story_id, &reason) {
|
||||
slog_error!("[pipeline] Failed to transition '{story_id}' to Blocked: {e}");
|
||||
}
|
||||
Some(format!(
|
||||
"Retry limit exceeded ({new_count}/{max_retries}) at {stage_label} stage"
|
||||
))
|
||||
Some(reason)
|
||||
} else {
|
||||
slog!(
|
||||
"[pipeline] Story '{story_id}' retry {new_count}/{max_retries} at {stage_label} stage."
|
||||
|
||||
@@ -114,19 +114,20 @@ impl AgentPool {
|
||||
Err(e) => e.clone(),
|
||||
};
|
||||
let is_no_commits = reason.contains("no commits to merge");
|
||||
if let Some(contents) = crate::db::read_content(&sid) {
|
||||
let with_failure = crate::io::story_metadata::write_merge_failure_in_content(
|
||||
&contents, &reason,
|
||||
);
|
||||
let updated = if is_no_commits {
|
||||
crate::io::story_metadata::write_blocked_in_content(&with_failure)
|
||||
} else {
|
||||
with_failure
|
||||
};
|
||||
crate::db::write_content(&sid, &updated);
|
||||
crate::db::write_item_with_content(&sid, "4_merge", &updated);
|
||||
if !is_no_commits {
|
||||
// Write merge_failure to content for non-blocking failures.
|
||||
if let Some(contents) = crate::db::read_content(&sid) {
|
||||
let updated = crate::io::story_metadata::write_merge_failure_in_content(
|
||||
&contents, &reason,
|
||||
);
|
||||
crate::db::write_content(&sid, &updated);
|
||||
crate::db::write_item_with_content(&sid, "4_merge", &updated);
|
||||
}
|
||||
}
|
||||
if is_no_commits {
|
||||
if let Err(e) = crate::agents::lifecycle::transition_to_blocked(&sid, &reason) {
|
||||
crate::slog_error!("[merge] Failed to transition '{sid}' to Blocked: {e}");
|
||||
}
|
||||
let _ = pool
|
||||
.watcher_tx
|
||||
.send(crate::io::watcher::WatcherEvent::StoryBlocked {
|
||||
|
||||
Reference in New Issue
Block a user