Public: anyone can read this; the crew can change it.
Inside a child cell, the looks browser cannot reach the child's own app (net::ERR_INTERNET_DISCONNECTED) #10615
Inside a child cell, the looks browser now dials 127.0.0.1 on the app's port and sends the app's own hostname as the Host header. I couldn't run Chromium here, so I haven't seen a real picture come out of a cell. bun x tsc --noEmit and the three new tests pass, and bun scripts/gate.ts printed no errors.
stopped parked by the crew deploy 013ad25
3 earlier comments
Inside a child cell, the looks browser now dials 127.0.0.1 on the app's port and sends the app's own hostname as the Host header. I couldn't run Chromium here, so I haven't seen a real picture come out of a cell. bun x tsc --noEmit and the three new tests pass, and bun scripts/gate.ts printed no errors.
The cause (inferred, not reproduced). The cell's network is loopback only, and I believe Chromium treats that as offline. I think any hostname it has to resolve fails with net::ERR_INTERNET_DISCONNECTED, even one mapped to 127.0.0.1 by --host-resolver-rules. The port was already local. I couldn't confirm the Chromium behaviour from here.
What changed. The fix is in src/looks/capture.ts. A new targetFor(url, inCell) picks the address, and the cell is detected the way apps/egress.ts already does it (upstreamProxy() is set).
- Inside a cell: the browser navigates to
127.0.0.1:<port>, and theHostheader is set through DevTools for every request. The page is checked against127.0.0.1, and the host-resolver rule is dropped. - Outside a cell: behaviour is unchanged.
- Network: the cell gains none.
--no-proxy-serverstays, and the only destination is loopback.
Tests. test/look-cell-target.test.ts has three cases:
- Outside a cell, the host is mapped.
- Inside a cell, the target is the loopback address with the
Hostheader and no resolver rule. - Against a real loopback server, the cell target reaches the app and the server sees the app's hostname.
Not covered. There is no end-to-end test that a cell child gets a picture of its own app, because that needs a Chromium that can run inside a cell. Three tests in test/looks.test.ts that launch the real browser fail here with process_singleton_posix.cc: socket() failed: Operation not permitted, on main too. The forge's check runs them. If Chromium still reports offline with the loopback address and the Host header, the next thing to try is a proxy-style navigation.
Inside a child cell, the looks browser now dials 127.0.0.1 and sends the app's hostname as the Host header, but only when the URL has a name in it. I couldn't run Chromium here (it fails on a socket error in this sandbox), so I haven't seen a real picture come out of a cell, and the check's last run was red.
The fix for the failing tests. The first version also rewrote URLs that were already 127.0.0.1, adding the Network.enable and Host-header path. That is the likely reason the "error page" and "dark capture" tests failed in the check, since both use 127.0.0.1 URLs. targetFor in src/looks/capture.ts now leaves an IPv4 or bracketed-IPv6 address exactly as it was before this pull, in a cell or out of one.
The risk. I haven't confirmed that the "real capture through the grant door" test passes. Its URL is a named host, so in a cell it still takes the new path (loopback address plus Host header). If the forge's check still fails that one test, the fault is in that path, and I'd want its error text.
What changed. src/looks/capture.ts gets the address check, and test/look-cell-target.test.ts gets a test that an address stays as it is in a cell. That file's four tests, bun x tsc --noEmit and bun scripts/gate.ts pass.
Not done. I added no end-to-end cell test, because a cell can't be built in this sandbox.
The real-capture test is still red, and I haven't fixed it. I couldn't find the cause from here, so this push only makes the failure readable.
- Where it fails. The previous push fixed the other two Chromium tests, which use
127.0.0.1URLs. The one left is "a real capture through the grant door". Its URL has an app hostname in it, so in a cell it takes the new path: the browser dials127.0.0.1and sends the app's hostname as theHostheader. - What I checked. I read
grant,openEnvUrlandoriginForinsrc/apps/proxy.tsandsrc/actions/apps.ts. The grant door answers with a relative303and sets the cookie, so nothing there obviously breaks on a loopback address. That leaves theHost-header override or the cookie handling on127.0.0.1as the suspects, and I can't tell which from here. - What I changed. The test now compares the whole capture result instead of only
ok, so a failing check log will name the reason. That change is intest/looks.test.ts. - What I couldn't run. Chromium won't start in my sandbox (
socket() failed: Operation not permitted). The check is the only place this test can run. - Next step. Read the reason in the check log for this push and fix that. If it is the
Hostoverride, the fallback to try is sending the browser through a proxy-style request to the forge's listener.
Parked by the crew: the check stayed red through 2 automatic tries
Inside a child cell, the looks browser now dials
127.0.0.1on the app's port and sends the app's own hostname as theHostheader. I couldn't run Chromium here, so I haven't seen a real picture come out of a cell.bun x tsc --noEmitand the three new tests pass, andbun scripts/gate.tsprinted no errors.The cause (inferred, not reproduced). The cell's network is loopback only, and I believe Chromium treats that as offline. I think any hostname it has to resolve fails with
net::ERR_INTERNET_DISCONNECTED, even one mapped to127.0.0.1by--host-resolver-rules. The port was already local. I couldn't confirm the Chromium behaviour from here.What changed. The fix is in
src/looks/capture.ts. A newtargetFor(url, inCell)picks the address, and the cell is detected the wayapps/egress.tsalready does it (upstreamProxy()is set).127.0.0.1:<port>, and theHostheader is set through DevTools for every request. The page is checked against127.0.0.1, and the host-resolver rule is dropped.--no-proxy-serverstays, and the only destination is loopback.Tests.
test/look-cell-target.test.tshas three cases:Hostheader and no resolver rule.Not covered. There is no end-to-end test that a cell child gets a picture of its own app, because that needs a Chromium that can run inside a cell. Three tests in
test/looks.test.tsthat launch the real browser fail here withprocess_singleton_posix.cc: socket() failed: Operation not permitted, onmaintoo. The forge's check runs them. If Chromium still reports offline with the loopback address and theHostheader, the next thing to try is a proxy-style navigation.Closes #10557