You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
CLI machine pairing incorrectly classifies trailing-dot localhost as remote #67419
Thanks for the report. I reproduced both cases on the released CLI (v2.4.3, the latest release; the issue didn't give an exact version) using opencode pair --url, which prints a QR code only for addresses it treats as reachable from other devices:
http://localhost:4096 and http://127.0.0.1:4096 print no QR code, which is correct.
http://localhost.:4096 prints a QR code, so it is treated as remote.
http://127.example.com:4096 prints no QR code, so it is treated as loopback.
It still happens on the latest dev (c5341fe). The script below runs these four cases. With opencode machine add, the misclassification only changes the order of the addresses, because the iroh entry makes it say "Works from any network." either way.
Reproduction script (repro.sh)
#!/bin/sh# Reproduces #67419: `opencode pair --url` decides whether to print a QR code# by checking whether the URL's host is loopback (isLoopback). Loopback URLs get# no QR code. `localhost.` is wrongly treated as remote (a QR code is printed),# and `127.example.com` is wrongly treated as loopback (no QR code).# Usage: sh repro.sh (uses `opencode` from PATH)# OC_DEV=/path/to/checkout sh repro.sh (runs the CLI from source)export HOME="${REPRO_HOME:-/tmp/opencode/tmp/h1}"
mkdir -p "$HOME"if [ -n"$OC_DEV" ];then# Run from packages/cli so the background service spawned from source resolves its JSX runtime.cd"$OC_DEV/packages/cli"
OC="bun --conditions=browser --preload=$OC_DEV/packages/tui/node_modules/@opentui/solid/scripts/preload.js $OC_DEV/packages/cli/src/index.ts"else
OC=opencode
fi$OC --version
foruin http://localhost:4096 http://localhost.:4096 http://127.0.0.1:4096 http://127.example.com:4096;do
out=$(timeout 60 $OC pair --url "$u"2>&1)if!echo"$out"| grep -q '/auth/connect/';then qr="ERROR: $(echo "$out"| head -2)"elifecho"$out"| grep -q '██';then qr="QR code printed (treated as remote)"else qr="no QR code (treated as loopback)";fiecho"$u -> $qr"done
Activity
opencodejr commentedon Nov 30, 2026
Thanks for the report. I reproduced both cases on the released CLI (v2.4.3, the latest release; the issue didn't give an exact version) using
opencode pair --url, which prints a QR code only for addresses it treats as reachable from other devices:http://localhost:4096andhttp://127.0.0.1:4096print no QR code, which is correct.http://localhost.:4096prints a QR code, so it is treated as remote.http://127.example.com:4096prints no QR code, so it is treated as loopback.It still happens on the latest
dev(c5341fe). The script below runs these four cases. Withopencode machine add, the misclassification only changes the order of the addresses, because the iroh entry makes it say "Works from any network." either way.Reproduction script (repro.sh)
Run it:
sh repro.shfour1er commentedon Dec 1, 2026
I'm picking this up — reproducing the issue now and will open a PR with a fix.