Skip to content

fix(cli): share the device's OpenTunnel tunnel for remote access - #53844

Merged
thdxr merged 2 commits into
v2from
tunnel-shared-profile
Oct 8, 2026
Merged

thdxr merged 2 commits into
v2from
tunnel-shared-profile

Conversation

@thdxr

@thdxr thdxr commented Oct 8, 2026

Copy link
Copy Markdown
Member

Issue for this PR

Closes #

Type of change

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

What does this PR do?

Remote access (#53837) gave OpenCode its own OpenTunnel profile per channel, so a machine that already had a tunnel got a second one and waited on a new certificate. OpenTunnel is designed around one tunnel per device that apps share by claiming their own routes.

The service now uses the device's default tunnel and claims a subdomain route: opencode on latest, opencode-<channel> otherwise (for example https://opencode-dev.<id>.opentunnel.xyz). It never claims the tunnel hostname itself, which the opentunnel CLI may route. The tunnel certificate already covers *.<hostname>, so an existing tunnel needs no new certificate. On a machine with no tunnel, enabling remote access creates the shared default one automatically; users never need the OpenTunnel CLI. The setup message no longer mentions OpenTunnel.

The old per-channel profile (e.g. ~/.local/share/opentunnel/opencode-dev) is left on disk untouched.

How did you verify your code works?

  • New test: every channel maps to a unique route name that OpenTunnel's own validator accepts.
  • Existing default tunnel, live: ensure reused it in 238 ms with no setup message and no new profile; the route attached and served the running service (401 without credentials); the opentunnel CLI daemon kept running.
  • Fresh machine, live (empty XDG_DATA_HOME): ensure created the default tunnel in 28 s, the route attached and answered (401 without credentials), then the test tunnel was removed.
  • bun run check passes.

Screenshots / recordings

N/A (CLI only).

Checklist

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

— from 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊

@thdxr
thdxr merged commit 53533fd into v2 Oct 8, 2026
11 checks passed
@thdxr
thdxr deleted the tunnel-shared-profile branch October 8, 2026 03:03
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