Repository navigation
feat(browser): a website browser's network log, exported as HAR (M8.20) - #638
Open
earakely-scale wants to merge 4 commits into
Open
earakely-scale wants to merge 4 commits into
earakely-scale wants to merge 4 commits into
Conversation
Both proxies a browser goes out through write numbered open and end lines for each request and tunnel: the shared site proxy each exchange whole, bodies kept to a limit and a site's sign-in headers removed, the base's stand-in each connection. browser/v1 network reads the lines, and data/get exports them as network.har, the file WebArena-Verified's grader reads. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
…oding - A plain-HTTP request to a live host sends its body and reads the answer at once, as the tunnel did before, so a 100 Continue or an early 413 reaches the browser; an answer the proxy can't read as HTTP is relayed as it came, its entry marked unparsed. - Decoding stops at the limit as it goes, for br and zstd and for requests too. - With no network log, bodies are counted but neither kept nor hashed. - The stand-in writes its open line inside the relay that writes its end line, and turns down a bad Content-Length before it connects. - A line the HAR can't use is left out and counted, not fatal to data/get; the HAR is built off the event loop; a cookie's Expires is ISO 8601. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ive-host tests wait for their entry Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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.
What
A website browser now keeps a network log: every request it makes and every tunnel it opens, from the proxy it goes out through.
browser/v1network {after}reads the log's lines, anddata/getexports it as HAR 1.2,network.har, besidebrowser-log.jsonl. That is the file a network grader such as WebArena-Verified's reads. This is M8.20 (FD-4968), built to the design note: https://claude.ai/artifact/CckmYo6W6A11k1mQ6gcVFXopenline once a request has gone upstream or a tunnel has opened, and anendline, naming the sameid, once it's answered and done or has failed. A proxy started again numbers after the file's last line, and ends a line cut short by a crash first./etc/agentenv/sites/network.jsonl, opened as root, 0644, before it drops tonobody. The stand-in writes/var/log/agentenv/network.jsonl.AGENTENV_NETWORK_LOGnames the file to the browser's app server: the base sets the stand-in's, and site routing sets the shared proxy's.<removed>; none declares any until M8.35. The answer as the browser got it: status, headers (with the proxy's Location and cookie rewrites) and, for text, JSON, forms, XML and scripts, its body up to 1 MB. Any other type keeps only its size and sha256. Bodies are stored as they came, in base64; the export decodes them._open. Bodies are decoded from gzip and deflate, and from br and zstd withbrotliandzstandard, now in the protocol'sappextra, up to 1 MB. A coding that can't be undone leaves the body as base64 with_undecoded. agentenv's own fields start with_:_tunnel,_websocket,_failed,_refused,_truncated,_sha256.data/addpasses overnetwork.har, as it does overbrowser-log.jsonl. Thenetworkop isn't itself logged as an action.Decided while building (in the note, for review)
/etc/agentenv/sites, not/var/log/agentenv(changes D3). The session user owns/var/log/agentenv, so it could replace a file root opened there. The sites folder is root's (0755) and the file 0644: the session user reads it and can't change or replace it.network: false.queryStringholds decoded values, as Playwright's HAR does.https://host:443/for aCONNECT, elsehttp://host/.Tests
tst/unit/env/envs/test_computer_network_log.py(new) is the golden test. It runs requests through the shared proxy and reads them back as HAR:packages/agentenv-protocol/tests/test_browser_network.py(new): reading pages, a partial line, a log begun again, the byte limit; HAR's request and response fields, every coding, cut and charset, size and sha256 alone, WebSockets, tunnels, the stand-in's plain requests, failed, refused and open entries, and order.test_browser_data.py:data/getexportsnetwork.har,networkreads after a number, anddata/addpasses over the HAR.tst/unit/envpass, 3,844 tests. One failure is a Windows-install disk recipe test, in code this branch doesn't touch, which fails on its own on macOS.tst/integration/computer/browser_computer_test.py, local Docker on an agent-environments-admin amd64 VM):uvx --from webarena-verified==1.2.3, since itspydantic==2.12.0pin clashes with ours) reads thenetwork.harthatdata/getexports. It sees each request's method, URL, form, JSON and multipart fields and referer, each answer's status, redirect, cookie and decoded JSON, and both page loads as navigations.browser_computer_test.py,website_browser_test.py,browser_gateway_test.py,chromium_app_test.pyandmulti_env_computers_test.pypassed 57 of 58, one skipped for want of KVM. The one failure waswebsite_browser_test.pypinning the card'sbrowser/v1methods withoutnetwork; the follow-up commit adds it, and that test then passed.network {after}during the burst got every line once, in order.kill -9, the stand-in by the session user'spkill. Each came back (keep and supervisord), and the new process numbered on from the file's last line: no number repeated, no gap, no cut line.Permission denied): the file is 0644 and its folder 0755, both root's._truncated; the proxy's RSS stayed at 44 MB. A HAR of 1,441 entries exports in 0.6 s.Fixed after review (ee6d2ea)
Greptile's first round, and a second review of the diff against the code before it:
100 Continueand hung on an early 413. An answer the proxy can't read as HTTP (a header without a colon, bare-LF lines, a head over 1 MB) is relayed as it came, as before, its entry marked_unparsed; the first build turned it into a 400.data/get.brotli>=1.2, foroutput_buffer_limit.openline inside the relay that writes itsendline, so a reset or a badContent-Lengthcan't leave an entry open for good, and it turns down a badContent-Lengthwith a 400 before it connects._unreadable, instead of failing the wholedata/get; the session user owns the stand-in's log and could write one. The HAR is built off the event loop.Expiresis ISO 8601, as HAR has it.Each comes with a test; the relay tests fail on the commit before. Unit: the protocol suite and
tst/unit/env, 3,856 pass (the same Windows disk recipe test fails on its own on macOS).Found in chaos, for a decision
_openin the HAR for good: 2 of the shared proxy's, 12 of the stand-in's. The proxy started again could end the dead process's open ids with_failed: {"reason": "the proxy restarted"}. That's a small follow-up if you want it./var/log/agentenvand the stand-in runs as it, as D3 expected. Numbering carries on, but history is gone. An agent on a browser computer alone has no shell, so this matters only for code run inside the computer.🤖 Generated with Claude Code


Confidence Score: 5/5
The latest changes appear safe to merge; the previous cookie-date export failure is fixed.Summary
Adds proxy-backed network logs, reads them through
browser/v1 network, and exports them asnetwork.har.Diagram
%%{init: {'theme': 'neutral'}}%% flowchart LR Browser --> Proxy[Shared proxy or stand-in] Proxy --> Site Proxy --> Log[Numbered open and end lines] Log --> Read[browser/v1 network] Log --> Export[data/get] Export --> HAR[network.har]Reviews (3) · Last reviewed commit: "fix(browser): a cookie expiry past UTC's..." · Reviewed by Greptile