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.
This commit is contained in:
Bryan Helmkamp 2026-04-21 09:12:30 -04:00
parent 1176bf6d60
commit 413112249c
No known key found for this signature in database

View file

@ -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 {