Repository navigation
Description
Verified against (commit SHA or released version)
commit a18d37c (main, v0.15.0), built from source and run on Node 22.23.4, Windows 11, 2026-10-26.
Discord Username / User ID
yazan030803
What does this improvement do?
A proxy variable written without a scheme, e.g. HTTPS_PROXY=proxy.corp:3128, is thrown away: the CLI prints one warning, ignores the proxy, connects directly, and on a network where only the proxy can reach the internet every command then fails with exit 10 "fetch failed ... Service is temporarily unavailable", telling the user to report an outage.
host:port with no scheme is a common way to set these variables on corporate machines and CI runners, and curl accepts it (it assumes http:// when no scheme is given), so the same value works for other tools on the box and fails only for testsprite. In CI logs and for coding agents, the exit-10 "service unavailable" line is what gets acted on, not the warning above it.
Repro (a local proxy on port P, an API host only the proxy can reach):
HTTP_PROXY / HTTPS_PROXY |
Result |
|---|---|
http://127.0.0.1:P |
request goes through the proxy, exit 0 |
127.0.0.1:P |
warning: ignoring proxy environment (could not initialize proxy agent): Invalid URL, then exit 10 |
proxy.corp.example:P |
warning: ... Invalid URL protocol, then exit 10 |
HTTPS_PROXY=proxy.corp.example:3128 testsprite auth status
# warning: ignoring proxy environment (could not initialize proxy agent): Invalid URL protocol
# ... exit 10 (service unavailable)Details / implementation notes
Root cause.
src/lib/proxy.ts:47buildsnew EnvHttpProxyAgent()with no options, so undici reads the raw env value and requires a full URL;host:portthrows.proxy.ts:49-57catches that, warns, and falls back to the default (direct) dispatcher.- The existing tests can't see it:
proxy.tschecksdeps.envfor whether a proxy is set, but undici readsprocess.env, so the tests never build an agent from their own value.
Proposed fix (only proxy.ts):
- Read
https_proxy/HTTPS_PROXYandhttp_proxy/HTTP_PROXYfromdeps.envwith undici's lower-case-first order, prefixhttp://when the value has noscheme://, and pass them explicitly:new EnvHttpProxyAgent({ httpProxy, httpsProxy }).NO_PROXYhandling stays with undici. - Keep the try/catch and warning for values that are really invalid (e.g.
socks5://). - This also makes
deps.envthe real input, so the tests exercise the value they set.
Tests: a scheme-less HTTPS_PROXY installs the agent with no warning; http:// values are unchanged; an unsupported scheme still warns and falls back; one subprocess test runs auth status through a local CONNECT proxy with a scheme-less value and expects exit 0. Fails on main, passes with the fix.
Not a duplicate: #119 / PR #169 added proxy support (tested only http:// values); #433 / PR #634 cover TLS inspection, block pages and 407 behind a working proxy; #434 is the tunnel data connection. Searched open and closed issues and PRs for scheme-less proxy values, Invalid URL and EnvHttpProxyAgent.
I'd like to fix this myself once it's accepted. I could not add the hackathon / needs-triage labels (no permission on an issue opened through the API); could a maintainer add them?
Confirmations
- I have searched existing issues and this is not a duplicate.
- I have provided my Discord identity above for reward coordination.
Activity
fyZhang66 commentedon Oct 30, 2026
Confirmed on v0.15.0, thanks @Yazan-O.
maybeInstallProxyAgentbuilds a bareEnvHttpProxyAgent(), so undici reads the raw value fromprocess.envand throws onhost:port; the catch then falls back to a direct connection, which on a proxy-only network turns into exit 10 "service unavailable". Accepted at low priority, scope:https_proxy/HTTPS_PROXY/http_proxy/HTTP_PROXYfromdeps.envin undici's lower-case-first order, prefixhttp://when the value has noscheme://(curl's convention), and pass them as{ httpProxy, httpsProxy }. PassnoProxyfrom the same env too, so the agent has one source. LeaveNO_PROXYsemantics to undici.socks5://and the like). No new error code.HTTPS_PROXYinstalls the agent with no warning; a scheme-lesshttp_proxylikewise; anhttp://value is unchanged;socks5://still warns and falls back; one subprocess test runsauth statusthrough a local CONNECT proxy given as127.0.0.1:<port>and expects exit 0 (the local-proxy harness intest.local.spec.tsis the model).No new dependency. Comment
/assignto claim it.Yazan-O commentedon Oct 30, 2026
(mistyped command, see the next comment)
Yazan-O commentedon Oct 30, 2026
/assign
testsprite-hob commentedon Oct 30, 2026
Assigned to @Yazan-O. Thanks for taking this on. (2 more slots available.)
Your open assigned issues (1/3):
(none)
testsprite-hob commentedon Nov 9, 2026
@Yazan-O, your claim expired after 48 hours (counted from when this issue was accepted) without a linked PR. This issue is open for others now, and you're welcome to
/assignagain if it's still free.OkeyAmy commentedon Nov 10, 2026
/assign
testsprite-hob commentedon Nov 10, 2026
Assigned to @OkeyAmy. Thanks for taking this on. (1 more slot available.)
Your open assigned issues (2/3):
testsprite-hob commentedon Nov 11, 2026
@OkeyAmy, your claim on this issue expires in about 24 hours unless you open a PR that links it (for example,
Closes #673orPart of #673). You can re-claim later with/assignif the issue is still free.testsprite-hob commentedon Nov 12, 2026
@OkeyAmy, your claim expired after 48 hours without a linked PR. This issue is open for others now, and you're welcome to
/assignagain if it's still free.akramcodez commentedon Nov 12, 2026
/assign
testsprite-hob commentedon Nov 12, 2026
Assigned to @akramcodez. Thanks for taking this on. (2 more slots available.)
Your open assigned issues (1/3):
(none)