Repository navigation
feat(browser): browser_sign_in, and browser steps reach a multi env's computers (FD-4944) - #556
Conversation
… computers (FD-4944)
browser_sign_in {site, user} signs an env's website browser in to a site as a
user: the site's website/v1 session gives the cookies and local storage, each
cookie is set for every name the site is reached by (an exact name by its URL,
a *. name as a domain cookie), and the browser's data/add loads them, which
opens its start tabs again while no agent has acted. The site is a website env
deployed in the run on its own or in a multi env, by its env id. A task runs
the step after the load that seeds the site and again after reset_env.
Every browser step now reaches a browser app inside a multi env's computer,
through the computer's own record and control token kept in the multi env's
record, since the gateway lists a computer but not its apps.
browser_connect_cdp refuses one for now: its agents reach it through the
gateway, whose address it doesn't hand out yet.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…as, not its card's name A website's card name needn't be its environment_name (a card named Notes served as notes), so look the site up by its /svc/<name>/ route, as deployed_sites does; sites.served_as is public for that. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…, and its site image keeps curl for the health check Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
🤖 Automated Claude routine — Env Pod PR Context Review. This is a bot, not Edgar Arakelyan; not a human review. Context from another open PR rather than from this diff: #447 also adds a browser sign-in task step, under a different name and a different mechanism, and neither PR references the other.
Both register into the same They also differ on what happens after a reset, which is worth settling deliberately rather than by merge order: #447 modifies Generated by Claude Code |
…4-browser-sign-in # Conflicts: # src/agent_env/env/envs/computer/utils/sites.py
…tores, else those its card declares deployed_sites routes a website by a composed card's child or a frontend, so a website a plugin deploys alone, with a card of its own and no frontend, had no names and the sign-in failed before asking for a session. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Summary
M5.15 (FD-4944): a task signs the browser in to a site as a chosen user. Design: Signing the browser in (M5.15). Its four decisions were proposed on Nov 8 while you were away, and this PR is built on their recommendations. They're settled once you review them.
browser_sign_in {site, user, browser?}. It signs an env's website browser in tosite, a website env deployed in the run, on its own or in a multi env, named by its env id assite_routingdoes.website/v1session {user}gives the cookies and local storage, through the record that serves it.sessionleaves the domain unset, so an exact name is placed by its URL and a*.name becomes a domain cookie.data/addloads them, which opens its start tabs again while no agent has acted.A task runs it after the load that seeds the site, and again after
reset_env, since a reset now starts the browser afresh and empties the sites (#542). This revises the earlier design, in which the multi env signed in by itself at deploy and after each reset (decision 1).Browser steps reach a multi env's computers. The gateway lists a computer but not its apps, and the computer isn't in
context.deployed_envs.find_browsernow also looks through the multi env record'schild_envs, and calls a browser in a computer with that computer's own record and control token, asbacking_servershas since #542.browser_connect_cdprefuses such a browser for now: its agents reach it through the gateway, whose CDP address it doesn't hand out yet.Finding the site. The step finds the site by the name it's served as, the
<name>of its/svc/<name>/route, asdeployed_sitesdoes, not by its card's name: aWebsiteEnvironment's card is named after its class (Shop), and the test site is served asshop.sites._served_asis public asserved_asfor this (Greptile round 1). Since #557 (FD-5376) merged, the helper reads the gateway's statedenvironment_namefirst, and falls back to the route for older gateways; 1b40fb5 merges main and keeps that body under the public name.Test plan
Unit (
tst/unit/task_step/test_browser_sign_in.py):data/addgoes to the computer's browser with the computer's token;*.and.localhostnames;session, or not deployed, fails before the browser is touched;browser_set_cookiesreaches a multi env's computer;browser_connect_cdprefuses one;Integration (
website_browser_test.py): a multi env with the website-browser test desktop (site_routing) and a smallWebsiteEnvironmentsite,tst/data/session_website. The browser has no session forshop.testbefore the step, and the site says Alex is signed in after it. Afterreset_envthe browser has none again, and after the step again the site says Alex.Unit suites:
tst/unit/task_step,test_computer_sites.py,test_env.py, 2,576 passed.VM e2e (c6i.4xlarge, amd64, Nov 9): the integration test above passed. The first runs caught two bugs in the test itself, both fixed in f469be6:
MultiEnv.putneedsmcp_server_envs, and the site image needs curl for the website health check.VM chaos, one multi env deploy, all in 20 minutes:
docker restartthe siteWEBSITE_SESSION_SECREToutlives the processExtensionCallError: 502 Bad Gateway; the browser is untoucheddata/add failed: no browser is connected over its debugging pipe (the load had applied nothing)A browser killed mid-run stays down until a reset, which is the browser app's behavior, not this PR's. The 502 error doesn't name the site; the failing step's id does.
🤖 Generated with Claude Code


Confidence Score: 5/5
The PR appears safe to merge; no new actionable issues remain.Summary
Adds
browser_sign_inand lets browser steps reach computers inside a multi env.Diagram
sequenceDiagram participant Step as browser_sign_in participant Site as Website participant Browser as Computer browser Step->>Site: Request session for user Site-->>Step: Cookies and local storage Note over Step: Scope cookies to the site's names Step->>Browser: data/add with computer's control token Browser-->>Step: LoadedReviews (11) · Last reviewed commit: "fix(browser): a website deployed alone i..." · Reviewed by Greptile