Simplify startup thread handling

This commit is contained in:
Eric Traut
2026-05-19 21:43:27 -07:00
parent 0db29bec43
commit b80dd4c536
3 changed files with 6 additions and 17 deletions

View File

@@ -585,21 +585,17 @@ fn spawn_startup_thread_start(
let request_handle = app_server.request_handle();
let thread_params_mode = app_server.thread_params_mode();
let remote_cwd_override = app_server.remote_cwd_override().map(Path::to_path_buf);
let event_request_id = request_id.clone();
tokio::spawn(async move {
let result = crate::app_server_session::start_thread_with_request_handle(
request_handle,
request_id,
request_id.clone(),
config,
thread_params_mode,
remote_cwd_override,
)
.await
.map_err(|err| format!("{err:#}"));
app_event_tx.send(AppEvent::StartupThreadStarted {
request_id: event_request_id,
result,
});
app_event_tx.send(AppEvent::StartupThreadStarted { request_id, result });
});
}

View File

@@ -453,14 +453,9 @@ impl App {
self.chat_widget.maybe_send_next_queued_input();
}
Err(err) => {
let message =
format!("Failed to start a fresh session through the app server: {err}");
tracing::warn!(
error = %err,
"startup thread/start failed"
);
self.chat_widget.add_error_message(message.clone());
return Err(color_eyre::eyre::eyre!(message));
return Err(color_eyre::eyre::eyre!(
"Failed to start a fresh session through the app server: {err}"
));
}
}
Ok(())

View File

@@ -186,8 +186,6 @@ async fn startup_thread_start_failure_returns_error() {
let (mut app, _app_event_rx, _op_rx) = make_test_app_with_channels().await;
let request_id = "startup-thread-start-failed".to_string();
app.pending_startup_thread_start_request_id = Some(request_id.clone());
app.chat_widget
.set_queue_submissions_until_session_configured(/*queue*/ true);
let mut app_server = Box::pin(crate::start_embedded_app_server_for_picker(
app.chat_widget.config_ref(),
@@ -239,7 +237,7 @@ fn stale_startup_thread_started_removes_local_routing_state() -> Result<()> {
);
app.agent_navigation.upsert(
stale_thread_id,
Some("Stale".to_string()),
/*agent_nickname*/ None,
/*agent_role*/ None,
/*is_closed*/ false,
);