Skip to content

feat(browser): report what a click, type or select changed - #37245

Merged
javenciu merged 1 commit into
mainfrom
feat/browser-change-report
Nov 15, 2026
Merged

javenciu merged 1 commit into
mainfrom
feat/browser-change-report

Conversation

@javenciu

@javenciu javenciu commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: A click, type or select_option tells the agent what the page did, so it does not need a snapshot after every step to find out.

With the new browser.report_changes setting on (default off), the three ops read the page before and after the action and add a changes report to their answer: the new address (without query, fragment or path parameters) and title, a dialog that opened or closed, new alert or status text, the fields that failed validation (named, never quoted), and the controls that appeared or went away. A JavaScript dialog the step opened (#37101) is reported as js_dialog.

Page text is read as the page shows it and redacted before it is cut. Inline pieces join with no space, so a token split across <code> elements reads whole; a space goes only where the page holds white space, a block starts or a line breaks. The walker never cuts text: a name past 240 characters or a message past 640 (four times the display caps) is left out whole, and a message left out reads a message too long to show. The gateway then removes credentials and exfiltration links, then cuts for display to 60 or 160 characters. A string past 2,000 characters is left out; an address too long to read reads an address too long to show. A JavaScript dialog's message is read uncut, so it too is redacted before any cut. Undrawn text (display: none, visibility: hidden or collapse) adds nothing. Text holding a token once its white space is removed is left out (a message that could not be shown): a prefixed rule (ghp_, eyJ...) or any token format the structured detectors know (a Google API key among them) finds it, read from each known prefix to each word end. A name built from aria-labelledby elements is read whole or not at all (more than four ids, a piece inside a field or too long: no name).

What is never read: any text inside a field, any alert, dialog or control inside one, and their attributes (aria-label, title, alt, placeholder). One test, fieldish, decides what a field is (native input, textarea or select, an editable region, an input role, or a shadow host holding one). A secret field is left out whole from the controls and the invalid list. A validation message is not read at all, since it can repeat what was typed in any form.

Why it matters

Each extra snapshot is a turn. On a page with 91 controls, a click that raised an error banner reports 29 characters; the outline it replaces is 2,733.

Not a goal

  • Frames and shadow roots are not compared; a shadow tree past four hosts, or 2,400 elements, counts as a field.
  • State changes of a control that stays (checked, disabled, expanded) are not reported.
  • hover, press_key, scroll, drag and reflex are not changed. No new refusal, no new argument.

What changed

  • snapshot_walker.js: a glance method returns the address, title, one role|name key per visible control, dialogs, alert and status text, and invalid fields, native or custom (any element marked aria-invalid that passes the field test). It adds no regular expression.
  • change_report.py (new): folds two reads into the report; one line per text, redacted through redact_via_context, then cut. Lists keep 8 entries. The address goes through recording.clean_url. A list the walker cut short reads not compared.
  • ops.py, budgets.py, dashboard/handlers/browser_ops.py: OpContext.report_changes and the wiring in run_op. The page is read only when the action runs, within bounds (4 s before, 8 s after). A page that cannot be read leaves the action's result in place with a warning. The route budget grows 12 s only while the setting is on.
  • security_posture_sinks_gateway.py: the report is a listed redaction sink.
  • config/sections_browser.py, config-baseline.json, docs and the web-browse skill: the setting, default off.

Backwards compatibility

Off by default. With the setting off no helper is called that was not called before, no key is added to a result and the route budgets are unchanged (test_off_the_result_and_the_helper_calls_are_what_they_were, test_the_route_budget_counts_the_report_only_while_it_is_on). With it on, click, type and select_option gain a changes key (or a warning) and nothing else.

Tests

  • Before: on main 2304233aef, 25 of the new tests fail (no report_changes, no glance).
  • Review rounds, each pinned by tests that fail on the earlier head: R1 a cut list read as unchanged, ::1 brackets; R2 ;jsessionid=, secret fields in the invalid scan; R3-R4 a field's value through an alert, label, heading or message; R5 synthetic_credentials; R6 cut before redaction, no regex; R7 a token split across inline elements; R8 a fixture; R9 a dialog message cut before redaction; R10 undrawn text inside a token.
    • R11: a chip's aria-label inside a secret editor, a name cut at the fourth of five ids, a split Google API key (36 vitest and 10 pytest cases fail on d6a0a4afdc5d).
  • After: test_browser_change_report.py with the security-posture, import-budget, walker-world, browser-config and harness-ops suites: 386 passed. The 8 snapshotWalker.*.test.ts files: 731 passed. Lint, type, black, comment-history, sync-I/O and ratchet gates pass, and eslint and tsc in website/.
  • Reproduce: python -m pytest test/test_browser_change_report.py -n0 and, in website/, npx vitest run src/test/snapshotWalker.glanceFields.test.ts
  • Proof: PROVEN test/test_browser_change_report.py::test_dialog_alert_validation_and_controls_that_changed test/test_browser_change_report.py::test_a_value_longer_than_the_input_cap_is_left_out_not_cut test/test_browser_change_report.py::test_a_token_split_by_white_space_is_left_out test/test_browser_change_report.py::test_a_split_google_api_key_is_left_out test/test_security_posture.py::TestOmissionDetection::test_every_redactor_call_site_is_a_registered_sink_or_allowlisted website/src/test/snapshotWalker.glanceFields.test.ts (head 448370f)

Manual verification

Ran the walker in headless Chromium around each action: a click that raised an alert and a <dialog> reads both and the new controls; an invalid field reads as its name only; no field value, password or token appears. Split-token layouts read whole or are left out: nine inline layouts leaked on fd7c797f4e29, three undrawn-text splits on cc41cc2506d0, and nine of eleven round-11 layouts (chips and dialogs inside fields, five-id names, split Google-format keys) on d6a0a4afdc5d; none leak now. On 91 controls glance took 3.3 ms against 7.5 ms for snapshot. Not exercised: the full gateway path with a live agent session.

Settings › Advanced, off by default:

Light
Dark

Sibling sweep

Sibling: src/kiro_crew/browser_harness/reflex.py -- not affected -- calls the op handlers directly
Sibling: src/kiro_crew/browser_harness/decide.py -- not affected -- verify hint unchanged
Sibling: src/kiro_crew/browser_harness/recording.py -- reused -- clean_url scrubs the address

Pattern harvest

Rule candidate: review-prompt
Pattern: an op that adds page text to its answer needs a bound, one-line cleaning and the shared redaction at a sink.

Related Issues

None filed.

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

Contribution License Agreement

@javenciu
javenciu requested review from a team and KiroCrewCaptain as code owners November 14, 2026 15:16
@javenciu
javenciu requested a review from buluoray November 14, 2026 15:16
@javenciu
javenciu enabled auto-merge (squash) November 14, 2026 15:16
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Nov 14, 2026
@github-actions

github-actions Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ✅ PASS

UX-level review of 448370f05599f50ab8fba7eef2e017597286bda0 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

UX-Verdict: PASS

Nothing blocks. The one visible addition is the browser.report_changes toggle. Both screenshots show it, and the blind reader correctly read it as an off switch that turns on reporting after each action, and said they would use it.

Notes

  • In the report_changes help text, delete "Off by default." The row's "Default: Disabled" already says it, and the reader flagged the "Off" vs "Disabled" mismatch.
  • The help text runs to five sentences in one paragraph. Keep the first sentence, which lists what gets reported, and the cost line ("Each step takes a fraction of a second longer"). Move the note about frames into the docs.

[UX-REVIEWED] 448370f

Description read

[DESCRIPTION-READ] 75a105e7f0c5424f00c39b7f94081abbe2104d2beb362e0babaf9c042e716a47

That sha256 names everything this verdict read: the PR description, plus the 5 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 .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

Design-level review of 448370f05599f50ab8fba7eef2e017597286bda0 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

Design-Verdict: PASS

Nothing blocks: the setting is opt-in, takes nothing away, and is easy to revert. Rendered evidence of the setting is attached.

Notes

  • Each review round added another split-token detector to change_report.clean: inline joins, undrawn text, then Google-format prefixes. That is a spelling chase on page text. If another layout gets past it, consider dropping whatever text fails to read whole, rather than adding a fourth detector.
  • GATEWAY_FAST_WORST_S now includes + CHANGE_REPORT_S even when the setting is off. Check that every reader of that worst-case constant treats it as a ceiling, not as an expected latency.

[DESIGN-REVIEWED] 448370f

Description read

[DESCRIPTION-READ] 59a0f865abd145cb6d99c7ce21e13d54c9f2688cc743577edcce13f6640989fd

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 .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of 448370f05599f50ab8fba7eef2e017597286bda0 — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

First-Principles-Verdict: PASS

Nothing blocks: the feature is opt-in (default off), each new piece of surface has an in-tree consumer, and no existing mechanism produces a deterministic before/after report.

Inventory (10 items) — 9 justified

Intent: let the agent learn what a click, type or select did without spending a snapshot turn after each step. This is an ADDITION.

  1. New Settings › Advanced toggle "Report what a step changed" (browser.report_changes), off by default — justified
  2. With the toggle on, click, type and select_option answers carry a changes report (address, title, dialogs, alert/status text, invalid field names, controls added or removed) — justified
  3. A page that cannot be read around the action adds a warning instead of a report; the action's result stands — justified
  4. A JavaScript dialog opened by the step is reported as js_dialog, with the message redacted before it is cut — justified
  5. The route budget for those three ops grows 12 s only while the toggle is on — justified
  6. The shim's fast-op client timeout (SHIM_FAST_TIMEOUT_S through GATEWAY_FAST_WORST_S) grows 12 s for everyone, toggle off included — undeclared: the description says "route budgets are unchanged"
  7. New walker glance read (controls, dialogs, alerts, invalid fields, never field text) — justified
  8. The change report is registered as a redaction sink in security_posture_sinks_gateway.py — justified
  9. web-browse skill, browser-control.md and configuration.md describe the setting — justified
  10. The config-baseline.json row for the new key — justified

[FIRST-PRINCIPLES-REVIEWED] 448370f

Description read

[DESCRIPTION-READ] 9d28d6d98fe235fed972b2507a45c88bf420f3e19445183aebefbabfba7f4a2c

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@github-actions

github-actions Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed 448370f05599f50ab8fba7eef2e017597286bda0 — this comment is updated in place on each push.

Review details

No findings.

Notes:

  • docs/system-specs/modules/browser.md:1082 still gives the route budget as 20 s / 75 s plus 12 s. It does not mention the extra CHANGE_REPORT_S (12 s) that _op_budget now adds for click, type and select_option when browser.report_changes is on, and it does not describe the glance walker method.
  • configuration.md says every browser.* key is edited on Settings → Browser, but that panel has no toggle for browser.report_changes. It has none for the browser.recording.* keys either, so this wording was already inaccurate before this PR.

[OPUS-REVIEWED] 448370f

Verdict parsed from the review's SHA-scoped output markers for commit 448370f05599f50ab8fba7eef2e017597286bda0.

False positive or not applicable? A repository writer can comment:
/ai-review override fable 448370f05599f50ab8fba7eef2e017597286bda0 false-positive: <reason, 20 to 500 characters>

@github-actions

github-actions Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of 448370f05599f50ab8fba7eef2e017597286bda0 and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 448370f

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 448370f05599f50ab8fba7eef2e017597286bda0 false-positive: <reason, 20 to 500 characters>

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Nov 14, 2026
@javenciu
javenciu force-pushed the feat/browser-change-report branch from ecf45a3 to 558495c Compare November 14, 2026 17:31
@javenciu

Copy link
Copy Markdown
Contributor Author

Thanks for the review. Both blocking findings are fixed in 558495c28fb5, and the design note is taken too.

snapshot_walker.js:1137, a list cut short hides a new message. glance now returns capped, which names each of the dialog, message and invalid-field lists that stopped before the page did (10 entries per list, and the field scan at 600 fields). change_report.diff reports such a list as not compared: the page has more ... than the report reads when either read was cut, the same way controls already were, and keeps comparing the other lists. In headless Chromium, a page with ten role=status messages and a click that appends Card declined now gives {"alerts": "not compared: the page has more alert and status messages than the report reads"}; the earlier head gave {"no_change_seen": true}. test_a_list_the_walker_cut_short_is_said_to_be_uncompared (each list, cut before or after) and test_a_cut_list_leaves_the_other_lists_compared fail on ecf45a3e2e1e and pass now. test_a_malformed_cut_marker_is_ignored pins that a census without a well-formed capped is compared as before.

change_report.py:77, IPv6 brackets. shown_url puts the brackets back around an IPv6 host, so http://user:pw@[::1]:5173/thanks?t=1 is shown as http://[::1]:5173/thanks. test_an_ipv6_address_keeps_its_brackets fails on ecf45a3e2e1e ('http://::1:5173/thanks') and passes now.

Design note, the read before a hook that does not run the action. The page is now read right before the handler, inside the path the decision hook calls, so a hook that answers by itself, or a target with no hook to pick it, costs no read. test_the_page_is_read_only_when_the_action_runs[False] and test_a_target_with_no_hook_to_pick_it_reads_nothing fail on ecf45a3e2e1e and pass now; the [True] case shows the report is unchanged when the action runs.

@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Nov 14, 2026
@KiroCrewCaptain

KiroCrewCaptain commented Nov 14, 2026 •

Copy link
Copy Markdown
Collaborator

Code change approver recommendation: A person should decide

Why: the decider thinks the change is probably fine but estimates a 22% chance that this change introduces a defect, above the 12% limit for approving on its own.

The opt-in browser.report_changes setting adds a changes report to click, type and select_option. With the setting off, run_op makes no new helper calls, adds no result keys and keeps the route budget unchanged; tests pin all three. With it on, the page is read only when the action actually runs. A slow or unreadable page leaves the action's result in place with a warning, a refused page address is still refused, and the reads are bounded so they fit inside the larger route budget. glance runs in the isolated world, and text inside or about fields is excluded. Every string is redacted before it is cut, and the tool layer redacts the whole result again before the agent sees it. The setting is read fresh for each op, the config and baseline are updated, and replay recording ignores the new keys. The finding the GPT review raised on the earlier head (a chip inside a secret editor) is fixed by skipping anything inside a field before its name is read. Nothing blocks; the remaining items are claim drift and a redaction gap shared with snapshot.

An automated recommendation, not a review: a maintainer still decides. It approves on its own only when the estimated chance of a defect is at most 12% and the change has at most 400 changed lines. Decider v3c (217fe607) · commit 448370f055 · 2144 changed lines. If this recommendation is wrong, reply here: replies are how the approver is evaluated.

@javenciu
javenciu force-pushed the feat/browser-change-report branch from 558495c to d9b4f95 Compare November 14, 2026 18:41
@javenciu

Copy link
Copy Markdown
Contributor Author

Thanks for the review. Both blocking findings are fixed in d9b4f95dc617.

First principles, the second address scrubber. shown_url is gone. change_report.diff now passes the address through browser_harness/recording.clean_url and then the same one-line clean(..., URL_CAP), so the report and the recordings share one scrubber, and ;jsessionid= path parameters are dropped along with credentials, query and fragment. A change in a path parameter alone reads (query, fragment or path parameters changed). test_the_address_is_cleaned_by_the_one_url_scrubber_the_recordings_use (https://shop.example/cart;jsessionid=.../thanks is shown as https://shop.example/cart/thanks, and change_report.clean_url is recording.clean_url) and test_a_path_parameter_only_change_is_said_to_be_one fail on 558495c28fb5 and pass now. The IPv6 test still passes through clean_url.

snapshot_walker.js:1163, a secret textarea's value through its wrapping label. The invalid-field scan now skips a secret field whole, as the controls scan already did, so a secret field is never named in invalid. The wider cause was that glance read names with textContent, which includes the text of a textarea, the options of a select and the text of an editable region inside the labelling element. Every label, aria-labelledby, aria-describedby, aria-errormessage, dialog heading and alert region is now read by one text pass that skips the whole subtree of any textarea, select, datalist or editable region inside it, so the aria-labelledby container the adjudication mentions is covered too. A button's or link's name comes from its own text the same way, not from the snapshot's accName, which falls back to a wrapping label's whole text. A custom textbox or combobox role counts as a field, so its own text (its value) is not its name. A validation message that quotes the field's value, as the browser's email message does, is replaced by the kind of problem (not in the expected format). In headless Chromium, twelve pages that put a marker value in a field inside a wrapping label, a labelledby or describedby container, a dialog heading, an alert, a custom combobox or an email message: on 558495c28fb5 11 of the 12 reads carried the value ("invalid":["API token <value>"] for the reviewer's case), and at d9b4f95dc617 none does. test_glance_leaves_a_secret_field_out_of_the_invalid_list_whole, test_glance_reads_no_name_or_message_from_inside_a_field and test_glance_never_repeats_a_value_a_validation_message_quotes fail on 558495c28fb5 and pass now.

Design note, the 12 s on the tool's HTTP timeout with the setting off. Not changed. The tool reads its timeout before it knows whether the gateway will report changes, since the setting is read fresh by the gateway for each op, so the timeout has to cover the setting being on. It only shows when the gateway does not answer.

@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Nov 14, 2026
@javenciu
javenciu force-pushed the feat/browser-change-report branch from d9b4f95 to 06e81f4 Compare November 14, 2026 21:19
@javenciu

Copy link
Copy Markdown
Contributor Author

snapshot_walker.js:1102, custom fields inside an alert (GPT, upheld). Fixed in 06e81f4 by removing the separate value-tag list rather than adding role="textbox" to it. glance now has one test of what a field is, fieldish, and both the controls scan and every text read use it: native inputs, textareas and selects, editable regions, any element whose role has a textbox, searchbox, combobox, spinbutton or slider token (custom elements included), and a host whose open shadow root holds one of those. The one text reader drops the whole subtree of each field inside an alert, label, aria-labelledby/aria-describedby/aria-errormessage target or dialog heading, and returns nothing for a node that itself sits inside a field. Alert regions no longer fall back to innerText either. No decision depends on a field's name looking secret. website/src/test/snapshotWalker.glanceFields.test.ts runs the walker against each of 12 field kinds inside each of 5 text reads, plus your trigger (<div role="alert">Your code <div role="textbox" id="otp">482913</div> was sent</div> reads Your code was sent). On d9b4f95, 42 of its 64 cases fail, the trigger among them; the native-field and plain-text cases pass on both heads. The same matrix in headless Chromium: 41 of 61 reads carried the code before, and none do now.

ops.py:1454, refused redirect swallowed by the dialog check (GPT, upheld). Fixed in 06e81f4. _open_dialog re-raises _PageRefused before its catch-all, as _glance already does, so the refusal reaches run_op. test_a_redirect_refused_while_the_report_waits_is_the_answer[True] fails on d9b4f95 with ok: true, changes: {no_change_seen: true}. It now answers redirect_refused, the same as the [False] case with the setting off.

Redaction registry (code change approver). Fixed in 06e81f4. browser_harness/change_report.py is listed in security_posture_sinks_gateway.py as the gateway sink for browser action change reports. test_every_redactor_call_site_is_a_registered_sink_or_allowlisted fails on d9b4f95 and passes now. The PR description's gate claim is now true at this head.

Design note (verify and changes both answer "what did the step do"). Not changed in this PR. verify is the decision hook's yes/no on whether the step did what the agent meant, and changes is the list of what moved on the page. The skill text tells the agent to read changes before taking a snapshot. Merging the two is a separate change to the hook.

First-principles note (off by default, cost not measured). Not changed. Measured in headless Chromium on a page with 91 controls: glance takes 3.3 ms per call, against 7.5 ms for snapshot, so a step pays two reads and the 0.3 s settle delay. The setting stays opt-in, because that delay applies to every click, type and select.

@javenciu

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: 06e81f4
  • What rule changed: security_posture_sinks_gateway.py gains one registry row, "Browser action change reports" for browser_harness/change_report.py. It records an outbound text path this PR adds; no redactor, rule or sink that exists on main changes.
  • Before -> after (what was allowed/blocked, now): before, the omission scan found a redactor call in change_report.py with no registered sink and failed. After, the call is registered as a sink, with the reason that every string the report carries (page address, title, dialog names, alert and validation text, control names) is cut to one bounded line, stripped of control characters and passed through the credential and exfiltration-URL redactor, the address after recording.clean_url.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): page text reaching the agent unredacted while browser.report_changes is on. The setting is off by default, and no field value is read at all: fieldish classifies every field kind (native fields, contenteditable, every ARIA input role, custom elements, shadow hosts) and every text read skips field subtrees.
  • Evidence checked (which sandbox result proves it): test/test_security_posture.py passes on this head, inside 271 passed across the change-report, harness-ops, walker-world and security-posture files. website/src/test/snapshotWalker.glanceFields.test.ts (64 cases, every field kind in alerts, labels, dialogs and error messages) passes; 42 of them fail on the previous head's walker.
  • No regression:
    • Tools still work (which tools/commands were run, result): the browser click, type and select ops run with the setting off and on in test/test_browser_change_report.py and test/test_browser_harness_ops.py, and both pass; a refused redirect still answers redirect_refused.
    • Backward compatible (old config / old data / old callers still work, how checked): with browser.report_changes absent or false the ops return exactly main's result, pinned by a test that passes on main.
    • Existing tests (which suites passed on this head): 271 passed in the four Python files above, 64 passed in the walker test, and the lane CI checks report CI-CHECKS PASS.
  • How to undo: revert the commit. The registry row goes with the code it describes.

@github-actions

github-actions Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Sensitive Change Review

Sensitive files changed:

  • src/kiro_crew/security_posture_sinks_gateway.py

  • @javenciu posted a complete reasoning template for 448370f.

@github-actions github-actions Bot removed the readiness: action required A blocking check or review needs attention label Nov 14, 2026
@github-actions github-actions Bot added the readiness: action required A blocking check or review needs attention label Nov 15, 2026
@javenciu
javenciu force-pushed the feat/browser-change-report branch from bc9db4d to b47dd16 Compare November 15, 2026 08:23
@javenciu

Copy link
Copy Markdown
Contributor Author

SAST (Semgrep) unknown-value-with-script-tag on snapshotWalker.glanceFields.test.ts. Fixed in b47dd16: the fixture now sets the markup first and adds the <script> element with document.createElement, so no template literal mixes an interpolated value with a script tag; the case still asserts the page text reads as the whole token, and no other test file in the diff has that shape (grep for <script over the changed files). The Backend Tests (3.12, 7) failure is the known timing flake at test_denied_commands_security_cost.py:601 and is unchanged by this round, which edits one test file.

@javenciu

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: b47dd16
  • What rule changed: security_posture_sinks_gateway.py keeps its one new registry row, "Browser action change reports", for browser_harness/change_report.py. It records an outbound text path this PR adds. The row says that each string is redacted first and cut to one line only afterwards, and that text too long to read whole is left out, never cut, in the walker and in the report. No redactor, rule or sink that already exists on main changes. On this head the walker reads page text as the page shows it: inline pieces join with no space, and a space is added only at white space the page holds, a line break or a block box in normal flow. The input-role check is a list instead of a regular expression. This head is rebased onto e9d6223a7a. This round changes one test file only (a fixture is built with createElement so no value shares a template with a script tag); no product code, rule, redactor or sink changes from the previous head.
  • Before -> after (what was allowed/blocked, now): before this PR, the omission scan found a redactor call in change_report.py with no registered sink and failed. After, the call is registered as a sink. On the previous head the walker joined every text node with a space, so a credential split across inline elements (as syntax highlighting renders it) reached the redactor with spaces inside it, no rule matched, and the pieces reached the agent. On this head such a credential reaches the redactor whole and is removed. Text in an element the page does not draw is no longer read. The redact-then-cut order and the bounds (a name past 240 characters, a message past 640, a string past 2,000 is left out) are unchanged.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): page text reaches the agent unredacted while browser.report_changes is on. The setting is off by default, and no field value is read at all. A wrong line-start guess joins two words, which costs a readable label, never a leaked one. A secret field, native or custom, is never listed.
  • Evidence checked (which sandbox result proves it): on this head (b47dd16), test/test_browser_change_report.py, test/test_security_posture.py, test/test_mcp_listing_import_budget.py, test/test_browser_walker_world.py, test/test_config_browser_section.py and test/test_browser_harness_ops.py give 353 passed. website/src/test/snapshotWalker* gives 683 passed in 8 files. With the walker from the previous head, the 9 new join cases give 7 failed and 2 passed, and 2 pytest source pins fail. In headless Chromium, nine split-token layouts each come out of change_report.clean redacted at this head (SUMMARY 0 LEAK of 11), against SUMMARY 9 LEAK of 11 on the previous head; the two cases that never held a token (blocks and line breaks, page white space) read the same on both.
  • No regression:
    • Tools still work (which tools/commands were run, result): the browser click, type and select ops run with the setting off and on in test/test_browser_change_report.py and test/test_browser_harness_ops.py, and both pass. The MCP tool listing loads no more modules than main's ceiling allows (test_mcp_listing_import_budget.py passes).
    • Backward compatible (old config / old data / old callers still work, how checked): with browser.report_changes absent or false, the ops return exactly what main returns. A test that passes on main pins this.
    • Existing tests (which suites passed on this head): the 353 and 683 above, the docs lint ("All documentation checks passed") and 157 doc tests after the docs line was added. The lane CI checks report CI-CHECKS PASS. The wider 86-file sweep was last run on the round-6 build and not re-run.
  • How to undo: revert the commit. The registry row goes with the code it describes.

@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Nov 15, 2026
@javenciu
javenciu force-pushed the feat/browser-change-report branch from b47dd16 to cc41cc2 Compare November 15, 2026 09:49
@javenciu

Copy link
Copy Markdown
Contributor Author

JavaScript dialog messages are truncated before redaction (ops.py:1459). Fixed in cc41cc2. The change report no longer reads the dialog through _dialog_view, which cuts the message at 1,000 characters for the dialog op and the dialog_open refusal. A new _page_dialog returns the dialog as the page wrote it, uncut, and _glance passes that to change_report.dialog_report, where clean redacts the whole message, leaves it out when it is past 2,000 characters, and only then cuts it for display. _open_dialog now calls _page_dialog and returns _dialog_view of it, so the dialog op and dialog_open give exactly what they gave before (test_the_dialog_op_still_shows_the_capped_message). test_a_dialog_message_is_redacted_before_any_cut (980 spaces and a 40-character token) and test_a_dialog_message_too_long_to_read_whole_is_left_out fail on b47dd16 and pass now. I also checked every other value the report takes: the walker's glance never cuts text (clip and ownText return nothing past their cap), census caps list lengths, not strings, and the address goes through clean_url, whose only cut is at 2,048 characters, above the 2,000 at which clean leaves a string out, so a cut address reads an address too long to show (test_an_address_too_long_to_read_is_said_to_be_new). The sink row in security_posture_sinks_gateway.py now names the dialog message.

@javenciu

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: cc41cc2
  • What rule changed: security_posture_sinks_gateway.py keeps its one new registry row, "Browser action change reports", for browser_harness/change_report.py. It records an outbound text path this PR adds. The row says that each string is redacted first and cut to one line only afterwards, and that text too long to read whole is left out, never cut, in the walker and in the report. This round adds the message of a JavaScript dialog to the row's list of what the report carries, and says it is read uncut. No redactor, rule or sink that already exists on main changes. This head is rebased onto 2e56b3b672.
  • Before -> after (what was allowed/blocked, now): before this PR, the omission scan found a redactor call in change_report.py with no registered sink and failed. After, the call is registered as a sink. On the previous head the change report read a JavaScript dialog through _dialog_view, which cuts the message at 1,000 characters, so a credential that straddled that point reached the redactor as a fragment no rule matched, and that fragment reached the agent. On this head the report reads the dialog uncut through _page_dialog: the whole message is redacted, a message past 2,000 characters is left out, and only then is it cut for display. The dialog op and the dialog_open refusal still show _dialog_view's capped message, unchanged from main.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): page text reaches the agent unredacted while browser.report_changes is on. The setting is off by default, and no field value is read at all. A secret field, native or custom, is never listed.
  • Evidence checked (which sandbox result proves it): on this head (cc41cc2), test/test_browser_change_report.py, test/test_security_posture.py, test/test_mcp_listing_import_budget.py, test/test_browser_walker_world.py, test/test_config_browser_section.py and test/test_browser_harness_ops.py give 356 passed; test/test_browser_harness_helper_worker_cov.py gives 23 passed; test/test_security_posture_facade.py and test/test_crew_mode_trust_posture.py give 16 passed. website/src/test/snapshotWalker* gives 683 passed in 8 files. With the previous head's ops.py and change_report.py, test_a_dialog_message_is_redacted_before_any_cut fails (a 6-character piece of the token is in the report) and test_a_dialog_message_too_long_to_read_whole_is_left_out fails.
  • No regression:
    • Tools still work (which tools/commands were run, result): the browser click, type, select and dialog ops run with the setting off and on in test/test_browser_change_report.py and test/test_browser_harness_ops.py, and both pass. The MCP tool listing loads no more modules than main's ceiling allows (test_mcp_listing_import_budget.py passes).
    • Backward compatible (old config / old data / old callers still work, how checked): with browser.report_changes absent or false, the ops return exactly what main returns. A test that passes on main pins this. test_the_dialog_op_still_shows_the_capped_message pins the dialog op's 1,000-character view.
    • Existing tests (which suites passed on this head): the counts above. The lane CI checks report CI-CHECKS PASS. The wider 86-file sweep was last run on the round-6 build and not re-run.
  • How to undo: revert the commit. The registry row goes with the code it describes.

@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Nov 15, 2026
@javenciu
javenciu force-pushed the feat/browser-change-report branch from cc41cc2 to d6a0a4a Compare November 15, 2026 10:53
@javenciu

Copy link
Copy Markdown
Contributor Author

Invisible descendant text breaks credential redaction (snapshot_walker.js:1208). Fixed in d6a0a4a, both the trigger and the class.

The walker's ownText now skips text the page does not draw. An element whose computed visibility is hidden or collapse adds no text and no separator, the same as display: none. Because visibility is inherited, a visibility: visible child of a hidden element is still read, as the page draws it. The vitest cases text the page does not draw inside a token adds nothing and a drawn child of an undrawn element is read fail on cc41cc2 and pass now. In headless Chromium, the reported layout (an absolutely positioned visibility: hidden span holding white space and a letter), a collapse span and a hidden block leaked on cc41cc2 and read as [REDACTED: credential] now.

To close the class, change_report.clean also reads the redacted line with every white-space run removed. If a prefixed token rule finds a token there, the whole text is left out, and an alert left out reads a message that could not be shown. The prefixed rules are those for ghp_, xoxb-, glpat-, sk_live_, SG., sk-proj-, sk-ant-, npm_, pypi-, dop_v1_, GOCSPX- and eyJ. The query token= rule and the digits-and-colon rule are left out of this check, because on the repo's 268,117 Markdown lines they match ordinary prose once it is run together (11 and 2 lines). The prefixed rules match none of those lines. test_a_token_split_by_white_space_is_left_out (a space, a newline, a tab run and Unicode spaces, alone and after a whole token) and test_an_alert_left_out_is_said_to_be_there fail on cc41cc2. test_ordinary_sentences_pass_the_white_space_check and test_a_whole_token_is_redacted_not_left_out pin that ordinary text and a whole token are handled as before.

@javenciu

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: d6a0a4a
  • What rule changed: security_posture_sinks_gateway.py keeps its one new registry row, "Browser action change reports", for browser_harness/change_report.py. It records an outbound text path this PR adds. This round the row also says that text the page does not draw is not read, and that text holding a prefixed token once its white space is removed is left out. No redactor, rule or sink that already exists on main changes. change_report.clean now calls the existing security.redaction.redact_credentials_with_records once more, read-only, on the redacted line with its white space removed. This head is rebased onto c970398865.
  • Before -> after (what was allowed/blocked, now): before this PR, the omission scan found a redactor call in change_report.py with no registered sink and failed. After, the call is registered as a sink. On the previous head the walker read text inside a visibility: hidden (or collapse) element, so an invisible span holding white space and a letter split a token the page draws whole, and the pieces reached the agent unredacted. On this head the walker skips text the page does not draw, and adds no separator for it, while a visibility: visible child of a hidden element is still read, as CSS draws it. Independently, clean reads the redacted line again with every white-space run removed. If one of the prefixed token rules (slack_token, github_token, gitlab_token, stripe_key, sendgrid_key, openai_key, anthropic_key, npm_token, pypi_token, digitalocean_token, google_oauth_secret, jwt) finds a token there, the whole text is left out, and an alert left out reads a message that could not be shown. The other rules are not used for this check: on the repo's 268,117 Markdown lines, token_parameter (11 lines) and telegram_bot_token (2 lines) match prose run together, and the prefixed rules match none.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): page text reaches the agent unredacted while browser.report_changes is on, or an ordinary alert is left out of the report. The setting is off by default, and no field value is read at all. A secret field, native or custom, is never listed.
  • Evidence checked (which sandbox result proves it): on this head (d6a0a4a), test/test_browser_change_report.py, test/test_security_posture.py, test/test_mcp_listing_import_budget.py, test/test_browser_walker_world.py, test/test_config_browser_section.py and test/test_browser_harness_ops.py give 371 passed. Adding test/test_browser_harness_helper_worker_cov.py and test/test_security_posture_facade.py gives 408 passed. website/src/test/snapshotWalker* gives 685 passed in 8 files. With the previous head's change_report.py and snapshot_walker.js, 10 tests in test/test_browser_change_report.py fail: 8 cases of test_a_token_split_by_white_space_is_left_out, test_an_alert_left_out_is_said_to_be_there and the walker source pin. On the previous walker, 2 vitest cases fail. A headless Chromium probe, with each entry put through clean, gives 3 LEAK of 15 for the previous walker and the previous clean. It gives 0 of 15 for the new walker, for the new clean, and for both together.
  • No regression:
    • Tools still work (which tools/commands were run, result): the browser click, type, select and dialog ops run with the setting off and on in test/test_browser_change_report.py and test/test_browser_harness_ops.py, and both pass. The MCP tool listing loads no more modules than main's ceiling allows (test_mcp_listing_import_budget.py passes; the new import is inside the function).
    • Backward compatible (old config / old data / old callers still work, how checked): with browser.report_changes absent or false, the ops return exactly what main returns. A test that passes on main pins this. Ordinary sentences pass the white-space check unchanged (test_ordinary_sentences_pass_the_white_space_check), and a whole token is still redacted in place rather than left out (test_a_whole_token_is_redacted_not_left_out).
    • Existing tests (which suites passed on this head): the counts above. The lane CI checks report CI-CHECKS PASS. The wider 86-file sweep was last run on the round-6 build and was not re-run.
  • How to undo: revert the commit. The registry row goes with the code it describes.

A click, type or select_option answers with the point it hit and nothing
about what the page did, so the agent reads the page again after each step to
learn whether a dialog opened, an error appeared or the page moved.

With the new browser.report_changes setting on (off by default), those three
ops read the page cheaply before and after the action and add a changes
report: the new address and title, dialogs that opened or closed, new alert
and validation text, and the controls that appeared or went away. A
JavaScript dialog the step opened is reported without reading the page it
holds. Page text is cut to bounded redacted lines, a field is named by its
label and never by its value, and a page that cannot be read leaves the
step's own result with a warning.
@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Nov 15, 2026
@javenciu
javenciu force-pushed the feat/browser-change-report branch from d6a0a4a to 448370f Compare November 15, 2026 13:30
@javenciu

Copy link
Copy Markdown
Contributor Author

Field descendants bypass the secret-field exclusion (snapshot_walker.js:1260). Fixed in 448370f, for the whole class. A new inField asks the one field test of an element and every element it sits in, and it runs before any name is read. A control, a dialog or an invalid field inside a field is left out of the glance, with its text and its attributes (aria-label, title, alt, placeholder, value), and an aria-labelledby piece inside a field is never read. The page around the field is still read. The vitest table glance reads no name from an element inside a field puts eight kinds of element (a chip with an aria-label or a title, an image button, a button, a labelled link, a dialog, two invalid fields) in five kinds of field (a secret role="textbox" editor, a secret and a plain editable region, a combobox, a shadow host). 30 of those cases fail on d6a0a4a, and so does the elements of a field are left out of the lists, and the page around it is read. In headless Chromium, your trigger and five similar layouts leaked on d6a0a4a; none do now.

The ID limit returns partial names before redaction (snapshot_walker.js:1229). Fixed in 448370f. A name built from aria-labelledby elements is now read whole or not at all. idsText returns no name when the list names more than four ids (GLANCE_ID_CAP), or when any piece is inside a field or too long to read whole. The control then falls back to its other names, as it does for a name that is too long. An id with no element still adds nothing, as on the page. a token split between the fourth and the fifth of five labels is left out whole, a name with a label too long to read whole is left out, not read in part, a name with a label inside a field is left out, not read in part, a dialog named by too many labels falls back to its heading and a list of more than four ids names nothing fail on d6a0a4a. four labels are read whole passes on both heads.

Split Google API keys bypass the compacted-token check (change_report.py:98). Fixed in 448370f, for every fixed-prefix format. Besides the prefixed pass-1 rules, clean now asks the structured detectors on the text as read, with its white space removed. The prefixes come from the detectors' own table (ROWS, secret-tier token_format rows), so a format added there counts here too. The detectors read from each such prefix to each word end within 300 characters, so the words around a token do not hide its edges. The text is left out when a hit counts by its detector (token_format, secret tier) and covers removed white space. The check is also run on the text before redaction, so a token whose first piece was redacted on its own cannot leave its tail behind. test_a_split_google_api_key_is_left_out fails on d6a0a4a. So do 6 cases of test_every_secret_token_format_split_by_white_space_is_left_out, which builds a token for each secret format row at run time (Google API key, fine-grained GitHub token, Anthropic key, Shopify token, Stripe webhook secret, Vault token), split after a colon and in prose. On the repo's 268,226 Markdown lines this check leaves out one line, a list of token prefixes. A line that would need more than 64 reads is left out, so a hostile line costs at most 64 detector reads.

@javenciu

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: 448370f
  • What rule changed: security_posture_sinks_gateway.py keeps its one new registry row, "Browser action change reports", for browser_harness/change_report.py. It records an outbound text path this PR adds. This round the row also says that text holding a token once its white space is removed is left out whether a prefixed rule or any token format the credential detectors know finds it, that nothing inside a field names anything, and that a name built from several elements is read whole or not at all. No redactor, rule or sink that already exists on main changes. change_report.clean now also reads the existing structured detectors (security.redaction_structured.ROWS for the secret token formats' prefixes, and redact_hits), read-only. This head is rebased onto dc4692c96f.
  • Before -> after (what was allowed/blocked, now): before this PR, the omission scan found a redactor call in change_report.py with no registered sink and failed. After, the call is registered as a sink. On the previous head (1) an element inside a field, such as a chip inside a secret role="textbox" editor, was scanned as its own control, and its aria-label, title, alt or placeholder reached the agent, which carried the one-time code; (2) idsText read at most four aria-labelledby ids and returned the part it had read, so a token split between the fourth and fifth label arrived cut; (3) the white-space check counted only matches whose record named a prefixed pass-1 rule, and a Google API key's record names credential_pattern, so a split key went out whole. On this head (1) a control, dialog or invalid field that sits inside a field is left out before any name is read, and an aria-labelledby piece inside a field is not read; (2) a list of more than four ids, or one with a piece inside a field or too long to read whole, gives no name, and the control falls back to its other names as before; (3) clean also runs the structured detectors on the text as read, run together, from each prefix of a secret token_format row to each word end within 300 characters, and leaves the text out when a secret token_format hit covers removed white space. A line that needs more than 64 such reads is left out. A hit that covers no removed white space is a whole token, which the redaction already replaced.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): page text reaches the agent unredacted while browser.report_changes is on, or an ordinary alert, control name or dialog name is left out of the report. The setting is off by default, and no field value is read at all. A secret field, native or custom, is never listed. On the repo's 268,226 Markdown lines the new format check leaves out 1 line (a line that lists token prefixes), and it reads all of them in 1.38 s.
  • Evidence checked (which sandbox result proves it): on this head (448370f), test/test_browser_change_report.py, test/test_browser_harness_ops.py and test/test_security_posture.py give 294 passed. With test/test_mcp_listing_import_budget.py, test/test_browser_walker_world.py and test/test_config_browser_section.py added, 386 passed; with test/test_browser_harness_helper_worker_cov.py and test/test_security_posture_facade.py added as well, 423 passed. website/src/test/snapshotWalker* gives 731 passed in 8 files. With the previous head's change_report.py and snapshot_walker.js, 10 tests in test/test_browser_change_report.py fail (the split Google key, 6 secret token formats, and 3 walker source pins) and 36 vitest cases fail (30 element-inside-a-field cases, the page-around-a-field case, four whole-or-nothing name cases, and the id-limit case). A headless Chromium probe of 11 layouts, with each entry put through clean, gives 9 LEAK of 11 for the previous walker and the previous clean, 7 for the previous walker with the new clean, 2 for the new walker with the previous clean, and 0 for both new.
  • No regression:
    • Tools still work (which tools/commands were run, result): the browser click, type, select and dialog ops run with the setting off and on in test/test_browser_change_report.py and test/test_browser_harness_ops.py, and both pass. The MCP tool listing loads no more modules than main's ceiling allows (test_mcp_listing_import_budget.py passes; the new imports are inside the functions).
    • Backward compatible (old config / old data / old callers still work, how checked): with browser.report_changes absent or false, the ops return exactly what main returns. A test that passes on main pins this. Ordinary sentences pass the white-space check unchanged (test_ordinary_sentences_pass_the_white_space_check), a whole token is still redacted in place rather than left out (test_a_whole_token_is_redacted_not_left_out), four labels are still read whole, and the page around a field is still read.
    • Existing tests (which suites passed on this head): the counts above. The lane CI checks report CI-CHECKS PASS. The wider 86-file sweep was last run on the round-6 build and was not re-run.
  • How to undo: revert the commit. The registry row goes with the code it describes.

@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: passed Eligible automated validation passed for the current revision and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Nov 15, 2026

@KiroCrewCaptain KiroCrewCaptain left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We reviewed this at head 448370f. Every new page read runs inside the existing decision gate, after the URL refusal check, and uses the isolated-world walker. A refused redirect during the wait becomes the op's answer. Any other read failure becomes a warning, so the action's own result is never lost. With the setting off, the result and the helper calls stay byte-identical, which test_off_the_result_and_the_helper_calls_are_what_they_were pins. The route budget grows only for click, type and select_option, and only while the setting is on. The tests are deterministic: they use injected fake sleeps, have no wall-clock barriers, and keep all state under tmp_path.

Done well: the bounds are layered (a per-read bound inside the before and after bounds, matched to _op_budget). The redaction tests are built from the redaction format table at run time, so a format added later is covered automatically.

Security: the feature only adds output. It reads no field values or validation messages. Page text is redacted before any cut, and a string that is too long is left out whole rather than cut. The changes key goes through the same tool-text redaction as snapshot output, and a test pins that. No gate allows anything that main refuses.

Optional:

  • The Backwards compatibility section could say that the shim's fast-op timeout (SHIM_FAST_TIMEOUT_S, budgets.py:111) now grows 12 s for every user, setting on or off. Only the route budget is unchanged when the setting is off.
  • No test covers the walker setting capped or truncated (snapshot_walker.js around :1274 to :1317). A vitest case with 11 alerts, dialogs or invalid fields, or more than the scan cap, would pin the walker half of the "never reported as unchanged" promise.
  • A follow-up could add the glance read, the changes shape and the new budget term to docs/system-specs/modules/browser.md. It could also move the change-report wiring out of ops.py, which is now past 1,600 lines, into a sibling module.

@javenciu
javenciu merged commit 25bb043 into main Nov 15, 2026
100 checks passed
@javenciu
javenciu deleted the feat/browser-change-report branch November 15, 2026 14:55
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Nov 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants