perf(workspace): move blocking workspace commands off the GTK main thread#85
Merged
Zeus-Deus merged 1 commit intoJun 9, 2026
Conversation
…read Six workspace commands were sync #[tauri::command] fns calling populate_git_info, which shells out to 5-8 git subprocesses. In Tauri v2 a sync command runs on the GTK main thread, so each call froze the whole UI (~100-300ms warm, unbounded if a git subprocess wedges). - Convert create_workspace, create_empty_workspace, get_or_create_home_workspace, create_workspace_with_preset, refresh_workspace_git_info, and checkout_default_branch_in_workspace to async fn (Tokio worker pool) using the existing populate_git_info_async helper (blocking pool). - checkout_default_branch additionally wrapped in spawn_blocking. - create_workspace_impl becomes async; its control-socket caller in dispatch_request is already async and now awaits it. - package-lock.json: sync version field to 0.8.0 (stale since the bump). Same pattern as commands/git.rs (see its header note). Frontend invoke() already returns a Promise, so no caller changes are needed. Closes #74
This was referenced Jun 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #74.
What
Six workspace commands were sync
#[tauri::command]fns callingpopulate_git_info, which shells out to 5–8gitsubprocesses. In Tauri v2 a sync command runs on the GTK main thread, so each call froze the entire UI (~100–300 ms warm cache, unbounded if agitsubprocess wedges).create_workspace,create_empty_workspace,get_or_create_home_workspace,create_workspace_with_preset,refresh_workspace_git_info,checkout_default_branch_in_workspace→async fn, git work via the existingpopulate_git_info_async(blocking pool).checkout_default_branch(slow on large repos) additionally wrapped inspawn_blocking.create_workspace_implbecomes async; its control-socket caller (dispatch_request) was already async and now awaits it.State/non-Sendguard held across an.await(only ownedPathBufs cross thespawn_blockingboundary — same shape ascommands/git.rsandcreate_worktree_workspace_impl).invoke()already returns a Promise → zero caller changes.package-lock.json: version field synced to 0.8.0 (stale since the bump).Verification
cargo check✅cargo test✅ — 1677 passed; the 2 failures (project_codemux_entry_is_filtered_out,resolve_binary_finds_native_binary_from_project_root) fail identically on the unmodified baseline (machine-local MCP config / sandbox), pre-existing.npm run check✅,npm run test✅ (1818 tests)E2E (real app, real IPC, pathological git)
Booted the actual built app in an isolated environment (own
XDG_RUNTIME_DIR/config/data/HOME, dedicated identifier + devUrl) with a git shim on PATH that sleeps 1.5 s per invocation (simulating a huge repo / cold cache), then drovecreate_workspacethrough the control socket against a real repo while probing concurrently:create_workspacetook 22.6 s of wall-clock git work (shim exercised) and succeeded; the new workspace snapshot carried real git info (branch=main,changed_files=1).S / poll_schedule_timeout(healthy event-loop park). Neverwait4/pipe_read— the signature a sync handler would show while reaping a git child.