GeezerVison is showing github.com — Loopback server URLs are misclassified as remote · Issue #54722 · anomalyco/opencode
Loopback server URLs are misclassified as remote #54722DescriptionDescription
Loopback detection in packages/app/src/runtime/server/registry.tsx and runtime.tsx classifies servers by string-slicing the URL, so uppercase LOCALHOST, userinfo, and IPv6 loopback URLs are misclassified as remote.
Version
2.0.27
Reproduction
Check ServerConnection.local for http://LOCALHOST:4096, http://user@localhost:4096, and http://[::1]:4096 on current dev. All return false instead of true. Activityopencode-agent commented on Oct 12, 2026 Thanks for the report. I reproduced this on the latest dev (773d862).
The script below runs a small bun unit test against ServerConnection.local() in packages/app:
http://localhost:4096 and http://127.0.0.1:4096 return true.
http://LOCALHOST:4096, http://user@localhost:4096 and http://[::1]:4096 all return false.
I didn't run the 2.0.27 release itself, but isLocalHost is the same at the v2.0.27 tag as on dev. It is defined twice, in runtime/server/registry.tsx and runtime/server/runtime.tsx. Both copies strip the scheme, keep everything before the first :, and only accept exactly localhost or 127.0.0.1.
Until this is fixed, using http://localhost:<port> (lowercase, no userinfo) keeps the server classified as local.
Related: #49923 reported the same thing against v1 and was closed in the v1 cleanup. The earlier fix PRs #53330 and #49924 were closed without merging when dev was switched to v2.
Reproduction script (loopback.sh)
#!/usr/bin/env bash
# Reproduces #54722: ServerConnection.local() misclassifies loopback URLs.
# Usage: REPO=/path/to/opencode/checkout bash loopback.sh (after `bun install` in REPO)
set -euo pipefail
REPO="${REPO:-/workspace/repo}"
cat > "$REPO/packages/app/src/runtime/server/loopback-repro.test.ts" <<'TS'
import { expect, test } from "bun:test"
import { ServerConnection } from "./registry"
const http = (url: string) => ({ type: "http" as const, http: { url } }) as ServerConnection.Any
test.each([
"http://localhost:4096",
"http://127.0.0.1:4096",
"http://LOCALHOST:4096",
"http://user@localhost:4096",
"http://[::1]:4096",
])("ServerConnection.local(%s) is true", (url) => {
const result = ServerConnection.local(http(url))
console.log(url, "->", result)
expect(result).toBe(true)
})
TS
cd "$REPO/packages/app"
bun test --conditions=solid --preload ./happydom.ts ./src/runtime/server/loopback-repro.test.ts || true
rm -f "$REPO/packages/app/src/runtime/server/loopback-repro.test.ts"
Run it: bash loopback.sh
Tarquinen commented on Nov 5, 2026 This was fixed by #60460: loopback addresses such as LOCALHOST, user@localhost and [::1] are now recognized when they point at the app's own server. It shipped in v2.2.3. Closing this issue.
— from 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|