Skip to content

fix(tui): exit cleanly when startup probes cannot reach the server - #48162

Open
holny wants to merge 1 commit into
anomalyco:v2from
holny:tui-startup-exit
Open

fix(tui): exit cleanly when startup probes cannot reach the server#48162
holny wants to merge 1 commit into
anomalyco:v2from
holny:tui-startup-exit

Conversation

@holny

@holny holny commented Sep 9, 2026

Copy link
Copy Markdown

Issue for this PR

Fixes #36688

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

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 ClientError through Effect.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 typecheck in packages/tui and packages/cli
  • bun test in packages/tui (1176 passing) and packages/cli (254 passing)
  • New test/error-message.test.ts covers the ClientError formatting and exit code

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Supersedes #46726 — the PR head fork was accidentally deleted on 2026-09-09 (not intentional, see the notification comment there); re-filing so the review can continue. Original conversation: #46726

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.
@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant