GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat: make pairing QR codes https links any camera opens by kitlangton · Pull Request #59962 · anomalyco/opencode

Conversation

@kitlangton

@kitlangton kitlangton commented Oct 28, 2026 •
edited by opencodejr Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

A phone's own camera now opens pairing QR codes straight into the OpenCode app.
The QR codes in Settings → Pairing, opencode pair and the TUI /pair dialog held raw JSON that only the app's own scanner could read; the stock iPhone Camera just showed text. They now hold an https://opencode.ai/pair#… link, which the iOS app already claims (opencode.ai serves the app link file since #58540). The printed links and Copy Link are unchanged.

❌ Before

  1. Desktop and opencode pair QR codes: {"code","urls"} JSON. ❌ The Camera app can't open it.
  2. TUI /pair QR code: the first server address, often 127.0.0.1. ❌ A phone can't reach it, on or off the network.
  3. First opencode pair --remote: one line, then about a minute of silence while the remote address's certificate is issued.

✅ After

  1. Every pairing QR code is https://opencode.ai/pair#<base64url {"code","urls"}>. The Camera offers “Open in OpenCode”; the code stays in the # part, so it never reaches a web server.
  2. The TUI QR code carries the addresses a phone can reach, including the remote access address when it's on, so it also pairs away from the network. With none, it says how to add one; when the code is too wide for the terminal, it says to widen it; when it's taller than the terminal, the dialog scrolls.
  3. That first setup shows a spinner with elapsed time.
  4. A machine with dozens of interfaces (container bridges) no longer makes the QR code too big to encode: the code keeps the likeliest addresses that fit a scannable size (remote, tailnet, LAN first; container bridges only if nothing else). If nothing fits, the links still print and a line says to open one instead of failing.
- qr(JSON.stringify({ code, urls }))                 // desktop, CLI
- qr(links[0])                                       // TUI, often loopback
+ qr("https://opencode.ai/pair#" + base64url(JSON.stringify({ code, urls: reachable })))

The web and desktop app's own scanner and pasted links read the new form too; old JSON codes still work.

📊 Proof

Case Before After
iPhone Camera scans the desktop QR code ❌ shows text ✅ opens the app (link form the app already handles)
TUI /pair on a server listening on all addresses ❌ 127.0.0.1 link ✅ network and remote addresses
App scanner reads a new QR code n/a ✅
84 container bridge addresses ❌ QR encode throws, links hidden ✅ QR with the LAN, tailnet and remote addresses
QR taller than an 80×36 terminal ❌ clipped ✅ scrolls

--remote timing, measured with the OpenTunnel client in a clean profile: first setup waited 58–61 s for the certificate (twice); attaching the route afterwards took 0.3–0.5 s, including right after a holder process was killed. So the wait is a one-time certificate issue on OpenTunnel's side, not something pairing does; this PR only makes it visible.

👀 Read: packages/util/src/pairing-link.ts, the new shared encoder and decoder, and the TUI width check in dialog-pair.tsx (the QR code grows with each address, so it moves under the links, scrolls, or asks for a wider terminal rather than being clipped). The rest is routine.

Follows up #58540 and the iOS app's existing opencode.ai/pair support · supersedes the QR part of #54051 · timings measured on a Mac with a throwaway OpenTunnel profile

Checks run
  • bun test src/pairing-link.test.ts (util): 7 pass
  • bun test … src/servers/connect/ (app): 7 pass
  • bun test src/pairing (gui-plugins): 3 pass
  • bun test test/pair-qr.test.ts test/pair-remote-consent.test.ts (cli): 7 pass
  • bun test test/component/dialog-pair.test.tsx (tui): 2 pass
  • bun run typecheck in util, app, cli, tui, gui-plugins: no errors
  • First-run remote setup in a pseudo-terminal: spinner counted to 1m 4s, then “Remote access is set up”

Added by the opencode bot (AI-generated).

Fixes #58810

Related: #54871, #55027

Public API: pairing QR payload changes from {"code","urls"} JSON to an https://opencode.ai/pair# link (new scanners read both; older app scanners can't read new codes)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
kitlangton added 2 commits October 28, 2026 10:10
@kitlangton
feat: make pairing QR codes https links any camera opens (t485)
53b3f6f
@kitlangton
fix(tui,cli): scroll tall pairing QR codes and keep them scannable wi…
d3a585e
…th many addresses (t485)
@kitlangton
kitlangton requested review from Brendonovich and Hona as code owners October 28, 2026 17:18
@github-actions github-actions Bot added the contributor label Oct 28, 2026
opencodejr[bot]
opencodejr Bot reviewed Oct 28, 2026
View reviewed changes

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works as described for the scanner and CLI/TUI encoding. I drove /pair in the TUI on the base and with this PR (screenshots below). On the base the QR code is the unreachable 127.0.0.1 link; with the PR it is dropped and the dialog says how to add a reachable address. The new util, app, cli and tui tests pass. tsc --noEmit is clean in the changed files: cli and tui have the same pre-existing errors as the base, and util, app and gui-plugins are clean. I couldn't check the iPhone Camera hand-off or the --remote spinner here.

Public API: the QR payload changes from bare {"code","urls"} JSON to https://opencode.ai/pair#<base64url JSON>. The scanner in this version still accepts the old JSON. Older app scanners won't read the new codes until they update. CLI flags, the server API and config are unchanged.

Two things worth fixing before merge (details inline):

  • Phones without the iOS app hit a 404. The console app serves the app-link file but has no /pair route. So Android / Google Lens, and iPhones without the app, now open an opencode.ai 404 where they used to see text.
  • The TUI /pair dialog now stretches to nearly the full terminal height. The body is always a scrollbox with maxHeight, and it seems to fill that height. With only loopback addresses (the default), the dialog is mostly empty space and pinned to the top, where it used to be compact and centered (see screenshots).

Fixes #58810
Related: #54871, #55027

Before

After

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread packages/util/src/pairing-link.ts
// Pairing QR codes open this page. opencode.ai serves an apple-app-site-association file that lets the OpenCode iOS
// app claim it, so any camera app opens the code in the app. The single-use code and the server addresses ride in the
// fragment as base64url {"code","urls"} JSON, which a browser never sends to a server.
const PAGE = "https://opencode.ai/pair"

@opencodejr opencodejr Bot Oct 28, 2026

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

packages/console/app serves the apple-app-site-association file for /pair, but there is no /pair route. When the link isn't claimed by the iOS app (Android / Google Lens, an iPhone without the app, or a desktop browser), the camera opens https://opencode.ai/pair#… and lands on the 404 page. Before, they at least saw the text. A small /pair page could explain how to get the app, or decode the fragment and show the /auth/connect/<code> links (it stays client-side, so the code still never reaches the server). That would avoid a dead end.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread packages/tui/src/component/dialog-pair.tsx
{content()}
</scrollbox>
}
{/* The QR code can be taller than the terminal, beside the links or under them, so the body scrolls. */}

@opencodejr opencodejr Bot Oct 28, 2026

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Making the body always a scrollbox with maxHeight seems to make it fill that height. In a 120×45 terminal with only loopback addresses, the dialog now covers almost the whole screen, mostly empty and pinned to the top. On the base it was compact and centered (see the before/after screenshots). It may need the scrollbox to size to its content (e.g. no flex grow), or only switch to the scrollbox when the content is taller than the terminal.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
This was referenced Oct 28, 2026
tui: pair device popup always shows localhost, ignores remote mode #60053
Closed
[FEATURE]:does opencode has ios terminal? #61100
Closed
This was referenced Nov 9, 2026
[FEATURE]: Offer the Android client source under MIT, yours to rebrand #62897
Closed
Android 0.3.0: can't connect to LAN servers on Android 17 (missing ACCESS_LOCAL_NETWORK) #62934
Closed
@pedrosamanuel

pedrosamanuel commented Nov 9, 2026

Copy link
Copy Markdown

what happend to this pull request, it will be very helpfull

ashwinlimaye reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@opencodejr opencodejr Bot mentioned this pull request Nov 10, 2026
desktop: pairing QR code is inverted in dark theme and cannot be scanned by the Android app #63150
Closed
@ashwinlimaye

ashwinlimaye commented Nov 10, 2026

Copy link
Copy Markdown

This is still an issue - the qr code opens the webapp, is unable to send intent to android app (launched today, I know!)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ssskay ssskay mentioned this pull request Nov 11, 2026
fix(gui-plugins): keep the pairing QR code dark on light in every theme #63220
Merged
3 of 6 tasks
@opencodejr opencodejr Bot mentioned this pull request Nov 18, 2026
fix(cli): keep the pair QR code within capacity on hosts with many addresses #64629
Open
3 of 6 tasks

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@opencodejr opencodejr[bot] opencodejr[bot] left review comments
@Hona Hona Awaiting requested review from Hona
@Brendonovich Brendonovich Awaiting requested review from Brendonovich

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

contributor

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

tui: /pair QR code encodes the loopback 127.0.0.1 link, so other devices cannot connect

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@kitlangton @pedrosamanuel @ashwinlimaye
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.