Skip to content

Fix packaged desktop stuck waiting for API - #24

Merged
Modsofthenation merged 1 commit into
mainfrom
cursor/fix-desktop-api-startup-e5b1
Jul 25, 2026
Merged

Modsofthenation merged 1 commit into
mainfrom
cursor/fix-desktop-api-startup-e5b1

Conversation

@Modsofthenation

Copy link
Copy Markdown
Owner

Summary

Packaged desktop builds (including Windows) could hang forever on “Loading…” / never reach the API. Three root causes:

  1. Wrong API URL – the webview used relative /api, which only works behind the Vite proxy. Packaged Tauri has no proxy.
  2. Wrong data dir – PRM_DATA_DIR defaulted to CARGO_MANIFEST_DIR/.../data (a CI/build-machine path), so the sidecar could fail to start on a user PC.
  3. Silent auto-seed – bundling seed.ts into prm-api.mjs made import.meta.url === argv[1] true, so every sidecar launch tried to seed.

Fixes

  • Inject window.__PRM_API_BASE_URL__ and route all UI fetches through apiUrl()
  • Use OS app-data dir for packaged vaults (%APPDATA%\com.prm.workbench on Windows)
  • Wait for /api/health (and log sidecar stdout/stderr to desktop-api.log)
  • UI waitForApi() retries on desktop
  • Seed CLI only runs when the entry filename is seed.ts / seed.js

Verified locally (Linux AppImage)

Built pnpm desktop:build, ran the AppImage under Xvfb:

  • Sidecar spawned from bundled resources
  • API healthy in ~200ms
  • UI shows Create workbench (not stuck loading)

Packaged desktop Create workbench

After merge, re-download the Windows artifact from the next green main desktop CI run.

To show artifacts inline, enable in settings.

Open in Web Open in Cursor 

Point the webview at an absolute API base URL, store vault data in the
OS app-data dir, wait for /api/health before load, and stop the bundled
sidecar from auto-seeding on every launch.

Co-authored-by: Damon  <[email protected]>
@Modsofthenation
Modsofthenation marked this pull request as ready for review July 25, 2026 23:17
@Modsofthenation
Modsofthenation merged commit 4eafc2f into main Jul 25, 2026
2 checks passed
@cursor
cursor Bot deleted the cursor/fix-desktop-api-startup-e5b1 branch August 12, 2026 11:36
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.

2 participants