Skip to content

feat(computer): a browser alone routing sites goes out only through the site proxy's forward port (FD-4934) - #541

Merged
earakely-scale merged 5 commits into
mainfrom
edgararakelyan/fd-4934-m55-the-site-proxys-forward-proxy
Nov 9, 2026
Merged

earakely-scale merged 5 commits into
mainfrom
edgararakelyan/fd-4934-m55-the-site-proxys-forward-proxy

Conversation

@earakely-scale

@earakely-scale earakely-scale commented Nov 8, 2026 •

Copy link
Copy Markdown
Collaborator

What and why

M5.5 (FD-4934): a browser alone that routes sites goes out only through the shared site proxy's forward port, 127.0.0.1:3129, which enforces the site table and runs out of the agent's reach. Until now the headless base's stand-in on 3128 forwarded every request, refusing nothing, and ran as the session user, so the agent could stop it. This unblocks M5.7, M8.13, M8.20 and M8.21.

The decisions are on FD-4934. Decision 1: the base's stand-in stays, untouched, for a browser computer that routes no sites, so the forward port takes 3129. Decision 2, revised to b: the port listens only on a browser computer.

  • The port (site_proxy.py, SiteProxy.handle_forward), listening only on a browser computer (sites.route, for a computer with no display). In a desktop computer nothing points at it, and an app there already on that port would otherwise stop the whole site proxy from starting:
    • A CONNECT to a site's name tunnels into TLS with that site's certificate from the deploy's CA, then on to its route exactly as the transparent listeners send it (X-Forwarded-Host, X-Forwarded-Proto, the site root header).
    • A request naming a site's URL is served as the HTTP listener serves it: a .localhost name over HTTP, a real name sent to HTTPS with a 308 that keeps the path and query.
    • Responses stream (event streams arrive as they're sent), and the answer waits with no timeout.
    • Any other host is refused at once with 403 and a line in the site proxy's log, loopback included. The browser alone sends loopback through its proxy (<-loopback>), so this keeps an agent's browser off the computer's own control ports. Outside hosts come back with M8.21.
    • It runs inside serve, which drops to nobody and which keep restarts as root, as the listeners do. The session user can't stop it.
  • The browser computer:
    • A browser computer that routes sites boots with AGENTENV_SITE_PROXY naming the port (sites.browser_environment, for a base with no display).
    • The headless base isn't changed. Its stand-in stays on 127.0.0.1:3128, and a browser computer that routes no sites goes out through it as before. It can go once M8.21 gives the port a rule for outside hosts.

How it was tested

  • ruff check: clean.

  • Unit tests (test_computer_site_proxy.py):

    • a CONNECT tunnels through the site's certificate to its route, two requests on one tunnel;
    • a .localhost URL is served over HTTP, and a real name's is sent to HTTPS with its query;
    • an outside host and loopback, by CONNECT and by URL, are refused at once with a log line and nothing sent upstream;
    • an event stream's first event arrives before its response ends;
    • the install hands serve the port.
  • Unit tests elsewhere: test_computer_sites.py checks that only a computer with no display gets the port in its config and is named it; test_computer_env.py checks that a desktop computer routing sites isn't.

  • tst/unit/env, tst/unit/providers and tst/unit/bundle, on the branch with main (feat(multi): computers as child envs of a multi env (FD-4935) #539) merged in: 5210 passed. The 2 test_disk_recipe failures fail on macOS only.

  • VM e2e, agent-environments-admin, amd64 and arm64:

    • browser_computer_test.py runs whole.
    • It has a new test: a browser computer routing a site over HTTPS and a .localhost one, from this machine. It checks that:
      • start tabs on both load through the port;
      • the computer is named the port;
      • pages load through it by name over HTTPS and HTTP, and a real name over HTTP reaches HTTPS with its query;
      • an event stream's first line arrives before its response ends;
      • example.com and loopback, by CONNECT and by URL, are refused with 403 and logged;
      • the session user's pkill leaves the port serving;
      • a root kill -9 of serve, in the deployed computer's own container, brings it back on a new pid;
      • after a reset, it serves the sites, refuses the rest, is named the port and opens both start tabs again.
    • The CA trust, routed-site and start-tab tests in a desktop computer run again beside it.

    On 632ceaf:

    • amd64: 20 passed. One test skipped: the CDP clients need Node, which the VM lacks.
    • arm64: 17 passed, with the same Node skip. Three echo-agent CDP tests failed because the echo agent's image build fails at pip install on arm64. That's the same failure M5.12's arm64 runs deselected, and nothing in it touches this change. The forward-port test passed on both arches.
    • Greptile's first round found two issues, both fixed in 9babd1e. A real name's redirect to HTTPS dropped the query, and the e2e found its container by scanning Docker instead of taking the deployed computer's own. The forward-port test then passed again on amd64 and arm64.
    • After the review of my own concerns and the move to port 3129, the forward-port test (now with its reset) and the CA trust test in a desktop computer, which no longer gets the port, passed on amd64 and arm64. They passed again with main (feat(multi): computers as child envs of a multi env (FD-4935) #539) merged in, at 41564a9.

🤖 Generated with Claude Code

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge; no new actionable issue was established.

Summary

Adds a site-only forward proxy for browser computers.

  • Routed headless browsers now use the site-only proxy.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  Browser[Browser routing sites] --> Forward[Forward proxy on 3129]
  Forward --> Check{Configured site?}
  Check -->|Yes| Route[Configured upstream route]
  Check -->|No| Refuse[403 and log entry]
Loading

Reviews (5) · Last reviewed commit: "Merge remote-tracking branch 'origin/mai..." · Reviewed by Greptile

…he site proxy's forward port (FD-4934)

- The shared site proxy listens on 127.0.0.1:3128 as a forward proxy. A CONNECT to a site's name tunnels into TLS with
  the site's certificate from the deploy's CA and on to its route, as the transparent listeners send it; a request
  naming a site's URL is served as the HTTP listener serves it, a real name sent to HTTPS and a .localhost one kept on
  HTTP; responses stream; any other host, loopback among them, is refused at once with 403 and a log line.
- A browser computer that routes sites boots with AGENTENV_SITE_PROXY naming the port, which runs out of the agent's
  reach as the rest of the site proxy does. The headless base's stand-in moves to 3129 and serves only a browser
  computer that routes no sites.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@earakely-scale
earakely-scale requested a review from a team as a code owner November 8, 2026 17:00
earakely-scale and others added 4 commits November 8, 2026 09:06
…he e2e acts on its own computer

- A request through the forward port naming a site's URL over plain HTTP was sent to HTTPS without its query string.
- The forward port e2e found the computer to kill the proxy in by scanning Docker; it now takes the deployed
  computer's own container from the local provider.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nd its e2e covers a reset

- The site proxy listens on the forward port only for a computer with no display, a browser alone's. A desktop
  computer, where nothing points at it, no longer binds 3128, so an app of its own there can't stop the whole proxy
  from starting.
- The forward port e2e resets the browser computer and checks that it serves the sites, refuses the rest and starts
  its tabs again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e's stand-in stays as it was on 3128

A browser computer that routes no sites now changes not at all, and the base image isn't touched: the stand-in keeps
3128, and a computer that routes sites names the forward port, 127.0.0.1:3129, to its browser through
AGENTENV_SITE_PROXY.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@earakely-scale
earakely-scale merged commit de039d8 into main Nov 9, 2026
35 checks passed
@earakely-scale
earakely-scale deleted the edgararakelyan/fd-4934-m55-the-site-proxys-forward-proxy branch November 9, 2026 00:23
earakely-scale added a commit that referenced this pull request Nov 9, 2026
…ting branch

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant