Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions desktop/src-tauri/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -300,9 +300,13 @@ pub fn run() {
resolve_persisted_identity(&app_handle, &state)
.map_err(|e| -> Box<dyn std::error::Error> { e.into() })?;

if let Err(error) = restore_managed_agents_on_launch(&app_handle) {
eprintln!("sprout-desktop: failed to restore managed agents: {error}");
}
// Keep launch-time agent restoration off the synchronous setup path
// so the frontend can mount and reveal the window promptly.
tauri::async_runtime::spawn_blocking(move || {
if let Err(error) = restore_managed_agents_on_launch(&app_handle) {
eprintln!("sprout-desktop: failed to restore managed agents: {error}");
}
});
Comment on lines +328 to +334
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Avoid restoring agents after shutdown begins

restore_managed_agents_on_launch is now launched as a detached spawn_blocking task, so it can race with the one-shot shutdown path in run (shutdown_done only allows shutdown_managed_agents once). If the user exits during startup, shutdown can run first and then this background restore task can still acquire the store lock and start local managed agents afterward, leaving agent processes running after the desktop app exits.

Useful? React with 👍 / 👎.


Ok(())
})
Expand Down
6 changes: 3 additions & 3 deletions desktop/src/app/App.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { getCurrentWindow } from "@tauri-apps/api/window";
import { useEffect } from "react";
import { useLayoutEffect } from "react";

import { AppShell } from "@/app/AppShell";

export function App() {
useEffect(() => {
getCurrentWindow().show();
useLayoutEffect(() => {
void getCurrentWindow().show();
}, []);

return <AppShell />;
Expand Down
Loading
Loading