From 8057739c85d32ab0de8877a01002d29f220959cd Mon Sep 17 00:00:00 2001 From: Bryan Helmkamp Date: Fri, 24 Apr 2026 10:38:22 -0400 Subject: [PATCH] perf(workflow): cap final-patch timeout at 10s in all cases MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Success runs used 30s, failure runs 10s. 30s is too long to block terminal-event emission — git diff on a healthy workspace returns well under a second; the timeout is a failsafe, not a common-case budget. Users watching the stream shouldn't wait 30s for a degraded case. Unifying at 10s removes the status-dependent branch and the final_status argument to compute_final_patch. Co-Authored-By: Claude Opus 4.7 (1M context) --- .../fabro-workflow/src/pipeline/finalize.rs | 22 +++++++------------ 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/lib/crates/fabro-workflow/src/pipeline/finalize.rs b/lib/crates/fabro-workflow/src/pipeline/finalize.rs index 470e53381..5895d1b55 100644 --- a/lib/crates/fabro-workflow/src/pipeline/finalize.rs +++ b/lib/crates/fabro-workflow/src/pipeline/finalize.rs @@ -178,19 +178,13 @@ pub async fn write_finalize_commit( .await; } -/// Failed and cancelled runs use a shorter diff timeout so a corrupted -/// workspace can't stall downstream consumers waiting on the terminal event. -async fn compute_final_patch( - run_options: &RunOptions, - services: &RunServices, - status: StageStatus, -) -> Option { +/// Bounded to 10s so a corrupted or unresponsive workspace can't stall +/// downstream consumers waiting on the terminal event. Git diff on a +/// healthy workspace returns in well under a second; timeout is a failsafe, +/// not a common-case budget. +async fn compute_final_patch(run_options: &RunOptions, services: &RunServices) -> Option { let base_sha = run_options.git.as_ref().and_then(|g| g.base_sha.clone())?; - let timeout_ms = match status { - StageStatus::Success | StageStatus::PartialSuccess => 30_000, - _ => 10_000, - }; - match git_diff_with_timeout(&*services.sandbox, &base_sha, timeout_ms).await { + match git_diff_with_timeout(&*services.sandbox, &base_sha, 10_000).await { Ok(patch) if !patch.is_empty() => Some(patch), Ok(_) => None, Err(err) => { @@ -325,14 +319,14 @@ pub async fn finalize(retroed: Retroed, options: &FinalizeOptions) -> Result