[Bug] Private-network and container hostnames are treated as remote providers, giving a 120s timeout and no /doctor or wizard probe
Description
isLocalURL in source/utils/url-utils.ts only recognises localhost, 127.0.0.1, 0.0.0.0 and ::1. Every other self-hosted endpoint is classified as a remote provider, even though the whole point of the project is local-first use. The result is a 120 second socket/headers timeout on slow local inference, no connection probe in /doctor, and no connection test in the provider wizard.
Running isLocalURL against common self-hosted setups returns false for all of these:
http://127.0.0.2:11434,http://[::ffff:127.0.0.1]:11434http://192.168.1.50:11434,http://10.0.0.5:8080(a GPU box on the LAN)http://host.docker.internal:11434(nanocoder in a container, Ollama on the host)http://ollama:11434(single-label docker compose service name)http://gpu-box.local:11434(mDNS)http://foo.localhost:8080,http://localhost.:11434http://100.64.0.1:11434(Tailscale/CGNAT)
Environment
- OS: macOS (the logic is platform independent)
- Node version: v22.23.4
- Nanocoder version: 1.32.0 (main at 1b6571cc)
- Provider: any OpenAI-compatible provider on a private network address
- Model: any large local model with a slow first token
Steps to Reproduce
- Configure an OpenAI-compatible provider whose
baseUrlis a LAN address, for examplehttp://192.168.1.50:11434/v1, serving a model that takes more than two minutes to produce response headers (a large model, a cold load, or a long prompt). - Send a prompt. Alternatively run
/doctor, or add the same provider through the provider wizard.
Expected Behavior
Private-network and loopback-equivalent hosts are treated as local: they get the 600 second local socket timeout (TIMEOUT_SOCKET_LOCAL_DEFAULT_MS), /doctor probes them, and the wizard tests the connection.
Actual Behavior
source/ai-sdk-client/ai-sdk-client.tspicksTIMEOUT_SOCKET_DEFAULT_MS(120s) instead ofTIMEOUT_SOCKET_LOCAL_DEFAULT_MS(600s) fromsource/constants.ts, so slow local inference on a LAN host fails with a headers timeout error.source/commands/doctor.tsxlabels the providerhostedand reportsnot-localinstead of probing it.source/wizards/validation.ts(testProviderConnection) skips the connection test for the same reason.
Logs/Screenshots
Output of calling isLocalURL directly for the URLs listed above: false for every one of them. Only localhost, 127.0.0.1, 0.0.0.0 and ::1 return true.
Additional Context
- [x] I have searched existing issues to ensure this is not a duplicate
- [x] I can reproduce this issue consistently
- [x] This issue occurs with the latest version of nanocoder
Suggested direction: treat RFC 1918 ranges, link-local, CGNAT (100.64.0.0/10), 127.0.0.0/8, IPv4-mapped IPv6 loopback, *.local, *.localhost, host.docker.internal and dotless hostnames as local. The helper could live next to the existing SSRF range checks in source/tools/fetch-url-guard.ts. An explicit per-provider override (for example a local: true flag) would cover anything the heuristic misses.
Hi @pcbeingused333, this is a reminder that you need to comment on an issue and be assigned to it before opening a PR. This has come up more than once now. Please follow this process going forward. If PRs keep getting opened without an assignment, we’ll have to close them and restrict further contributions from your account. Thanks for understanding !