From 413112249c428bf66975f04b63a5223730d23fdf Mon Sep 17 00:00:00 2001 From: Bryan Helmkamp Date: Tue, 21 Apr 2026 09:12:30 -0400 Subject: [PATCH] fix(workflow): keep event replay alive on unknown stage status Fall back to StageStatus::Fail with a warning when historical event data contains an unrecognized stage status string instead of panicking during replay. --- lib/crates/fabro-workflow/src/event.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/crates/fabro-workflow/src/event.rs b/lib/crates/fabro-workflow/src/event.rs index 31116566c..5425d303b 100644 --- a/lib/crates/fabro-workflow/src/event.rs +++ b/lib/crates/fabro-workflow/src/event.rs @@ -1348,7 +1348,14 @@ fn billed_token_counts_from_llm(usage: &LlmTokenCounts) -> BilledTokenCounts { } fn stage_status_from_string(status: &str) -> StageStatus { - serde_json::from_value(Value::String(status.to_string())).expect("valid stage status") + status.parse().unwrap_or_else(|_| { + tracing::warn!( + status, + "unknown stored stage status in StageCompleted event; \ + falling back to StageStatus::Fail to keep replay alive" + ); + StageStatus::Fail + }) } fn stored_event_fields(event: &Event, scope: Option<&StageScope>) -> StoredEventFields {