Repository navigation
feat(platform): reach other websites through a round-robin proxy pool - #5053
Merged
Merged
Conversation
OUTBOUND_PROXY_URLS lists HTTP proxies, comma- or whitespace-separated, and every request Tale makes to another website takes them in turn: the website crawler (robots, sitemaps, pages), registering a website (its robots.txt and homepage), the chat assistant's web_fetch, the remote images an email draws, video ingestion (yt-dlp, one proxy per run) and every connection a sandbox session opens to the internet. VIDEO_INGEST_PROXY_URL, when set, still takes video ingestion out of the rotation. The backend rotates per request and passes over a proxy it cannot reach, or that refuses its credentials, for 60 s; a request whose proxy failed goes once more through the next one, and none falls back to a direct connection. Private destinations (the allowed intranet hosts) stay direct, and so do the services a deployment configures itself (providers, connectors, SSO, storage). The sandbox egress service hands its traffic to a local squid hop, since tinyproxy keeps one upstream; squid rotates the pool per connection and holds the fence the firewall held before: no cache manager, no private or IPv6-literal destination, nothing unresolvable. Two readers parse the value, the shared TypeScript module and the egress service's awk, and a guard holds them identical. A malformed entry stops the backend's boot and the egress service's start, naming its position, never its password.
yannickmonney
enabled auto-merge
October 26, 2026 16:20
5 tasks done
auto-merge was automatically disabled
October 26, 2026 20:24
Pull request was closed
yannickmonney
enabled auto-merge
October 26, 2026 20:25
auto-merge was automatically disabled
October 26, 2026 20:29
Pull request was closed
yannickmonney
enabled auto-merge
October 26, 2026 20:29
yannickmonney
added this pull request to the merge queue
Oct 26, 2026
This was referenced Oct 26, 2026
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
VIDEO_INGEST_PROXY_URLwas the platform's only proxy setting, and only video ingestion read it, so every other request Tale made to another website left from the deployment's own address. This addsOUTBOUND_PROXY_URLS: a list of HTTP proxies that every request to another website takes in turn (round robin). That covers the website crawler, registering a website, the chat assistant'sweb_fetch, the remote images an email draws, video ingestion, and every connection a sandbox session opens to the internet.VIDEO_INGEST_PROXY_URLstays, now as the video-only override. Nothing changes unless it is set: a deployment that sets neither variable sends every request the way it did before.What changes
safeFetchcallers: crawler (robots, sitemaps, link walk, pages), website registration (robots.txt, homepage),web_fetch, email imagesoutboundProxy: trueVIDEO_INGEST_PROXY_URLwhen set; otherwise the next pooled proxy per run (--proxy), so a run extracts and downloads through one address127.0.0.1:3129rotates the pool per connection (cache_peer … round-robin,never_direct allow all)http://[user:password@]host[:port]entries, comma- or whitespace-separated, in@tale/shared/net/outbound-proxies. The grammar is narrow on purpose:http://only (what undici, yt-dlp and squid all speak), credentials percent-encoded with printable-ASCII escapes, at most 128 bytes together (squid'sMAX_LOGIN_SZ; past it squid crashes on the first request), a host name or IPv4 address, and an optional port. Boot (the zod env) and the egress service's start refuse a malformed entry, naming its position and never its text, which can carry a password. The egress image reads the list withoutbound-proxies.awk;outbound-proxies.guard.test.tsruns both readers over the same entries and lists and holds them identical.lib/net/outbound-proxy.ts). Requests take the proxies in turn, counted per process. A proxy that can't be reached, or that refuses its credentials (a tunnel answered407), is passed over for 60 s and logged once by host and port. The request then goes once more through the next proxy. A request never falls back to a direct connection, even when every proxy is passed over. A destination's own refusal (a forwarded407, a tunnel502, a TLS stall) blames no proxy, and an error names the proxy it went through.TALE_ALLOW_PRIVATE_CRAWL_HOSTS): each hop is routed on its own. Also every service a deployment configures itself (AI providers, connectors, SSO, storage), which never opts in.0600, read as root before squid serves as thesquiduser. The entrypoint supervises squid beside tinyproxy and dnsmasq, and squid runs only when the list names a proxy. An IPv6-only destination is refused by design, and the docs say so.docs/{en,de,fr}/self-hosted/: a new "Outbound proxies" section inconfiguration/environment-reference.md, plusconfiguration/video-ingestion.md,install/kubernetes.mdandoperate/observability/troubleshooting.md. Also.env.example,services/sandbox-egress/README.md,services/sandbox/docs/incus.md, and a commented example in the CLI's generated env. No UI string, so no message catalog changes.KNOW-F40,KNOW-B27,TASK-F95,TASK-B55,VID-F9(new);VID-F6reworded.Dormancy
With
OUTBOUND_PROXY_URLSunset,safeFetchbuilds no proxy route, so every request goes direct as before. yt-dlp gets--proxyonly fromVIDEO_INGEST_PROXY_URL, as before. The egress service renders noUpstreamand starts no squid. Tests hold each of these:safe-fetch-proxy.test.ts,ytdlp.test.ts, and the "egress proxy outbound proxies" suite inegress-proxy-config.test.ts.Checklist
bun run check:format:check,lint:conflictsandlint:linkspass, and so do 45 of its 49 turbo tasks across two local runs (everylintandtypecheck;@tale/shared1,108 tests,@tale/cli3,829,@tale/sandbox,@tale/docs,@tale/web). The Mac ran at a load average of 45 to 130 with other sessions' builds beside it. The other four failed only on time, in files this change doesn't touch: wall-clock budgets in@tale/platform(such as "diffs each pair in under 5 ms" at 13.7 s), 5 s timeouts intest:uiand@tale/sandbox-runtime-daemon, and in@tale/uia different test on each run (two 5 s timeouts, then a code-editor test that reads the partial syntax tree CodeMirror parses within its time budget). On GitHub's runners, this head's Unit lanes (platform 1/2 and 2/2, workspaces), Type check, Lint, Knip and Format all pass.bun run lint:sast(Opengrep): CI's Opengrep and Opengrep OSS pass on this head; the pre-commit Opengrep pass over the staged files passed too.docs/{en,de,fr}/, French with its non-breaking spaces.docs/{en,de,fr}/.README.md/README.de.md/README.fr.md: N/A. The root READMEs list no environment variables;services/sandbox-egress/README.mdis updated.Test plan
Local, bun 1.4.2:
The new and changed suites, run on their own:
@tale/sharedoutbound-proxies.test.ts, 58 pass (the grammar, every refusal, no password in a message).@tale/platform, 426 pass over eight files:outbound-proxy.test.ts: rotation, set-aside, revival.safe-fetch-proxy.test.ts, against real local proxies: rotation; routing per hop; failover on an unreachable proxy and on a407; no blame for a forwarded407, a502tunnel or a TLS stall.safe-fetch.test.ts.ytdlp.test.ts: override versus pool; a stand-in yt-dlp whose pooled proxy fails sets it aside.env.test.ts: the boot refusal names the position, never the password.crawl-parse.test.ts.outbound-proxies.guard.test.ts: the TypeScript and awk readers agree on 89 entries and lists; the docs and.env.examplecarry the variable.turbo-inputs.guard.test.ts.@tale/sandboxegress-proxy-config.test.ts, 43 pass: the squid rendering, the ACL order,0600, supervision, a log line that names hosts only, the FATAL on a malformed entry, and the unchanged rendering when the variable is unset.bunx knipexit 0; oxlint and the type check are in the gate above.By hand, in a Docker lab on the Mac, removed afterwards. The production egress image ran in front of two real squid upstreams:
The backend lanes were also driven through real proxies with undici.
Not run, and not claimed:
Ops follow-up
Nothing here is used until an environment sets the variable. After a release carries it, ops wires
OUTBOUND_PROXY_URLSthe wayVIDEO_INGEST_PROXY_URLis wired: thetale.jsonmapping, each deploy workflow'sservice_secrets, the secret catalogue, and the Incus egress instance's environment. That pays off the ops ledger's entry for "only the video downloader goes through the proxy". A draft of that change is prepared in the ops repository and not pushed.