Repository navigation
fix(tui): encode reachable pairing addresses in the /pair QR code - #54051
Open
opencode-agent[bot] wants to merge 1 commit into
Open
opencode-agent[bot] wants to merge 1 commit into
opencode-agent[bot] wants to merge 1 commit into
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue for this PR
No issue; requested in Slack. Follow-up to #53588.
Type of change
What does this PR do?
#53588 changed pairing QR codes to
{"code","urls"}JSON and madeServerInfo.connectionURLslist the loopback address first on0.0.0.0/::. The TUI/pairdialog was not updated, so on0.0.0.0:links[0], now the127.0.0.1link, which a phone cannot reach;opencode service set hostname 0.0.0.0" hint always showed, because a loopback URL is now always present.The dialog now matches
opencode pair:remoteisserver.urlswithout loopback hosts (localhost,*.localhost,127.*,[::1], the same rule as the CLI'sisLoopback, as a local predicate).JSON.stringify({ code, urls: remote })and is omitted whenremoteis empty.remoteis empty.The JSON payload is denser and grows with each address. A QR row that wraps is unscannable, so the dialog now measures the rendered width:
How did you verify your code works?
bun typecheckinpackages/tui; prettier clean.bun dev serve --hostname 0.0.0.0 --port 4097, isolated XDG dirs). The live service was not touched. Dev TUI connected with--server.http://10.42.0.42:4097/auth/connect/…(200), and added the server. Its following authenticated API calls returned 200.http://127.0.0.1:4097/auth/connect/<code>. After:{"code":"<code>","urls":["http://10.42.0.42:4097"]}.bun dev serve --port 4098, urls["http://127.0.0.1:4098"]): no QR code; the hint shows (wide and narrow).Screenshots / recordings
Server on
0.0.0.0:4097, one non-loopback interface.Before (wide, 120×44): the QR code encodes
http://127.0.0.1:4097/auth/connect/…, and the hostname hint shows even though the server is already on0.0.0.0.After (wide, 120×44): the QR code encodes
{"code":"…","urls":["http://10.42.0.42:4097"]}, and there is no hint.Before (narrow, 70×50):
After (narrow, 70×50):
After, loopback-only server (
127.0.0.1:4098): no QR code; the hint shows.After, dense payloads (fake URLs, local test only): 8 remote URLs at width 120 move the code below the links; at width 52 a code that would wrap is replaced by the widen message.
Screenshots are hosted on the
tui-pair-qr-assetsbranch. Nothing is committed to this PR's branch. Delete the assets branch after review.Checklist
Requested by: @Hona (Hona via Slack)