fix(tui): exit cleanly when startup probes cannot reach the server - #46726
fix(tui): exit cleanly when startup probes cannot reach the server#46726holny wants to merge 1 commit into
Conversation
A TUI started while the server is electing or cold-booting after an update crashes with an unhandled transport defect: both the file.list probe and its location.get fallback fail and the ClientError escapes through Effect.tryPromise. Route the startup failure through the existing CLI error channel and format ClientError as a friendly "could not reach the OpenCode server" message with exit code 1.
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
|
Fixes #36688 — the linked-issue check doesn't seem to resolve the keyword from a fork PR, so referencing it here directly. |
|
The following comment was made by an LLM, it may be inaccurate: The search results show that PR #46726 (the current PR) appears in the results, but no other duplicate PRs are found. The other PRs returned are related to different features (registry changes, Console model recovery, IDE context, providers) and are not addressing the same issue. No duplicate PRs found |
|
Gentle nudge — still green and ready for review. Happy to adjust anything if the approach needs changes; the linked-issue workaround from my last comment also still applies (manual Development-panel link needed before merge). |
|
Superseded by #48162 - this PR's head fork was accidentally deleted on 2026-09-09 (not intentional); re-filed so the review can continue. Sorry for the noise. |
Issue for this PR
Fixes #36688
Type of change
What does this PR do?
A TUI started while the background server is electing or cold-booting after an update can fail both startup location probes and crash with an unhandled
ClientErrorthroughEffect.tryPromise. Route the startup failure through the existing CLI error channel so the TUI exits with a friendly "could not reach the server" message and exit code 1 instead of a raw stack dump.How did you verify your code works?
bun typecheckinpackages/tuiandpackages/clibun testinpackages/tui(1176 passing) andpackages/cli(254 passing)test/error-message.test.tscovers the ClientError formatting and exit codeChecklist