Skip to content

feat(website): a third-party app wrapped as a site, with ForwardingSite (M8.34, M8.35) - #656

Merged
earakely-scale merged 6 commits into
mainfrom
edgararakelyan/fd-4983-m835-the-shared-third-party-site
Nov 13, 2026
Merged

earakely-scale merged 6 commits into
mainfrom
edgararakelyan/fd-4983-m835-the-shared-third-party-site

Conversation

@earakely-scale

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

Copy link
Copy Markdown
Collaborator

Implements M8.34 (FD-4982) and M8.35 (FD-4983). Design note: WAV Slice: Shopping Admin.

What

A website env can now wrap a third-party web app it didn't write, such as WebArena-Verified's Magento admin, and agentenv deploys it like any site (M8.34, M8.35). This is the framework half of the WebArena-Verified shopping admin slice; the bundle (image, tasks, grader) goes in agentenv-benchmarks.

  • ForwardingSite (agentenv_protocol.website), a WebsiteEnvironment that runs beside the app in its container:
    • It answers the card, the data plane and website/v1 itself, and forwards every other request to upstream.
    • A request goes on as it came: its method, the site's own path with its encoding intact, its query, the Host the browser named and its body, streamed. The forwarder's client keeps no cookies, so one browser's cookies never go on with another's request.
    • The hop-by-hop headers and the site's sign_in_headers stay behind, and the forwarder adds no header of its own.
    • The answer comes back as the app gave it, streamed and still encoded, with redirects not followed.
    • One exception: a cookie the app ties to one of the site's own names (Domain) comes back host-only, as agentenv sets a sign-in's cookies. A sign-in then replaces the app's session cookie instead of sitting beside it.
    • An app that isn't answering gets a 502 (upstream_unavailable). A WebSocket is refused with close code 1011.
    • It is ready once the app answers ready_path below 500, asked with the site's first name as Host.
    • It signs a browser in through a @session_state of its own. Its sign_in_headers list keeps a sign-in header to the site's own request.
    • Its card names its sign_in_headers too. agentenv carries them from the card to the site proxy, whose network log already takes their values out, so a browser request carrying the auto-login header shows in network.har with <removed> (M8.20's D6 hook, filled).
    • ask_app(path, method=..., headers=..., content=...) is how a site class calls its app. It asks under the site's first name as Host, through the forwarder's client, which keeps no cookie and follows no redirect. The ready check and the session use it, so a site class never reaches into the forwarder.
  • Two @website switches, for any site:
    • builtin_routes=False serves none of agentenv's site routes, so /api/session reaches the app.
    • clock="real" declares a site that keeps real time. It serves no clock/v1, stamps no X-Universe-Now, and its params say clock: "real". @website refuses it together with clock_patch.
  • Conformance:
    • It skips its two clock checks for a card declaring a real clock.
    • It passes a data plane that serves data/get alone once data/get answers.
    • any_host also passes a / that redirects to one of the card's own domains, as a fixed-base-URL app does.
  • agentenv_protocol.passthrough: the hop-by-hop header filter, now shared by the computer's /svc route and the forwarder.
  • names_host: the wildcard-domain matcher moves to website/readiness.py, shared by the browser and conformance.
  • The site proxy names a site's served fields once (SERVED_SITE_FIELDS and PRIVATE_SITE_FIELDS), which install() and Config.load both read. A test fails if proxy_config writes a field neither list names, or if the proxy's Site takes one that install() doesn't serve.
  • Fix, browser_sign_in: a session cookie on a sub-path is now set on that path. For an exact name, sign-in used to fold the path into the cookie's URL and leave the path out, and Chrome gives such a cookie its URL's default path, / for /admin. The site's own cookie on /admin was then sent first, and the browser stayed signed out.

Decided while building (for review)

These are in the design note's "Decided while building" and "Found on the VM" sections:

  1. The forwarding site's data plane serves data/get alone, which exports nothing. agentenv already passes over a site whose card serves no data/reset. M8.35 said data/reset would answer that it can't reset; this way needs no new error.
  2. A WebSocket is refused with close code 1011. The forwarder relays HTTP alone, and Magento's admin opens none.
  3. Ready means the app answers ready_path below 500, so an app that is still booting holds the deploy. A site adds its own @ready_check for more; the WebArena-Verified one waits until Magento names the site.
  4. any_host passes a redirect to the site's own name (Edgar chose this on review). A forwarder that rewrites Host, and leaving the check failing, were left out.
  5. App cookies tied to the site's name come back host-only (Edgar chose this on review).
    • Found on the VM: the start tab's first load gave chromium an anonymous admin cookie with Domain=shopping-admin.localhost. Sign-in's host-only admin cookie then sat beside it, and chromium sent the older one first, so the browser wasn't signed in.
    • Left out: sign-in deleting same-name cookies first (it breaks once the app issues a new session id), a domain for @session_state cookies, and tasks opening the start tab only after sign-in.

Tests

  • Protocol unit:
    • tests/test_website_forwarding.py (new, 17 tests): forwarding, bodies, encodings, methods, the card and data plane, the session, the 502, readiness, the forwarded prefix, the WebSocket refusal, the real clock, conformance, the switches, and no headers of the forwarder's own.
    • test_website_conformance.py covers the any_host redirect cases.
    • The suite: 1,591 passed.
  • Integration (browser_computer_test.py):
    • Fixture: tst/data/forwarding_website, a small app behind a ForwardingSite named shop.localhost.
    • What it checks: a multi env's chromium loads the app's page by name over HTTP. browser_sign_in signs it in through the site's header, and the start tab loads again signed in. The app sees the site's own Host and path and never the header, and network.har has the app's pages.
  • VM e2e (amd64, agent-environments-admin), against WebArena-Verified's real shopping admin image, wrapped:
    • Run on its own: its card answers at 1.9 s, and it is ready at 23.8 s, once the image's boot init is done.
      • Conformance: 6 passed, 0 failed, 1 warning. The warning is PHPSESSID tied to the made-up Host's own domain.
      • The session hands back Magento's admin cookie, and data/get exports nothing.
    • In a multi env with chromium (wav_shop_vm_test.py, a VM-only harness, not committed):
      • It deploys in 67 s, and the start tab loads Magento's sign-in page by name.
      • browser_sign_in takes 2.5 s, after which the tab reloads on "Dashboard / Magento Admin" with one admin cookie on /admin.
      • An agent's own fetch with the auto-login header and no cookies gets the sign-in form.
      • network.har has the admin pages.
    • Regression on the VM:
      • browser_computer_test.py: 36 passed, 1 skipped. The skipped WebArena-Verified HAR test passed in a later run.
      • website_browser_test.py: 4 passed.
      • multi_env_computers_test.py: 4 passed.
      • browser_gateway_test.py: 3 passed.
      • gateway_test.py: 30 passed, 816 skipped.
      • Rerun after the cookie fixes: the four multi-env sign-in, forwarding and HAR tests, and website_browser_test.py, all passed.
  • Local: the protocol suite, tst/unit/env and tst/unit/task_step pass. One test_disk_recipe Windows test fails on macOS, on main too.

🤖 Generated with Claude Code

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge; no blocking issue remains.

Summary

Adds ForwardingSite so a website environment can wrap a third-party app.

  • A website can forward its pages to an app running beside it.
  • Website declarations can leave built-in routes and virtual time to the app.
  • Conformance checks accept websites with app-owned data and fixed host names.
  • Site sign-in header names reach the computer proxy for log masking.
  • Browser sign-in keeps session cookies on their declared paths.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  Browser --> Proxy[Site proxy]
  Proxy --> Site[ForwardingSite]
  Site -->|Page requests without sign-in headers| App[Third-party app]
  Framework -->|Card, readiness, session, data| Site
  Site -->|ask_app for readiness and sign-in| App
  Proxy -->|Sign-in header values removed| HAR[Network records]
Loading

Reviews (6) · Last reviewed commit: "refactor(website): one name for a site's..." · Reviewed by Greptile

…te (M8.34, M8.35)

- ForwardingSite answers the card, data/get alone and website/v1 itself and forwards every other request to the
  app beside it, as it came: no hop-by-hop or dropped headers, none of its own; the answer streamed back still
  encoded, redirects unfollowed, and a cookie the app ties to one of the site's names host-only. Ready once the app
  answers ready_path below 500; a WebSocket is refused (1011).
- @website(builtin_routes=False, clock="real"): no built-in site routes; a site that keeps real time serves no
  clock/v1 and stamps no X-Universe-Now.
- Conformance skips the clock checks for a real clock, passes a data plane of data/get alone, and passes any_host
  for / redirecting to one of the card's domains.
- browser_sign_in sets a session cookie on its own path: a URL alone put a cookie on /admin at /, beside the site's.
- passthrough.passed_on shared by the computer's /svc route and the forwarder; names_host shared by the browser and
  conformance.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
earakely-scale and others added 3 commits November 12, 2026 17:00
…go on with another's request

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ts app

- ask_app(path, method, headers, content, timeout) asks the app as the site does, under its first name as Host,
  through the forwarder's client; the ready check and the test fixture's session use it, so a site class no longer
  reaches into fallback_app().client.
- The forwarder is a cached property; the site's exact names are computed once.
- UNIVERSE_CLOCK/REAL_CLOCK live in readiness.py beside WEBSITE_CLOCK_PARAM; conformance compares with REAL_CLOCK.
- Conformance: the clock skip is one rule over CLOCK_CHECKS, and the data plane's data/get-alone case is a set
  comparison sharing the data plane's URL setup.
- route_path is public (forwarding.py used the private name); docstrings rewrapped.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…he browser's network log

A ForwardingSite's card names its dropped_headers as the site's sign_in_headers (WEBSITE_SIGN_IN_HEADERS_PARAM).
Site routing carries them from each site's card to the site proxy's config, whose network log already takes their
values out, so a browser request carrying the auto-login header shows in network.har as <removed>. The computer's
env_params sites take sign_in_headers too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
earakely-scale and others added 2 commits November 13, 2026 08:19
…nfig it serves from

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…t of a site's served fields

- ForwardingSite.dropped_headers is sign_in_headers, the name its card gives them: only the site's own calls send
  them, the forwarder drops them from every browser's request, and the network log takes their values out.
- The site proxy names a site's served fields once (SERVED_SITE_FIELDS, PRIVATE_SITE_FIELDS); install and
  Config.load both read the list, and a test fails if proxy_config writes a field neither names or the proxy's Site
  takes one install doesn't serve.
- ask_app and the forwarder build the app's URL with one helper, Forwarder.url.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@earakely-scale
earakely-scale merged commit a527ea8 into main Nov 13, 2026
63 of 66 checks passed
@earakely-scale
earakely-scale deleted the edgararakelyan/fd-4983-m835-the-shared-third-party-site branch November 13, 2026 17:55
andrewpark-scaleai added a commit that referenced this pull request Nov 13, 2026
… own

browser_computer_test.py took 1035s on main (run 43464622905), and shard 4 of
the slow tier, which ran it, took 1142s of the workflow's 1160s. A file's tests
run on one worker of one shard, so the file set the tier's time.

The ten tests of its multi-env sections (browser_envs, a site reached by its
names through the gateway, and a site wrapping an app) move unchanged to
browser_multi_env_test.py. Nine of them took 461s in that run; the tenth came
later in #656. The 30 that stay took 574s. The new file imports its helpers
from browser_computer_test.py, as browser_gateway_test.py does, and deploys the
module-scoped browser_computer fixture once more. _browser_op stays in
browser_computer_test.py, since a browser recording test there uses it too.
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