Skip to content

fix(server): serve workspace list instantly on fetch, reconcile in background#204

Merged
boudra merged 2 commits intogetpaseo:mainfrom
skevetter:fix/workspace-loading-delay
Apr 7, 2026
Merged

fix(server): serve workspace list instantly on fetch, reconcile in background#204
boudra merged 2 commits intogetpaseo:mainfrom
skevetter:fix/workspace-loading-delay

Conversation

@skevetter
Copy link
Copy Markdown
Contributor

@skevetter skevetter commented Apr 6, 2026

fetch_workspaces_request blocked on reconcileActiveWorkspaceRecords() before responding. This runs getCheckoutStatusLite (git operations) on every active workspace, so with 10+ workspaces the projects list appears empty for several seconds after every daemon restart or reconnect.

To fix this issue, return the registry snapshot immediately, then run reconciliation in the background. When reconciliation finds changed workspaces (stale worktrees being archived, git metadata updates), it pushes workspace_update events through the existing subscription so the client updates live.

fetch_workspaces_request arrives
  → respond immediately with registry snapshot  ← projects appear instantly
  → background: reconcileActiveWorkspaceRecords()
  → push workspace_update for any changed workspaces

Fixes #203

…ckground

Previously fetch_workspaces_request awaited reconcileActiveWorkspaceRecords()
before responding — this ran git operations (getCheckoutStatusLite) on every
active workspace, causing projects to appear empty for several seconds after
daemon restart or reconnect.

Now the registry snapshot is returned immediately and reconciliation runs in
the background. Any changed workspaces (e.g. stale worktrees being archived)
are pushed as workspace_update events through the existing subscription.
…e git calls

describeWorkspaceRecord was running two git operations per workspace:
  - buildProjectPlacement (to refresh display name)
  - getCheckoutShortstat (for diff indicator)

With 13 workspaces this caused fetch_workspaces_request to take 7-15s
(observed as ws_slow_request in logs).

Split into two methods:
  - describeWorkspaceRecord: uses only persisted data, returns instantly
  - describeWorkspaceRecordWithGitData: runs git ops, used for open_project
    and create_worktree responses where fresh data is needed immediately

The snapshot path (initial load + background reconciliation) now uses the
fast variant. diffStat is null on initial load; it will be pushed later via
workspace_update once a git-aware path triggers.
@skevetter skevetter marked this pull request as draft April 6, 2026 12:47
@boudra
Copy link
Copy Markdown
Collaborator

boudra commented Apr 6, 2026

cheers, this will most probably be superseded by #197

big revamp of the workspace stuff

@skevetter
Copy link
Copy Markdown
Contributor Author

big revamp

That looks like a massive revamp! BTW, love the app!

@boudra boudra marked this pull request as ready for review April 7, 2026 02:35
@boudra boudra merged commit cdbaa8d into getpaseo:main Apr 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Projects take a long time to load after daemon restart

2 participants