Skip to content

Fix dev blank screen and remote cron/dashboard API routing - #870

Open
dataguybobby wants to merge 6 commits into
fathah:mainfrom
dataguybobby:fix/dashboard-api-405s
Open

Fix dev blank screen and remote cron/dashboard API routing#870
dataguybobby wants to merge 6 commits into
fathah:mainfrom
dataguybobby:fix/dashboard-api-405s

Conversation

@dataguybobby

Copy link
Copy Markdown

Problem

Dev blank screen (npm run dev)

Running Hermes Desktop locally could show a white window because the renderer failed during Vite module evaluation:

  • @react-three/drei (~3.5MB) pre-bundle races with Electron startup — Electron loads before the dep optimizer finishes.
  • Corrupt .vite cache (.map present without .js) after interrupted re-optimizes.
  • Stale optimize-dep URLs return 504 on first load.
  • Opening the Office tab discovered SkeletonUtils.js, triggering mid-session re-optimize that invalidated drei mid-request.

Chat startup also eagerly imported the Office 3D stack, coupling startup to drei.

Remote cron and gateway readiness

Remote/dashboard mode had two related failures:

  • Cron HTTP calls hit gateway /api/jobs, which returns 405 when the active transport is the dashboard (/api/cron/jobs).
  • isApiServerReady treated dashboard SPA HTML responses on /health as a healthy gateway, causing false positives during remote connection setup.

Resolution

Dev loading

  • Lazy-load the Office tab in Layout and Office3D in Office so Chat mounts without drei.
  • Pre-bundle @react-three/drei, fiber, three, troika, and SkeletonUtils via optimizeDeps.include.
  • scripts/ensure-vite-deps.mjs clears corrupt drei cache entries before npm run dev.
  • scripts/vite-wait-for-drei.ts blocks the first HTML response until drei pre-bundle completes.
  • Bounded dev recovery: vite:preloadError reload in the renderer; main process reloads once if #root is still empty after 4s.
  • Added npm run dev:clean for stale cache resets.

Remote API routing

  • listCronJobs and mutations prefer dashboard /api/cron/jobs, falling back to gateway /api/jobs on 404/405.
  • Map dashboard /trigger to gateway /run on fallback.
  • isApiServerReady rejects text/html /health responses.
  • Remote connection tests prefer /api/status when chat transport is not legacy.

Test plan

  • npm test — 1822 passed
  • npm run dev — Chat tab loads on first launch (no blank screen)
  • Open Office tab — 3D scene loads without dynamic import failures
  • Remote mode — cron jobs list/create/delete against dashboard URL
  • Remote mode — legacy gateway-only host still works via /api/jobs fallback
  • Remote connection test — dashboard HTML /health no longer marks gateway ready

Made with Cursor

dataguybobby and others added 4 commits July 21, 2026 23:23
Renames previously updated the local sessions.json cache first and
swallowed state.db errors, so the UI looked successful until the next
syncSessionCache restored the old Hermes title. Write the durable DB
row first (honoring unique titles and the 100-char cap), only then
mirror into the cache, and toast/rollback when the write fails.

Co-authored-by: Cursor <cursoragent@cursor.com>
Pull title policy into src/shared/session-title and the optimistic
rename UX into confirmSessionRename so the sidebar and Sessions modal
stop duplicating toast/rollback/refocus logic. Keeps both screens under
the 1k-line ceiling and prevents UI/DB whitespace drift on rename.

Co-authored-by: Cursor <cursoragent@cursor.com>
fix: persist session renames through state.db sync
Dev: lazy-load Office to keep drei off the Chat startup path, pre-bundle
Three.js deps (including SkeletonUtils), clear corrupt Vite cache, and
recover from stale optimize-dep 504s with bounded reloads.

Remote: route cron through dashboard /api/cron/jobs with gateway /api/jobs
fallback on 404/405; reject dashboard HTML /health as gateway-ready; prefer
/api/status for remote connection tests when not on legacy transport.

Co-authored-by: Cursor <cursoragent@cursor.com>
@greptile-apps

greptile-apps Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR improves development startup, remote API routing, and session rename persistence. The main changes are:

  • Lazy-loads the Office 3D stack and waits for Vite dependency prebundling.
  • Adds bounded renderer recovery and a cross-platform cache-clean command.
  • Routes cron requests across dashboard and legacy gateway APIs.
  • Rejects dashboard HTML when checking gateway health.
  • Persists validated session titles before updating the local cache.

Confidence Score: 5/5

This looks safe to merge.

  • The renderer reload cooldown persists across reloads and stops the reported loop.
  • The cache-clean command now uses cross-platform Node filesystem APIs.
  • No blocking follow-up issue was found in these fixes.

Important Files Changed

Filename Overview
src/renderer/src/main.tsx Adds a persistent cooldown that prevents repeated preload-error reloads.
scripts/ensure-vite-deps.mjs Adds cross-platform cleanup for stale or corrupt Vite dependency caches.
scripts/vite-wait-for-drei.ts Delays the first development document until the drei prebundle is available.
src/main/cronjobs.ts Supports dashboard cron routes with legacy gateway fallback and response normalization.
src/main/hermes.ts Uses transport-aware readiness probes and rejects HTML gateway health responses.
src/main/session-cache.ts Validates and persists session renames before updating the JSON cache.

Reviews (3): Last reviewed commit: "fix: address review feedback on dev-relo..." | Re-trigger Greptile

Comment thread src/renderer/src/main.tsx
Comment thread package.json Outdated
fathah added 2 commits July 23, 2026 08:18
- Throttle the dev vite:preloadError reload via sessionStorage so a
  persistent failure surfaces an error instead of a reload loop
- Make dev:clean cross-platform (ensure-vite-deps.mjs --force) instead
  of Unix-only rm -rf
- Fix TS6133 unused param in vite-wait-for-drei middleware
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