Skip to content

feat(browser): the action log credits Playwright MCP's commands to the browser_* call they serve (FD-5503) - #630

Merged
earakely-scale merged 3 commits into
mainfrom
edgararakelyan/fd-5503-m859-the-action-log-credits
Nov 12, 2026
Merged

earakely-scale merged 3 commits into
mainfrom
edgararakelyan/fd-5503-m859-the-action-log-credits

Conversation

@earakely-scale

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

Copy link
Copy Markdown
Collaborator

Summary

M8.59 (FD-5503). The browser's action log (M8.19) now credits the browser_* tools (M8.8) to the agent that called them.

  • Each browser_* call is an entry of its own, as a page tool's call is, giving:
    • who called it, by role
    • the tool, the call's id and its arguments
    • the tab and URL it acted on
    • whether it worked
  • The CDP commands Playwright MCP sends for that call name it as for, and so do the tab events those commands cause.

Before this, Playwright MCP's commands were logged only as who: playwright-mcp, naming no agent or tool call, and the call itself had no entry.

What changes

browser/v1 (agentenv_protocol.website_browser)

  • calls/begin {user, acts?, within_s?}, framework-only, is sent with the agent's call in the AgentEnv-Tool-Call header, and the role in AgentEnv-Role. It begins the call's entry (via: "mcp", who, tool, call, with no op) and answers with its entry.
  • calls/end {entry, ok, error?} ends the call. The entry is written with:
    • ok, and error when it failed
    • the tab its commands acted on, and that tab's URL
    • for an acting call, its args
  • A bound on open calls: a call not ended within within_s is written as never said to have ended, and is credited no more. This covers a driver that is killed mid-call.
  • Neither op is logged as an entry of its own, since both are in UNLOGGED_OPS.

The relay

  • Crediting: each command from a CDP user with a call open gets "for": <that call's entry>. When several calls are open at once, it gets "for": [<entries>], rather than a guess.
  • Tab events caused by such a command carry the same for.
  • The call's tab is the one its commands last acted on, from commands credited to it alone.
  • Typing: the call's typed arguments are kept only once every typing command of its own found no password field in focus. Otherwise only their lengths are kept, as M8.19 does for page tools. That covers browser_type's text, browser_press_key's key and browser_fill_form's field values.

The page driver

  • Bracketing: each browser_* call goes between calls/begin and calls/end for the user playwright-mcp, within Playwright MCP's own bound (360 s).
  • Acting or reading: a call acts unless Playwright MCP's manifest marks its tool readOnlyHint.
  • A call the browser can't log still goes, with a warning. A cancelled call is ended as cancelled.

Decisions (FD-5503, in chat with Edgar)

  1. How a command is tied to its call: the driver marks each call's start and end, and the relay credits the user's commands to the call open at the time, or to all of them when calls overlap.
    • Rejected: one Playwright MCP process per role, and the driver proxying Playwright MCP's CDP connections.
    • Telling agents apart exactly is left to contexts (M8.15, M8.16).
  2. who on a credited command stays the connection's user (playwright-mcp), with for added, rather than being rewritten to the agent's role. who keeps one meaning across every CDP entry.

Test plan

  • Unit, the relay:
    • a user's commands are credited to its open call, and another user's aren't
    • overlapping calls are all listed
    • a call's entry takes its tab and URL, or none when its only commands were shared
    • a failed call keeps its error, and a reading call keeps no arguments
    • typed text is kept after a clean password check, and kept as its length after a focused one or with no check at all
    • a call past its bound is written as never ended, and isn't credited any more
  • Unit, the ops: calls/begin and calls/end write the call's entry from its header and role, with the URL's credential redacted. Neither op is an entry of its own. A begin without the header is refused, and so is an end for an unknown entry.
  • Unit, the log:
    • Playwright MCP's typing arguments (text, key, fields[].value) keep only their length while a password field has focus.
    • A tab event names the call its command served.
  • Unit, the page driver:
    • each call is begun with the agent's call and acting-or-reading flag, and ended with how it went
    • a call the browser can't log still goes
    • a cancelled call is ended as cancelled
    • Results: the protocol package and tst/unit/drivers, 1,599 passed, 1 skipped.
  • Integration, local Docker (Mac, arm64): browser_computer_test.py, 29 of 29. The Playwright MCP test now reads the browser's log after its browser_* drive. It checks:
    • an entry for each of browser_snapshot, browser_type, browser_navigate, browser_click and browser_handle_dialog
    • browser_type's entry with who: default and its text kept
    • Page.navigate, every Input.dispatchMouseEvent and Page.handleJavaScriptDialog each for their call
    • the navigation's tab event for browser_navigate

Until #628 merges, that test can rarely time out at browser_evaluate.

Docs

The user guide's browser page should cover:

  • a browser_* call's entry in the action log
  • for on CDP commands and tab events
  • how overlapping calls show

🤖 Generated with Claude Code

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge; no new actionable issues were found.

Summary

Credits Playwright MCP commands and their tab events to the agent’s browser_* call.

  • Browser tool calls now appear in the action log with links to their commands.
  • Playwright MCP calls now stop waiting after one deadline.

No new issues found. The earlier timeout concern is addressed: the whole call includes the session-lock wait, and the log entry allows another 30 seconds for the closing request.

Diagram

sequenceDiagram
  participant Agent
  participant Driver as Page driver
  participant Relay as Browser relay
  participant MCP as Playwright MCP
  Agent->>Driver: "browser_* call"
  Driver->>Relay: calls/begin with role and tool call
  Relay-->>Driver: entry
  Driver->>MCP: Run tool
  MCP->>Relay: CDP commands
  Note over Relay: Commands and caused tab events name the call's entry
  MCP-->>Driver: Tool result
  Driver->>Relay: calls/end with outcome
  Driver-->>Agent: Tool result
Loading

Reviews (3) · Last reviewed commit: "test(browser): the browser's card lists ..." · Reviewed by Greptile

…e browser_* call they serve (FD-5503)

browser/v1 gains calls/begin and calls/end, which a driver sends around an
agent's tool call it serves through a CDP user's connections. The relay
credits that user's commands to the call open at the time, or to every one
open when calls overlap, as for, and the tab events they cause carry it too.
The call's entry takes the tab its commands acted on and keeps what it typed
only once each typing command of its own found no password field focused. The
page driver brackets each browser_* call so.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@earakely-scale
earakely-scale requested a review from a team as a code owner November 12, 2026 00:31
earakely-scale and others added 2 commits November 11, 2026 16:39
A call's entry in the browser's log was bounded by the call's own limits, but
not the wait for the session lock while another caller's Playwright MCP
starts, so a call within every limit could outlast its entry and lose its
credit. The whole call is bounded now, from when it asks for its session, and
the browser waits that and the closing request's time. A session whose opening
is given up on is closed rather than left half open.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@earakely-scale
earakely-scale merged commit 55101b3 into main Nov 12, 2026
61 of 63 checks passed
@earakely-scale
earakely-scale deleted the edgararakelyan/fd-5503-m859-the-action-log-credits branch November 12, 2026 02:32
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.

1 participant