From 94083967917f012d8a681774ae577c2091e574ae Mon Sep 17 00:00:00 2001 From: Willow Sparks Date: Sat, 31 Oct 2026 23:55:40 +0000 Subject: [PATCH] fix(cli): propagate session-manager load failures Adapt the Result-returning open and materialize APIs without changing lazy constructors or adding a recovery fallback. Preserve resume test assertions. Source checkpoint depends on manager 6c28d7212; combined native validation awaits the reserved build slot. --- crates/pa-cli/src/print_boundary/tests.rs | 6 ++++-- crates/pa-cli/src/print_goal.rs | 4 +++- crates/pa-cli/src/print_runtime.rs | 7 ++----- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/crates/pa-cli/src/print_boundary/tests.rs b/crates/pa-cli/src/print_boundary/tests.rs index 4e19daeae..73c479bd9 100644 --- a/crates/pa-cli/src/print_boundary/tests.rs +++ b/crates/pa-cli/src/print_boundary/tests.rs @@ -399,7 +399,8 @@ async fn stale_overflow_error_recovers_before_the_next_prompt_after_a_resume() { .map(|entry| entry.path()) .find(|path| path.extension().and_then(|extension| extension.to_str()) == Some("jsonl")) .expect("the run-one session file"); - let resumed = SessionManager::open(dir_a.path(), &dir_a.path().join("sessions"), &session_file); + let resumed = SessionManager::open(dir_a.path(), &dir_a.path().join("sessions"), &session_file) + .expect("reopen the persisted session"); let (engine_b, _dir_b, model_b) = faux_engine_with_settings( json!({ "responses": [ @@ -880,7 +881,8 @@ async fn pre_turn_threshold_arm_compacts_a_resumed_session_before_the_prompt() { .map(|entry| entry.path()) .find(|path| path.extension().and_then(|extension| extension.to_str()) == Some("jsonl")) .expect("the run-one session file"); - let resumed = SessionManager::open(dir_a.path(), &dir_a.path().join("sessions"), &session_file); + let resumed = SessionManager::open(dir_a.path(), &dir_a.path().join("sessions"), &session_file) + .expect("reopen the persisted session"); let (engine_b, _dir_b, model_b) = faux_engine_with_settings( json!({ "contextWindow": 20000, diff --git a/crates/pa-cli/src/print_goal.rs b/crates/pa-cli/src/print_goal.rs index 03b441a0d..87b7b3f42 100644 --- a/crates/pa-cli/src/print_goal.rs +++ b/crates/pa-cli/src/print_goal.rs @@ -1383,7 +1383,9 @@ mod tests { dir.path(), &dir.path().join("sessions"), ); - session_manager.materialize_session_file(Some(dir.path().join("sessions"))); + session_manager + .materialize_session_file(Some(dir.path().join("sessions"))) + .expect("materialize the resumed session"); session_manager .append_message(pa_types::session::AgentMessage::User( pa_types::ai::UserMessage { diff --git a/crates/pa-cli/src/print_runtime.rs b/crates/pa-cli/src/print_runtime.rs index 9ea682c8c..3d15b5c41 100644 --- a/crates/pa-cli/src/print_runtime.rs +++ b/crates/pa-cli/src/print_runtime.rs @@ -1344,11 +1344,8 @@ fn open_session_file( explicit_cwd_override: Option<&std::path::Path>, ) -> Result { let session_cwd = stored_session_cwd(path, fallback_cwd, explicit_cwd_override)?; - Ok(pa_core::session::manager::SessionManager::open( - &session_cwd, - session_dir, - path, - )) + pa_core::session::manager::SessionManager::open(&session_cwd, session_dir, path) + .map_err(|error| error.to_string()) } /// The cwd an opened session runs in: the explicit override (main.ts -- knotmirror 0.0.1