opencode
opencode copied to clipboard
fix(tui): show warning when opening WebUI without server mode
Summary
Fixes #8848
When OpenCode runs without --port flag, the "Open WebUI" command attempts to open http://opencode.internal which is a non-resolvable internal URL used only for RPC communication.
Changes
- Added a check in the "Open WebUI" command handler to detect when the URL is the internal placeholder
- Shows a helpful warning toast explaining how to enable server mode instead of silently failing
Before
Clicking "Open WebUI" → Browser opens with http://opencode.internal → ERR_NAME_NOT_RESOLVED
After
Clicking "Open WebUI" → Toast warning: "WebUI requires server mode. Restart with: opencode --port 4096"
Testing
- Run
opencode(without --port flag) - Press Cmd+P → Select "Open WebUI"
- Verify warning toast appears instead of browser opening
Alternative Approaches Considered
- Hide the menu item when server not running - Would require passing server state through context, more invasive change
- Start server on-demand when WebUI requested - Adds complexity and may have side effects
- Show warning (chosen) - Minimal change, clear user feedback, explains the fix