Skip to content

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

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

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
Contributor

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.

@holny

holny commented Sep 16, 2026

Copy link
Copy Markdown
Contributor Author

Gentle bump on this one — TUI startup crash, open since the 9th, checks green, no review yet. If you'd prefer a different shape for the exit path, say the word and I'll rework it.

@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Automated PR Cleanup

Thank you for contributing to opencode.

Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions.

This PR was closed because it matched the following cleanup criteria:

  • The PR was created more than 1 month ago
  • The PR had fewer than 2 positive reactions
  • Positive reactions are counted as thumbs-up, heart, celebration, or rocket reactions on the PR

PRs created within the last month are not affected by this cleanup.

If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate.

Thanks again for taking the time to contribute.

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