d3fc6f2bfada18e6ae7887b79ed1e4c650ca37e1
9
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
3ed3605ba0 |
netproxy: a global proxy switch drops the idle connections of the sync and the icon fetch (#4824)
ggbdpq's patch (gua2100 on Discord), reviewed and landed with test changes. What changed - netproxy.Watch gives the dispatch's per-request check for a moved global proxy (#4523) to transports magpie keeps for itself. The sync (davsync) uses http.DefaultTransport, so when one of its requests finds the proxy moved, it now drops the idle connections itself. Before this, only a DefaultClient request dropped them, and a backup kept going through the old proxy's HTTP/2 connection. - FetchIcon now closes the pool of the client that only the fetch used. Nothing closed it before. - Review changes: the davsync test restores settings.json afterwards, and the icon test's wait for idle is bounded at 20s, not 2s, to leave room under load. Run at the pushed head (on mote, base |
||
|
|
cb35d2fa94 |
fix(netproxy): a switch of the global proxy drops the old proxy's idle connections (#4523)
What changed - Dispatch now remembers the proxy setting each request left under and, when it moves, closes the idle connections it kept (base's and every provider clone's), so the request after a switch dials through the proxy in force. A transport pools by target host, and its HTTP/2 connections by the authority alone, so until now a Test after the switch rode the old proxy's connection and left by the old exit while the new proxy was the one shown. Run - go test ./internal/netproxy/ -run TestGlobalSwitchDropsTheOldProxyConnections fails on the parent (1 connection through A, 0 through B after the switch), passes here; the package's full suite passes (-tags nogui). Generated-by: GLM-5.3-Flash (ZCode) |
||
|
|
abdc4b113d |
netproxy, provider, gateway: every request to the ChatGPT backend goes over HTTP/1.1, magpie's own too, not only the gateway's turns (#1700)
|
||
|
|
e4134d1fb7 |
agent: Codex's proxy is worked out from the login shell's NO_PROXY and HTTP_PROXY and macOS' HTTP entry alone, as its reqwest reads them, so "Codex 经代理连 magpie" no longer shows while Codex goes direct (liu_dyj on X)
liu_dyj: with the VPN on, magpie said Codex reached magpie through a
proxy that didn't pass its requests on; versions before
|
||
|
|
2305ab1fc6 |
gateway, netproxy: a web search goes through its searcher's proxy, not the direct line of the provider serving the turn (#1522, xixijay1988)
Claude Code on opencode-go (set to "direct"), with Codex as the search
delegate and the proxy on Auto (system proxy 127.0.0.1:7890): every
WebSearch dialed chatgpt.com directly, to the addresses a poisoned DNS
gave, and failed with "no answer in 2m0s". Codex's own requests through
the same gateway went through the proxy.
Cause: attempt() puts the turn provider's proxy choice on the request
context (Provider.Via -> netproxy.With). The search runs inside that
context, and its sub-request to Codex calls Provider.Via again, but
netproxy.With(ctx, "") returned ctx unchanged, so a provider that
follows the global proxy inherited the outer provider's "direct".
- netproxy.With: "" now replaces a choice ctx already names, so any
request made for one provider while serving another (search delegate,
vision describer, classifier, Codex titles, all through attempt's
p.Via) takes its own provider's proxy or the global one.
- webSearch clears the turn's choice up front: the search APIs, which
have no proxy of their own, follow the global one.
- kimiSearch now applies the Kimi Code plan's own proxy (p.Via); it
had none and went the turn's way.
Verified:
- New TestSearchFollowsTheSearchersProxy: a fake CONNECT proxy on a free
port; the turn's provider is reachable only directly, the searcher, a
Kimi Code search service and a search API only through the proxy.
Cases: Settings' proxy, Auto (from the environment), a searcher's own
proxy with the global direct, a search API. On the old code it fails
with "dial tcp search.test:443: ... (dialed directly)", CONNECTs [];
with only the With fix the search API case fails; with the kimiSearch
change reverted the Kimi case fails. -race -count=5 passes.
- TestWith in netproxy gains With(With(ctx, outer), "") follows the
global proxy; fails on the old With.
- go test -tags nogui: gateway, netproxy, provider, plugin, update pass;
the full ./... suite under load ~180 passed except
internal/agent TestDshHomePickSurvivesSyncAndEffort, which passes alone
(-count=3) and touches no proxy code (not this change; not yet filed).
After rebasing onto
|
||
|
|
bc141ad834 | update: install.sh and magpie update take --proxy and --mirror, and magpie update mirror keeps one for the app's updates too (akic404 on Discord: 安装和update如果没有梯子也是麻烦事,能否在install.sh和magpie update后加子选项?--proxy等可自定义或默认ghproxy) — install.sh had no options and fetched with curl alone, and magpie update took none; without a way out to GitHub both failed. Now both take --proxy <url> (http, https, socks5, socks5h; install.sh also MAGPIE_PROXY=) for the feed and the download, and --mirror <prefix> (or MAGPIE_MIRROR=), a GitHub download mirror the release file is fetched from as <prefix>https://github.com/…; only github.com / githubusercontent.com URLs are put through it. No mirror is used unless one is given: magpie names none and has none by default. The feed with each file's SHA-256 is always fetched from usemagpie.ai, never through the mirror, so a file the mirror changed is refused and deleted ("… from the mirror X does not match its checksum from https://usemagpie.ai; not installed"); macOS still checks the app's signing team. magpie update mirror <prefix>|off saves Settings' updateMirror (http(s) only), which the app's own background update follows too; magpie update --mirror off skips it once; the Settings page's save keeps it. The app's update already followed Settings → Proxy (#294); magpie update --proxy overrides it for one run. The environment's ALL_PROXY / all_proxy is now honoured when HTTPS_PROXY / HTTP_PROXY are unset (Go's ProxyFromEnvironment ignores it), with NO_PROXY as curl reads it. magpie update takes --flag value or --flag=value, and an unknown word is an error instead of an update. The help, README and the docs' FAQ (en/zh/ja) say how. install.test.mjs's proxy, mirror and tampered-mirror tests, TestAllProxyFromTheEnvironment, TestUpdateThroughAMirror, TestUpdateThroughAProxyGiven and TestUpdateFlags fail on the old code and pass; TestSettingsSaveKeepsWhatItDoesNotSend covers updateMirror. A dry run of install.sh as Linux amd64 into a temp HOME installed the real 0.1.773 with its SHA-256 checked, refused a local mirror serving a wrong file, and with --proxy to a closed port failed reaching the site through it. go vet, builds (darwin, GOOS=linux, GOOS=windows), sh -n, node --test site/install.test.mjs and go test -tags nogui -count=1 ./... under a temp HOME pass but TestClaudeIdentityServedWhileAsked, a timing test that passes alone. Not tried through a real proxy server or a real public mirror; no install.ps1 exists for Windows, and the app has no field for the mirror. | ||
|
|
125da38943 | providers: each provider, a signed-in account like Codex's among them, goes through its own proxy — the one in Settings, none, or its own address (#237 xosi: 目前似乎是全局设置代理的,codex和国模供应商无法单独区分设置代理) — magpie had one proxy, Settings' (or the environment's, or the system's), for every request it made, so Codex, which needs a proxy from China, and a vendor at home, which is slower or refused through one, couldn't both be right. A provider now has a proxy, "" (following the global one, as before and the default), "direct" (none, whatever Settings says) or an http://, https:// or socks5:// address (host:port meaning http), kept as proxy in providers.json only when set, and for an account provider in its picks entry beside its models. It is checked on save by the same rule Settings' proxy is (settings.CheckProxy, now shared), so ftp:// and the like are refused. netproxy.With puts a provider's choice on a request's context and netproxy.Func honours it; netproxy.Dispatch sends such a request through a clone of the transport kept for that proxy alone (at most 32, cleared past that), since a transport shares an HTTP/2 connection by host whatever proxy dialled it; loopback is never proxied. The gateway's client and http.DefaultClient go through Dispatch, and every request made on a provider's behalf carries its choice: the gateway's turns (attempt, forward, draw, decide, the Codex backend), and the model lists, balances, plan and subscription usage, tests, sign-in, Codex's warm-up and reset, while the Claude subscription's and warm-up's CLI runs get the account's proxy in their *_PROXY (netproxy.EnvWith). The provider editor, a key provider's and a signed-in account's alike, has a Proxy row after Fallback: Global proxy | Direct | Custom (全局代理 | 直连 | 自定义), the address field beside the options only for Custom, its room kept otherwise so a pick never changes the centred dialog's height and moves nothing, and a line under it saying what the pick does; Save posts proxy ("" , "direct" or the trimmed address), a save without it keeps the old one, and Custom with no address is refused before anything is posted ("Proxy: type its address, like http://127.0.0.1:7890"). No border stripes; en and zh strings together. Tested with a new internal/gateway/proxy_test.go in a sandbox HOME: with a global proxy set, provider A's turns and model list go through its own fake proxy, B's (direct) straight to the vendor, C's (following) through the global one, none through another, and A set back to following goes through the global one; ftp:// is refused (fails with With neutered). netproxy_test.go's TestWith covers Func, Dispatch's per-proxy transports and EnvWith. A new internal/gui/tests/provider-proxy.test.cjs in Chromium and WebKit, en and zh: a key provider opens on Global proxy with no address, Custom unfilled is refused and nothing posted, a padded socks5 address saved trimmed, Direct saved as "direct" and Global as ""; Codex's account opens on Custom with its address and saves Direct with its models; every pick leaves the option within 1px; no left border. go build -tags nogui (and GOOS=linux, GOOS=windows), go test -tags nogui ./..., provider-proxy, click-scroll, old-webkit, balance-fix and add-sheet pass (click-scroll's WebKit case failed once alongside the others and passes alone, twice). Not tried against a real proxy or the real Wails window. | ||
|
|
3eed0cdba4 | netproxy: an agent's CLI that magpie starts — grok login, cursor-agent, devin, Claude Code, and the runs behind their subscriptions — goes through the proxy magpie's own requests do (#51); the CLIs read only *_PROXY, which an app started from the Dock doesn't have, so a proxy set in magpie or the system alone left grok login trying auth.x.ai directly until it timed out. A proxy set in magpie replaces the environment's, "direct" drops it, the system's is added where the environment names none, and loopback stays direct for the CLIs' calls back to magpie | ||
|
|
1f72ac82f0 | net: requests go through a proxy — Settings → Proxy, or the environment's, or the system's (#8) |