Skip to content

fix: improve Windows setup UX and persist tunnel provider choice#11

Open
CT4nk3r wants to merge 1 commit into
doza62:masterfrom
CT4nk3r:fix/windows-setup-issues
Open

fix: improve Windows setup UX and persist tunnel provider choice#11
CT4nk3r wants to merge 1 commit into
doza62:masterfrom
CT4nk3r:fix/windows-setup-issues

Conversation

@CT4nk3r

@CT4nk3r CT4nk3r commented Apr 26, 2026

Copy link
Copy Markdown

Summary

Addresses four issues found during setup and usage on Windows:

  1. Tunnel doesn't start in TUI mode/mobile silently returned No tunnel URL found when OpenCode was launched as the plain TUI. The plugin still gates on serve mode (per AGENTS.md, ctx.serverUrl is unsafe to use as a proxy because opencode debug wait provides it too), but now logs an actionable message at startup and the /mobile tool returns a multi-line message telling the user to run opencode serve --hostname 0.0.0.0 --port 4096.

  2. Tunnel provider choice not persistednpx opencode-mobile install --provider localtunnel previously did nothing at runtime because the plugin only read TUNNEL_PROVIDER env var. Now:

    • install.ts writes the choice to ~/.config/opencode-mobile/tunnel-config.json (merging with anything tunnel-setup wrote).
    • The plugin reads that file at runtime. Resolution order is: TUNNEL_PROVIDER env > persisted config > auto.
  3. --hostname defaults to 127.0.0.1 — install success output now contains a prominent warning that mobile features require opencode serve --hostname 0.0.0.0 (loopback-only is unreachable from a phone). README Quick Start updated accordingly.

  4. Permission approvals from mobile don't go through — added a troubleshooting section to the README documenting the expected flow (permission.asked → push payload with permissionId/sessionId/serverUrl → mobile POSTs back through the tunnel) and a curl-based diagnostic to isolate whether the bug is in the mobile app, the tunnel, or the OpenCode server. The actual approve-callback code lives in a separate repo (mobile app), so this PR only adds plumbing/docs to help users diagnose.

Files changed

  • index.ts — provider resolution from persisted config, better TUI/non-serve messaging, improved /mobile tool error message
  • src/cli/install.ts — persist provider choice, hostname/0.0.0.0 warning in success output
  • README.md — Quick Start clarifies serve-mode requirement, troubleshooting expanded with permission-flow diagnostics + persisted-config docs

Verification

  • npm run typecheck passes
  • npx vitest run — all formatter tests pass; the only failing tests are pre-existing on master (network-dependent cloudflare quick-tunnel test, interactive ngrok prompt test) and unrelated to these changes.
  • No behavior change for users running opencode serve with no --provider flag previously set: getTunnelProvider() still falls through to auto.

- Plugin now reads persisted provider from ~/.config/opencode-mobile/tunnel-config.json
  in addition to the TUNNEL_PROVIDER env var, so the choice made during
  'npx opencode-mobile install --provider <name>' actually takes effect at runtime.
- 'opencode-mobile install --provider <name>' now writes that file even when
  --skip-tunnel-setup is used (or when tunnel-setup itself wouldn't have written it).
- Install success output now warns prominently that '/mobile' only works in
  'opencode serve' mode and that --hostname 0.0.0.0 is required for LAN access
  (default 127.0.0.1 is loopback-only and unreachable from a phone).
- The /mobile tool returns an actionable multi-line message instead of the bare
  'No tunnel URL found.' when run in TUI/attach mode.
- The plugin's non-serve-mode log spells out the exact serve command to run.
- README: Quick Start now recommends 'opencode serve --hostname 0.0.0.0 --port 4096',
  documents the persisted tunnel config, and adds a troubleshooting section for
  mobile permission approvals that don't reflect on the PC (with curl-based
  diagnostics to isolate mobile-app vs tunnel vs server issues).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant