Repository navigation
Conversation
snapshot lists only interactive elements and headings, and screenshot returns pixels, so an agent reading a docs page paid one scroll and one screenshot per screen. The new read op returns the page content as text (innerText of the whole page, plus open shadow roots and same-origin frames, which Chromium's innerText does not enter) or as HTML, scoped to a ref when given, and paged by offset. It runs in the walker's isolated world through run_op, so the URL gate, the takeover fence and the ref rules apply as for snapshot. A root with no box gives no text: innerText on it falls back to textContent, script bodies included. Frames are counted as scanFrames counts them, which read reuses as its walk, so an object or embed document is never read. HTML is serialized from a copy imported into a document with no window, so nothing loads or runs and the live DOM is untouched. React mirrors a typed value into the value attribute, so every input's value but a button's, checkbox's or radio's is blanked, and textarea bodies are emptied. Secret or CSRF meta content and attributes, credential query and fragment parameters in URLs, template content and comments are scrubbed too. The html note says it is the light DOM of one document. The gateway redacts the whole content before paging, so a token cannot straddle two pages, and returns a digest that changes with the page. The shim fences the content with a new pair in the shared fence registry and neutralizes look-alikes, so a page cannot forge a note or a hand-back line outside the fence. Rejected: the reflex observe's visibleText() viewport walk, which reads only what is on screen; reopen if a caller needs what is in view rather than the whole page. Separate text and html ops: one op with a format argument shares every gate and the paging; reopen if the two need different gates. Scoping read to a cross-origin frame ref: refused with bad_ref for now; reopen if agents need frame text, through FrameOps. Stripping whole query strings from URLs in html: it breaks doc links; reopen if a credential parameter name escapes the list.
6bcdc3f to
12505b6
Compare
UX Review (Opus 5.5, fork) — ✅ PASSUX-level review of UX-Verdict: PASS Nothing to check: the change adds an agent-facing [UX-REVIEWED] 12505b6 Description read[DESCRIPTION-READ] 4385bcd356e9880ac96bb62813eecbc4f64453208540e66a8391770b9bd4d47a That sha256 names everything this verdict read: the PR description, plus the 3 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
Design Review (Opus 5.5, fork) — ✅ PASSDesign-level review of Design-Verdict: PASS No design-level concerns. The new Notes
[DESIGN-REVIEWED] 12505b6 Description read[DESCRIPTION-READ] a12add38597e73df9ca58eb4e3c17621a018c31a6dd5d26b84e5cdfe1b32a6df That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
First Principles Review (Opus 5.5, fork) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS The Notes
What this change shipsInventory (9 items) — 8 justifiedIntent: let the agent read a whole web page, including one behind a login, as text instead of looping on scroll and screenshot. ADDITION.
[FIRST-PRINCIPLES-REVIEWED] 12505b6 Description read[DESCRIPTION-READ] 5b8c3ab9c75b822a349d082bd331921b08b4ff06f6bc30aabfeecfec86252959 That sha256 names the PR description this verdict read. Recompute it with |
Opus 5.5 Review (fork) — ✅ no blocking findingsReviewed |
GPT 6.1 Review (fork) — 🔴 changes requested (blocking)Reviewed 2 of 2 blocking finding(s) are security-class and were withheld from adjudication, so the blocking verdict stands. BLOCKING -- src/kiro_crew/mcp_tools/browser.py:301 -- Page-controlled titles bypass the untrusted-content fence
BLOCKING -- src/kiro_crew/browser_harness/snapshot_walker.js:736 -- HTML reads expose credentials embedded in iframe srcdoc
[BLOCK-MERGE] 12505b6 Adjudication (Opus 5.5) — is blocking on each finding proportionate?The adjudicable block is empty, so nothing could be downgraded. Both fenced findings keep blocking, and I flagged neither for override. F1 (
F2 (
|
|
Superseded by #36027, the same commit on a branch of this repository. |
Problem / Motivation
Goal: Let the agent read what a web page says as text or HTML, instead of scrolling and screenshotting it one screen at a time.
The
browsertool'ssnapshotlists only controls and headings, andscreenshotreturns pixels. To read a documentation page, the agent pays one scroll and one screenshot per screen. On a signed-in docs site, nine pages took 60 to 100 screenshots, and the host flagged the repeated scroll calls as a loop.Why it matters
Each frame costs image tokens, and text read off pixels cannot be quoted or searched exactly. A page that only renders in a logged-in browser cannot fall back to
web_fetch, so today the screenshot loop is the only way to read it.Not a goal
queryread by selector (Browser tool: let the agent act by DOM/CSS selector, not snapshot-refs + screenshots #18933).evaluatestays out of the op list.What changed (motivation → approach → change)
One op,
read, with aformatargument, so text and HTML share every gate and the paging. The reflex loop'svisibleText()was not reused because it reads only the viewport.snapshot_walker.js):textis the root'sinnerText(the whole page, not only the viewport), then the text of each open shadow root and same-origin frame, whichinnerTextskips; real Chromium confirms that shadow text is not duplicated. A root with no box returns no text, becauseinnerTextwould fall back totextContentand its script bodies.htmlserializes a copy imported into a document with no window, so the live DOM is untouched and nothing in the copy runs. The copy blanks every typed-fieldvalue(React mirrors typed values into the attribute), secretmetacontent and secret-named attributes, credential parameters in URLs (the rest of the link stays),templatecontent and comments, and emptiesscriptandstylebodies.scanFramesgains an optional start and root callback, soreadcounts skipped frames the same way the screenshot guard does; its default call is unchanged.ops.py): validatesformat,offsetandref, and redacts the full content before paging, so a credential cannot be split across two pages. One result carries 18,000 characters plustotal,next_offsetand adigestthat changes when the page changed between calls. It runs throughrun_op, so the URL gate and the takeover fence apply as forsnapshot.mcp_tools/browser.py, description inmcp_tools/catalog/browser.py): fences the page content with a new pair in the shared marker registry (context_assembly/markers.py), so a page cannot forge the shim's note or hand-back lines.readcounts as a read-only op after a hand-back.security_posture.pylistsbrowser_harness/ops.pyas inbound page-text redaction, beside the shim.docs/system-specs/modules/browser.md, op lists inconfig/prompt.mdand thekirocrew-commands/SKILL.mdandweb-browse/SKILL.mdbuiltin skills.Backwards compatibility
Compatible: a new op and a new optional walker call; every existing op, argument and result is unchanged.
Removes nothing: the diff only adds an op, a fence pair and an optional
scanFramesparameter whose default keeps today's walk.Tests
test/test_browser_read_op.py: paging reproduces the full content, and the last page has nonext_offset; a credential straddling a page boundary is redacted;bad_format,bad_offsetandbad_refrefusals; a stale ref returnsref_stale; a refused URL refusesreadlikesnapshot; the digest is stable for the same page and changes with it; a forged end fence or hand-back line stays inside the fence; the header and content fit the shim's 20,000 cap.website/src/test/snapshotWalker.read.test.ts(the real walker source in happy-dom): text below the fold (viewport reads stubbed so a viewport reader would stop); shadow-root and direct shadow text; hidden roots and hidden frames give nothing; the HTML scrub (typed values, secret meta and attributes, URL parameters, template content, comments); the live DOM is unchanged.test/test_browser_guard_isolated_count.py: its source pins now match the newscanFrames(signature and stop before thereadsection.Manual verification
The walker's
readwas run in real headless Chromium (Playwright's headless shell) on a page with an open shadow root, a direct shadow text node, a same-origin iframe, a hidden iframe, a hidden script and a textarea.textreturned the light, shadow and frame text once each and nothing from the hidden parts;htmlreported 2 skipped frames and no shadow text. An end-to-end run of the op through a live gateway is not done yet.Screenshots / video
Why no screenshot: the only file under
website/is a unit test; the op has no UI and changes nothing the dashboard renders.Related Issues
Closes #35742
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement
Contributions are accepted under the project's Apache-2.0 license; see the Licensing section of CONTRIBUTING.md.