actor: Refactor browser-side setup for script tools/webmcp [chromium/src : main]

0 views
Skip to first unread message

AI Code Reviewer (Gerrit)

unread,
Jan 21, 2026, 9:53:16 PMJan 21
to Khushal Sagar, chromium...@chromium.org, blink-re...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org, ipc-securi...@chromium.org, mfoltz+wa...@chromium.org

AI Code Reviewer added 2 comments

File third_party/blink/renderer/core/html/forms/html_form_element.h
Line 257, Patchset 1 (Latest): base::OnceCallback<void(
AI Code Reviewer . unresolved

Blink Style Guide: Dependencies. `core/` should not depend on `public/web`. `WebDocument` is in `public/web`. Using `WebDocument::ScriptToolError` here introduces a forbidden dependency from `core` to `public/web`.

To keep this interaction as brief and non-intrusive as possible, please consider responding with one of following options:
**Done** | **OK But Won't Fix**: reason | **Later**: b/<bug_id> | **Invalid:** reason


_This comment was generated by [Experimental Blink C++ Code Review Agent](http://go/blink-c++-code-review-agent)._
_AI reviews can sometimes be inaccurate; We appreciate your 🙏 feedback 🙏 to help us improve._
_[File a bug](http://go/blink-c++-code-review-agent-feedback) | [Provide feedback on chat](https://chat.google.com/room/AAQA0zhQHe0?cls=4) | [Opt-out](https://ganpati2.corp.google.com/group/peep-genai-blink-agent-optout.prod)_

File third_party/blink/renderer/core/script_tools/model_context.h
Line 30, Patchset 1 (Latest): base::OnceCallback<
AI Code Reviewer . unresolved

Blink Style Guide: Dependencies. `core/` should not depend on `public/web`. `WebDocument` is in `public/web`. To avoid circular dependencies and layering violations, define the error type in `core` (e.g., `ModelContext::ScriptToolError`) and map it to the public API type in the `WebDocument` implementation.

To keep this interaction as brief and non-intrusive as possible, please consider responding with one of following options:
**Done** | **OK But Won't Fix**: reason | **Later**: b/<bug_id> | **Invalid:** reason


_This comment was generated by [Experimental Blink C++ Code Review Agent](http://go/blink-c++-code-review-agent)._
_AI reviews can sometimes be inaccurate; We appreciate your 🙏 feedback 🙏 to help us improve._
_[File a bug](http://go/blink-c++-code-review-agent-feedback) | [Provide feedback on chat](https://chat.google.com/room/AAQA0zhQHe0?cls=4) | [Opt-out](https://ganpati2.corp.google.com/group/peep-genai-blink-agent-optout.prod)_

Open in Gerrit

Related details

Attention set is empty
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Iee75d9d434cfd52a39fce1890343699ca02ad951
Gerrit-Change-Number: 7509063
Gerrit-PatchSet: 1
Gerrit-Owner: Khushal Sagar <khusha...@chromium.org>
Gerrit-CC: AI Code Reviewer <peep-gen...@system.gserviceaccount.com>
Gerrit-Comment-Date: Thu, 22 Jan 2026 02:53:13 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Khushal Sagar (Gerrit)

unread,
Jan 21, 2026, 9:54:17 PMJan 21
to David Bokan, Ben Greenstein, AI Code Reviewer, chromium...@chromium.org, blink-re...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org, ipc-securi...@chromium.org, mfoltz+wa...@chromium.org
Attention needed from Ben Greenstein and David Bokan

Khushal Sagar voted Commit-Queue+1

Commit-Queue+1
Open in Gerrit

Related details

Attention is currently required from:
  • Ben Greenstein
  • David Bokan
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Iee75d9d434cfd52a39fce1890343699ca02ad951
Gerrit-Change-Number: 7509063
Gerrit-PatchSet: 2
Gerrit-Owner: Khushal Sagar <khusha...@chromium.org>
Gerrit-Reviewer: Ben Greenstein <be...@chromium.org>
Gerrit-Reviewer: David Bokan <bo...@chromium.org>
Gerrit-Reviewer: Khushal Sagar <khusha...@chromium.org>
Gerrit-CC: AI Code Reviewer <peep-gen...@system.gserviceaccount.com>
Gerrit-Attention: Ben Greenstein <be...@chromium.org>
Gerrit-Attention: David Bokan <bo...@chromium.org>
Gerrit-Comment-Date: Thu, 22 Jan 2026 02:54:00 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
satisfied_requirement
unsatisfied_requirement
open
diffy

Dominic Farolino (Gerrit)

unread,
Jan 22, 2026, 9:49:42 PMJan 22
to Khushal Sagar, Chromium LUCI CQ, David Bokan, Ben Greenstein, AI Code Reviewer, chromium...@chromium.org, blink-re...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org, ipc-securi...@chromium.org, mfoltz+wa...@chromium.org
Attention needed from Ben Greenstein, David Bokan and Khushal Sagar

Dominic Farolino added 1 comment

File chrome/browser/actor/tools/script_tool_request.h
Line 35, Patchset 3 (Latest): std::string target_document_id_;
Dominic Farolino . unresolved

Can this be const? It is in the tool host. Actually, can we just make this the actual token itself, and convert ToString() when we need to compare it to the serialization that the DocumentIdentifierUserData provides?

Open in Gerrit

Related details

Attention is currently required from:
  • Ben Greenstein
  • David Bokan
  • Khushal Sagar
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Iee75d9d434cfd52a39fce1890343699ca02ad951
Gerrit-Change-Number: 7509063
Gerrit-PatchSet: 3
Gerrit-Owner: Khushal Sagar <khusha...@chromium.org>
Gerrit-Reviewer: Ben Greenstein <be...@chromium.org>
Gerrit-Reviewer: David Bokan <bo...@chromium.org>
Gerrit-Reviewer: Khushal Sagar <khusha...@chromium.org>
Gerrit-CC: AI Code Reviewer <peep-gen...@system.gserviceaccount.com>
Gerrit-CC: Dominic Farolino <d...@chromium.org>
Gerrit-Attention: Ben Greenstein <be...@chromium.org>
Gerrit-Attention: Khushal Sagar <khusha...@chromium.org>
Gerrit-Attention: David Bokan <bo...@chromium.org>
Gerrit-Comment-Date: Fri, 23 Jan 2026 02:49:37 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

David Bokan (Gerrit)

unread,
Jan 22, 2026, 10:45:17 PMJan 22
to Khushal Sagar, Dominic Farolino, Chromium LUCI CQ, Ben Greenstein, AI Code Reviewer, chromium...@chromium.org, blink-re...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org, ipc-securi...@chromium.org, mfoltz+wa...@chromium.org
Attention needed from Ben Greenstein and Khushal Sagar

David Bokan voted and added 1 comment

Votes added by David Bokan

Code-Review+1

1 comment

Patchset-level comments
File-level comment, Patchset 3 (Latest):
David Bokan . resolved

This approach seems fine to me and I'm guessing ScriptTools diverges more from PageTool over time even if you could hack PageTool now to work.

Open in Gerrit

Related details

Attention is currently required from:
  • Ben Greenstein
  • Khushal Sagar
Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement satisfiedCode-Owners
    • requirement satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: Iee75d9d434cfd52a39fce1890343699ca02ad951
    Gerrit-Change-Number: 7509063
    Gerrit-PatchSet: 3
    Gerrit-Owner: Khushal Sagar <khusha...@chromium.org>
    Gerrit-Reviewer: Ben Greenstein <be...@chromium.org>
    Gerrit-Reviewer: David Bokan <bo...@chromium.org>
    Gerrit-Reviewer: Khushal Sagar <khusha...@chromium.org>
    Gerrit-CC: AI Code Reviewer <peep-gen...@system.gserviceaccount.com>
    Gerrit-CC: Dominic Farolino <d...@chromium.org>
    Gerrit-Attention: Ben Greenstein <be...@chromium.org>
    Gerrit-Attention: Khushal Sagar <khusha...@chromium.org>
    Gerrit-Comment-Date: Fri, 23 Jan 2026 03:45:06 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Khushal Sagar (Gerrit)

    unread,
    Jan 22, 2026, 11:17:17 PMJan 22
    to David Bokan, Dominic Farolino, Chromium LUCI CQ, Ben Greenstein, AI Code Reviewer, chromium...@chromium.org, blink-re...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org, ipc-securi...@chromium.org, mfoltz+wa...@chromium.org
    Attention needed from Ben Greenstein and Dominic Farolino

    Khushal Sagar added 2 comments

    Patchset-level comments
    David Bokan . resolved

    This approach seems fine to me and I'm guessing ScriptTools diverges more from PageTool over time even if you could hack PageTool now to work.

    Khushal Sagar

    That was exactly my thinking. There wasn't enough code to share with PageTool to justify adding script tool specific hooks to it.

    File chrome/browser/actor/tools/script_tool_request.h
    Line 35, Patchset 3: std::string target_document_id_;
    Dominic Farolino . resolved

    Can this be const? It is in the tool host. Actually, can we just make this the actual token itself, and convert ToString() when we need to compare it to the serialization that the DocumentIdentifierUserData provides?

    Khushal Sagar

    I can't make this const because all request sub-classes need to support a copy assignment operator.

    Excellent point about using base::UnguessableToken. A lot of code uses the string directly because that's what we get from the proto [here](https://source.chromium.org/chromium/chromium/src/+/main:components/optimization_guide/proto/features/common_quality_data.proto;l=798;drc=49cae4c047d2261226d683ad63354dd31caf6dde). But the correct thing would be to deserialize, which validates that it's an unguessable token, and then use that in rest of the code. Done.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Ben Greenstein
    • Dominic Farolino
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement satisfiedCode-Owners
    • requirement satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: Iee75d9d434cfd52a39fce1890343699ca02ad951
    Gerrit-Change-Number: 7509063
    Gerrit-PatchSet: 5
    Gerrit-Owner: Khushal Sagar <khusha...@chromium.org>
    Gerrit-Reviewer: Ben Greenstein <be...@chromium.org>
    Gerrit-Reviewer: David Bokan <bo...@chromium.org>
    Gerrit-Reviewer: Khushal Sagar <khusha...@chromium.org>
    Gerrit-CC: AI Code Reviewer <peep-gen...@system.gserviceaccount.com>
    Gerrit-CC: Dominic Farolino <d...@chromium.org>
    Gerrit-Attention: Ben Greenstein <be...@chromium.org>
    Gerrit-Attention: Dominic Farolino <d...@chromium.org>
    Gerrit-Comment-Date: Fri, 23 Jan 2026 04:16:49 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Dominic Farolino <d...@chromium.org>
    Comment-In-Reply-To: David Bokan <bo...@chromium.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Khushal Sagar (Gerrit)

    unread,
    Jan 22, 2026, 11:17:59 PMJan 22
    to David Bokan, Dominic Farolino, Chromium LUCI CQ, Ben Greenstein, AI Code Reviewer, chromium...@chromium.org, blink-re...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org, ipc-securi...@chromium.org, mfoltz+wa...@chromium.org
    Attention needed from Ben Greenstein and Dominic Farolino

    Khushal Sagar added 2 comments

    File third_party/blink/renderer/core/html/forms/html_form_element.h
    Line 257, Patchset 1: base::OnceCallback<void(
    AI Code Reviewer . resolved

    Blink Style Guide: Dependencies. `core/` should not depend on `public/web`. `WebDocument` is in `public/web`. Using `WebDocument::ScriptToolError` here introduces a forbidden dependency from `core` to `public/web`.

    To keep this interaction as brief and non-intrusive as possible, please consider responding with one of following options:
    **Done** | **OK But Won't Fix**: reason | **Later**: b/<bug_id> | **Invalid:** reason


    _This comment was generated by [Experimental Blink C++ Code Review Agent](http://go/blink-c++-code-review-agent)._
    _AI reviews can sometimes be inaccurate; We appreciate your 🙏 feedback 🙏 to help us improve._
    _[File a bug](http://go/blink-c++-code-review-agent-feedback) | [Provide feedback on chat](https://chat.google.com/room/AAQA0zhQHe0?cls=4) | [Opt-out](https://ganpati2.corp.google.com/group/peep-genai-blink-agent-optout.prod)_

    Khushal Sagar

    Acknowledged

    File third_party/blink/renderer/core/script_tools/model_context.h
    Line 30, Patchset 1: base::OnceCallback<
    AI Code Reviewer . resolved

    Blink Style Guide: Dependencies. `core/` should not depend on `public/web`. `WebDocument` is in `public/web`. To avoid circular dependencies and layering violations, define the error type in `core` (e.g., `ModelContext::ScriptToolError`) and map it to the public API type in the `WebDocument` implementation.

    To keep this interaction as brief and non-intrusive as possible, please consider responding with one of following options:
    **Done** | **OK But Won't Fix**: reason | **Later**: b/<bug_id> | **Invalid:** reason


    _This comment was generated by [Experimental Blink C++ Code Review Agent](http://go/blink-c++-code-review-agent)._
    _AI reviews can sometimes be inaccurate; We appreciate your 🙏 feedback 🙏 to help us improve._
    _[File a bug](http://go/blink-c++-code-review-agent-feedback) | [Provide feedback on chat](https://chat.google.com/room/AAQA0zhQHe0?cls=4) | [Opt-out](https://ganpati2.corp.google.com/group/peep-genai-blink-agent-optout.prod)_

    Khushal Sagar

    Acknowledged

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Ben Greenstein
    • Dominic Farolino
    Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement satisfiedCode-Owners
      • requirement satisfiedCode-Review
      • requirement satisfiedReview-Enforcement
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: Iee75d9d434cfd52a39fce1890343699ca02ad951
      Gerrit-Change-Number: 7509063
      Gerrit-PatchSet: 5
      Gerrit-Owner: Khushal Sagar <khusha...@chromium.org>
      Gerrit-Reviewer: Ben Greenstein <be...@chromium.org>
      Gerrit-Reviewer: David Bokan <bo...@chromium.org>
      Gerrit-Reviewer: Khushal Sagar <khusha...@chromium.org>
      Gerrit-CC: AI Code Reviewer <peep-gen...@system.gserviceaccount.com>
      Gerrit-CC: Dominic Farolino <d...@chromium.org>
      Gerrit-Attention: Ben Greenstein <be...@chromium.org>
      Gerrit-Attention: Dominic Farolino <d...@chromium.org>
      Gerrit-Comment-Date: Fri, 23 Jan 2026 04:17:34 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Comment-In-Reply-To: AI Code Reviewer <peep-gen...@system.gserviceaccount.com>
      satisfied_requirement
      open
      diffy

      Khushal Sagar (Gerrit)

      unread,
      Jan 22, 2026, 11:18:02 PMJan 22
      to David Bokan, Dominic Farolino, Chromium LUCI CQ, Ben Greenstein, AI Code Reviewer, chromium...@chromium.org, blink-re...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org, ipc-securi...@chromium.org, mfoltz+wa...@chromium.org
      Attention needed from Ben Greenstein and Dominic Farolino

      Khushal Sagar voted Commit-Queue+2

      Commit-Queue+2
      Gerrit-Comment-Date: Fri, 23 Jan 2026 04:17:39 +0000
      Gerrit-HasComments: No
      Gerrit-Has-Labels: Yes
      satisfied_requirement
      open
      diffy

      Chromium LUCI CQ (Gerrit)

      unread,
      Jan 23, 2026, 12:12:35 AMJan 23
      to Khushal Sagar, David Bokan, Dominic Farolino, Ben Greenstein, AI Code Reviewer, chromium...@chromium.org, blink-re...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org, ipc-securi...@chromium.org, mfoltz+wa...@chromium.org

      Chromium LUCI CQ submitted the change with unreviewed changes

      Unreviewed changes

      3 is the latest approved patch-set.
      The change was submitted with unreviewed changes in the following files:

      ```
      The name of the file: chrome/browser/actor/actor_test_util.cc
      Insertions: 3, Deletions: 2.

      The diff is too large to show. Please review the diff.
      ```
      ```
      The name of the file: chrome/browser/actor/tools/script_tool_host.cc
      Insertions: 5, Deletions: 4.

      The diff is too large to show. Please review the diff.
      ```
      ```
      The name of the file: chrome/browser/actor/browser_action_util.cc
      Insertions: 11, Deletions: 6.

      The diff is too large to show. Please review the diff.
      ```
      ```
      The name of the file: chrome/browser/actor/tools/script_tool_request.h
      Insertions: 2, Deletions: 2.

      The diff is too large to show. Please review the diff.
      ```
      ```
      The name of the file: chrome/browser/actor/tools/script_tool_request.cc
      Insertions: 5, Deletions: 4.

      The diff is too large to show. Please review the diff.
      ```
      ```
      The name of the file: chrome/browser/actor/tools/script_tool_host.h
      Insertions: 2, Deletions: 2.

      The diff is too large to show. Please review the diff.
      ```

      Change information

      Commit message:
      actor: Refactor browser-side setup for script tools/webmcp

      Use a direct sub-class of TabToolRequest and Tool for browser-side
      management of script tool requests instead of using PageTool as the
      base.

      The behaviour between script tools and other actuation based tools is
      different such that this inheritance doesn't make sense. Script tools
      don't need to wait for page stabilization and observation shouldn't
      be delayed.
      Change-Id: Iee75d9d434cfd52a39fce1890343699ca02ad951
      Commit-Queue: Khushal Sagar <khusha...@chromium.org>
      Reviewed-by: David Bokan <bo...@chromium.org>
      Cr-Commit-Position: refs/heads/main@{#1573500}
      Files:
      • M chrome/browser/actor/BUILD.gn
      • M chrome/browser/actor/actor_test_util.cc
      • M chrome/browser/actor/browser_action_util.cc
      • M chrome/browser/actor/browser_action_util.h
      • M chrome/browser/actor/tools/page_tool.cc
      • A chrome/browser/actor/tools/script_tool_host.cc
      • A chrome/browser/actor/tools/script_tool_host.h
      • M chrome/browser/actor/tools/script_tool_request.cc
      • M chrome/browser/actor/tools/script_tool_request.h
      Change size: L
      Delta: 9 files changed, 343 insertions(+), 49 deletions(-)
      Branch: refs/heads/main
      Submit Requirements:
      • requirement satisfiedCode-Review: +1 by David Bokan
      Open in Gerrit
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: merged
      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: Iee75d9d434cfd52a39fce1890343699ca02ad951
      Gerrit-Change-Number: 7509063
      Gerrit-PatchSet: 6
      Gerrit-Owner: Khushal Sagar <khusha...@chromium.org>
      Gerrit-Reviewer: Ben Greenstein <be...@chromium.org>
      Gerrit-Reviewer: Chromium LUCI CQ <chromiu...@luci-project-accounts.iam.gserviceaccount.com>
      Gerrit-Reviewer: David Bokan <bo...@chromium.org>
      Gerrit-Reviewer: Khushal Sagar <khusha...@chromium.org>
      Gerrit-CC: AI Code Reviewer <peep-gen...@system.gserviceaccount.com>
      open
      diffy
      satisfied_requirement
      Reply all
      Reply to author
      Forward
      0 new messages