fix(desktop): backend startup failures now surface a dialog and report themselves - #174
Merged
Merged
Conversation
…isibly Before the first successful readiness, a backend that crashed on start was restarted forever with no window, tray icon, or dialog, and a backend that started but never answered was abandoned after a logged warning while the process sat invisible. Both wedges now cap: three failed spawns (or one readiness timeout) kill the run and show a native dialog with Try Again, Open Logs Folder, and Quit. Restarts after the backend has been ready once keep the old unbounded behavior. The failure also sends one anonymous crash report to PostHog (same consent and install id as server telemetry) carrying the exit code and a stderr tail with the user's home directory scrubbed, so startup failures in the field become visible without asking users for log files.
…lures A broken install (missing dist/bin.mjs) retried on the restart schedule without ever creating a run, so the new failure cap never fired and the loop stayed invisible. The missing-entry branch now applies the same three-attempt budget and surfaces the same prompt.
- Consent now decodes settings.json with the same lenient JSONC parser the server uses; strict JSON.parse treated commented files as unreadable and defaulted a disabled opt-out back to enabled. - The crash report is skipped when the anonymous install id cannot be persisted, matching server telemetry, instead of sending throwaway ids. - stop() interrupts a pending startup-failure prompt fiber, and a retry answered after someone else started the backend no longer fights them. - Output drains are flushed (bounded) before the failure path reads the stderr tail, without delaying normal run finalization.
- The recovery prompt can no longer fail back into invisibility: a defect in the dialog falls back to a plain error box and a clean quit, and the crash report is sent concurrently instead of delaying the dialog. - A window-open failure after backend readiness re-arms the startup failure cap instead of unlocking unbounded silent restarts. - Backend port discovery gets a 30s deadline routed to the existing fatal startup error box; a hanging bind probe wedged before the manager ran. - Crash-report stderr tail shrinks to 2000 chars and passes a credential redaction pass on top of home-directory scrubbing. - The second-instance dialog now points at the recovery dialog and the Task Manager Details tab.
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
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.
Problem
On a machine where the backend fails to start, the desktop shell was invisible forever: before the first successful readiness it restarted a crashing backend endlessly (or abandoned an alive-but-unresponsive one after a logged 60s timeout), with no window, no tray icon, and no dialog. Windows users then hit the "Threadlines is already running" box on every second click. A field report (Windows, latest stable, recurring after reboot) matches this exactly; PostHog shows that install has never sent a boot heartbeat on any version.
Fix
desktop.backend.startup_failedPostHog event under the existing telemetry consent (same lenient JSONC settings decode and anonymous install id as the server), with exit code and a 2000-char stderr tail that has the home directory scrubbed and credential-shaped values redacted.