fix(desktop): surface sidecar startup failures instead of hanging silently (#382) - #479
Open
lmanchu wants to merge 1 commit into
Open
fix(desktop): surface sidecar startup failures instead of hanging silently (#382)#479lmanchu wants to merge 1 commit into
lmanchu wants to merge 1 commit into
Conversation
…ently The packaged app rendered a fully navigable UI even when the Python sidecar never came up (spawn failed, exited during startup, or never bound its port) - every backend call then hung forever with no error surfaced anywhere (andrewyng#382). The only signal was an eprintln to a stderr nobody can see under a Finder launch. The shell now records what happened to the sidecar ("starting" -> "listening", or "spawn_failed"/"exited" with the exit detail) and exposes it through a get_server_status command. When the SPA's boot health polling fails it asks the shell: a dead sidecar fails fast to a full-stop fault screen showing the server log and binary paths; an unresponsive one gets the same screen once retries exhaust. Browser builds keep the existing behavior. 🤖 Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Happy <yesreply@happy.engineering>
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.
Summary
Fixes the "silent" half of #382: on the packaged desktop app, when the Python sidecar never comes up, the UI renders fully navigable while every backend call hangs forever — no error surfaced anywhere.
Root-cause chain (code-verified on main):
server_bin()(src-tauri/src/lib.rs) resolves through the sidecar candidates; whenspawn()fails, the only signal is aneprintln!— invisible for a Finder-launched app. The shell then continues with no server.App.tsx) burns its ~20s of retries and then presents the normal UI as if everything were fine.What changed
"starting"→"listening"once the port accepts, or"spawn_failed"/"exited"(with the exit status) — and exposes it via a newget_server_statuscommand. A short-lived watcher thread resolves the state and exits; steady-state cost is zero.This doesn't fix whatever kills a given machine's sidecar (likely several distinct causes behind #382), but it converts each of them from an indefinite silent hang into a visible, diagnosable stop — the log path shown is exactly where the answer lands.
For anyone hitting this today on current builds:
~/.config/coworker/logs/openworker-server.logalready captures the sidecar's stdout/stderr and should say why yours died.Validation
npx tsc --noEmit— cleannpx vitest run— 114 passed (3 new,ServerFaultcomponent)npx playwright test e2e/server-fault.spec.ts e2e/boot.spec.ts e2e/error-retry.spec.ts e2e/smoke.spec.ts— 6 passed (1 new: dead sidecar → fault screen, and the folder gate must not appear)cargo checkinsrc-tauri— cleanScreenshots
Broken (current main, simulated dead sidecar): the app renders a normal, fully navigable UI; every backend action hangs with no error:
Fixed — sidecar exited during startup:
Fixed — sidecar alive but never answering (retries exhausted):
🤖 Generated with Claude Code