From f39255594c0ba623102b55ca8b9e1f1aa42d4910 Mon Sep 17 00:00:00 2001 From: Bryan Helmkamp Date: Wed, 1 Apr 2026 21:29:44 -0700 Subject: [PATCH] Pass run IDs directly into detached start services --- lib/crates/fabro-cli/src/commands/run/detached.rs | 1 + lib/crates/fabro-server/src/server.rs | 1 + lib/crates/fabro-workflow/src/operations/start.rs | 7 +++---- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/crates/fabro-cli/src/commands/run/detached.rs b/lib/crates/fabro-cli/src/commands/run/detached.rs index c2f5e7ad6..01e1feef0 100644 --- a/lib/crates/fabro-cli/src/commands/run/detached.rs +++ b/lib/crates/fabro-cli/src/commands/run/detached.rs @@ -51,6 +51,7 @@ pub(crate) async fn execute( let runtime_state = RuntimeState::new(&run_dir); let services = StartServices { + run_id: run_record.run_id, cancel_token: None, emitter: Arc::new(EventEmitter::new(run_record.run_id)), interviewer: Arc::new(FileInterviewer::new( diff --git a/lib/crates/fabro-server/src/server.rs b/lib/crates/fabro-server/src/server.rs index b60c36fc3..1839da772 100644 --- a/lib/crates/fabro-server/src/server.rs +++ b/lib/crates/fabro-server/src/server.rs @@ -738,6 +738,7 @@ async fn execute_run(state: Arc, run_id: RunId) { } }; let services = operations::StartServices { + run_id, cancel_token: Some(Arc::clone(&cancel_token)), emitter: Arc::clone(&emitter), interviewer: Arc::clone(&interviewer) as Arc, diff --git a/lib/crates/fabro-workflow/src/operations/start.rs b/lib/crates/fabro-workflow/src/operations/start.rs index ff75d17e6..3c1d6c184 100644 --- a/lib/crates/fabro-workflow/src/operations/start.rs +++ b/lib/crates/fabro-workflow/src/operations/start.rs @@ -65,6 +65,7 @@ struct RunSession { } pub struct StartServices { + pub run_id: RunId, pub cancel_token: Option>, pub emitter: Arc, pub interviewer: Arc, @@ -118,15 +119,12 @@ pub(super) async fn execute_persisted_run( mut services: StartServices, ) -> Result { let cancel_token = services.cancel_token.clone(); + let run_id = services.run_id; let inner_store = Arc::clone(&services.run_store); let projection_run_dir = run_dir.to_path_buf(); services.run_store = Arc::new( DiskProjectingRunStore::new(inner_store, run_dir.to_path_buf()).on_projection_error( Arc::new(move |projection_error: ProjectionError| { - let Some(run_id) = load_run_id(&projection_run_dir) else { - return; - }; - // Write directly to progress.jsonl/live.json so projection failures do not // recurse back through the decorated store.append_event() path. let envelope = canonicalize_event( @@ -947,6 +945,7 @@ mod tests { registry: Arc, ) -> StartServices { StartServices { + run_id: fixtures::RUN_1, cancel_token: None, emitter, interviewer: Arc::new(fabro_interview::AutoApproveInterviewer),