Aditya Reddy (in/adityareddy-dev) is a Senior Software Engineer at Northwestern Mutual, an OpenTelemetry Browser approver, and a contributor to web-vitals and W3C Web Performance explainers.
I put 210 ms of work in a button’s click handler and clicked it with Playwright. Chrome, Firefox and WebKit each recorded a 208 ms click. Then I gave a page in Chrome another way to do slow work. With WebMCP enabled, I could call a function registered by the page or ask the browser to submit a form. Across 110 local trials, 60 measuring those calls and 50 testing how Chrome attributed the work, my Event Timing observer received zero entries.
Erwin Hofman had asked on the RUMvision blog what a real user monitoring (RUM) service would see when a browser can call a site’s tools directly. What got me interested was the button next to the tool. If somebody clicks it while the tool has the main thread busy, where does that wait show up?
What the browser recorded for a click
I started with Chrome 158.0.8127.38, Firefox 157.0 and WebKit 27.2. I had page JavaScript dispatch a MouseEvent to the slow button. The handler ran in all three engines. Each reported isTrusted: false, zero Event Timing entries with a positive interactionId, and no Interaction to Next Paint (INP) from web-vitals.
Then I used Playwright to click a faster button and, after a history.pushState(), the slow one. All three engines marked the slow click isTrusted: true. Each produced a click entry with a non-zero interactionId and a duration of 208 ms. The Event Timing specification rounds durations to an 8 ms increment, so a reported duration can be shorter than the work in the handler. Firefox and WebKit also reported 208 ms to the web-vitals INP callback, rated needs-improvement. In Chrome’s saved sequence in the three-engine click results, the only callback was for the earlier button, at 72 ms.
In a separate matched CDP control on Chrome 158.0.8127.91, I sent two clicks through the Chrome DevTools Protocol (CDP) to the same 210 ms handler. Event Timing measured 216 ms for the first click and 208 ms for the second. Both were trusted. The only automation label came from a marker I added to the second click in my harness.
I found quite different ways of dealing with this in RUM libraries. The Vercel Speed Insights script stops before collection if navigator.webdriver is set or the user agent contains Headless. New Relic’s browser agent 1.309.0 added webdriverDetected to page views, page view timings and initial page-load interactions. Sentry skips browser tracing setup for known crawler user agents.
Datadog tried combining WebGL and CDP signals with mouse activity and interaction timing in browser-sdk #4662. The bundle size check on that experimental pull request measured a 23.05 KiB increase for the RUM bundle, and the PR closed unmerged in November.
Even a correct label for a session leaves a question about the next click. Microsoft Clarity studied over 5.2 million sessions classified as agentic across 230,511 projects and pointed out that a person can take over during one of those sessions. Clarity’s open PR #1142 ignores the persistent ChatGPT Desktop sidebar for a similar reason, since it can be on screen while a person is browsing.
When the page calls a WebMCP tool
For the WebMCP experiments I used Chrome 158.0.8127.91 with --enable-features=WebMCPTesting and --enable-blink-features=WebMCP,WebMCPTesting,DeclarativeWebMCP. I registered a function that did 200 ms of synchronous work, another that waited on a 100 ms timer and then did 100 ms of work, and a <form toolname toolautosubmit> with a 195 ms submit handler. I called each through document.modelContext.executeTool() 20 times. I listened for event entries with a 16 ms duration threshold and for long animation frames (LoAF).
Across those 60 calls, the observer received zero event entries, even before I filtered for an interaction ID. The long frames showed where the time went. The synchronous function produced a median frame of 200.2 ms with 150.1 ms of blocking. For the form it was 195.3 ms with 145.3 ms of blocking. All 20 form submissions set event.agentInvoked to true on the submit event. The imperative function ran without a click or a form submission.
I tried timing the calls with document.modelContext.ontoolactivated in the saved lifecycle measurements. In each of the three cases the median gap between the handler’s synchronous return and the listener was 0.0 ms. The 95th percentile was 0.1 ms for the synchronous function and the form, and 0.0 ms for the async function. Measured from invocation, the median listener time was 200.1 ms for the synchronous function and 195.2 ms for the form. For the async function it ran at 0.1 ms, when the handler had returned its promise. The handler finished at 202.2 ms, a median of 202.1 ms after the listener. A timer stopped at activation would miss almost the entire call. I posted the earlier 60-trial run on Chrome 158.0.8127.38 in webmachinelearning/webmcp #126 where the lifecycle events are being discussed.
Two read-only calls on Craft Quantities
On December 2 I used the same flag-enabled Chrome build on Craft Quantities, a production React site whose author described about 200 distinct tool names across the site in webmachinelearning/webmcp #402. I polled getTools() on the concrete calculator. My load listener ran at 754.2 ms. I first saw the eight site-wide tools at 881.4 ms. At 1,492.9 ms I saw 19 tools, including 11 specific to the calculator. A runner that stopped at the first nonempty list would have missed the calculator tools.
On the Craft Quantities WebMCP developer page I timed two read-only calls (saved production measurements). These are elapsed times from invocation to promise resolution. Neither call produced a long animation frame or an Event Timing entry.
| Call | Promise resolved after | Activation listener ran after invocation | Time from listener to resolution |
|---|---|---|---|
get_citation |
116.1 ms | 0.4 ms | 115.7 ms |
get_my_project_summary |
472.1 ms | 4.5 ms | 467.6 ms |
How a 20 ms click handler ended up in a 248 ms interaction
Back on localhost, I gave the button a 20 ms click handler. I had the concurrent-click harness send a mouse press and release through CDP to #fast-btn. That let me queue a trusted click while JavaScript was still running. I ran five trials per scenario on Chrome 158.0.8127.91. The handler took 20 ms in every trial.
I measured INP with onINP from web-vitals/attribution. A local function copied the resulting attribution into the browser.web_vital.inp.* fields using the mapping that shipped December 2 in @opentelemetry/browser-instrumentation@0.13.0 (opentelemetry-browser #486). The values below come from the web-vitals callback in the concurrent-click results.
| When the trusted click arrived | Median INP | Median input delay | Longest script’s invoker | INP rating |
|---|---|---|---|---|
| Main thread idle | 24 ms | 0.3 ms | None reported | good |
| During 260 ms of synchronous tool work | 248 ms | 224.7 ms | ToolExecuteCallback |
needs-improvement |
| During 260 ms of tool work after a timer resolved | 248 ms | 225.2 ms | TimerHandler:setTimeout |
needs-improvement |
The extra time was in the queue. A person clicking while the same JavaScript occupies the main thread has to wait for the same reason. In the synchronous case I could follow the delay back to ToolExecuteCallback with the source function name execute. In the async case I got TimerHandler:setTimeout and an empty function name. The report told me the click had waited for work that ran after a timer fired. It gave me no way to trace that work back to the WebMCP call that scheduled it.
Where the WebMCP label disappears
I moved 120 ms of CPU work across different callbacks in the same flag-enabled Chrome build. I ran five trials for each of ten cases in the async boundary measurements. All 50 delivered zero Event Timing entries. The frames were nearly the same length, but Chrome attributed the work to different callbacks.
| Where the work ran | Trials showing ToolExecuteCallback |
Observed LoAF invoker | Median frame / blocking time |
|---|---|---|---|
Synchronous execute() |
5/5 | ToolExecuteCallback |
120.3 ms / 70.2 ms |
After await Promise.resolve() |
5/5 | ToolExecuteCallback |
120.3 ms / 70.2 ms |
Inside queueMicrotask |
5/5 | ToolExecuteCallback |
120.2 ms / 70.1 ms |
Inside a setTimeout callback |
0/5 | TimerHandler:setTimeout |
120.3 ms / 70.2 ms |
| After awaiting a timer | 0/5 | TimerHandler:setTimeout |
120.2 ms / 70.1 ms |
Inside scheduler.postTask |
0/5 | SchedulerPostTaskCallback |
120.2 ms / 70.2 ms |
Inside a MessageChannel handler |
0/5 | MessagePort.onmessage |
120.2 ms / 70.1 ms |
Inside requestAnimationFrame |
0/5 | FrameRequestCallback |
120.3 ms / 70.2 ms |
| Unrelated page timer while a tool was pending | 0/5 | TimerHandler:setTimeout |
120.3 ms / 70.1 ms |
| Tool resumed by a promise resolved from an external timer | 0/5 | TimerHandler:setTimeout |
120.1 ms / 70.1 ms |
The synchronous call and the two same-task microtask cases kept ToolExecuteCallback in all 15 trials. When the tool’s work moved to a later task, all 30 trials named the callback where the work resumed. In the other five trials, an unrelated timer ran while the tool was pending. It kept its own timer label too. A timer running between invocation and resolution could belong to either piece of code.
I went back to the Blink source tagged 158.0.8127.38 to understand the difference. The callback timing probe in callback_invoke_helper.cc wraps V8ScriptRunner::CallFunction, where V8 drains same-task microtasks inside v8_script_runner.cc while the probe for the original callback is still open.
Blink already carries an invocation ID internally. Mason Freed added it in April 2026 (commit 93215cb6) so Chrome could associate a navigation with the tool that triggered it. Both the declarative path and the imperative path install a ScriptToolContext through TaskAttributionTracker, while AnimationFrameTimingMonitor::Will records the callback’s name without reading that tool context.
For scheduler.postTask (dom_task.cc), a same-window MessagePort (message_port.cc) and requestAnimationFrame (callback_invoke_helper.h), Blink can restore the saved task state before the callback probe opens. A timer does this in the opposite order. DOMTimer::Fired (dom_timer.cc) opens the TimerHandler:setTimeout probe first, and ScheduledAction::Execute (scheduled_action.cc) restores the saved state afterward.
What I’d like to measure
In a separate page-script control I called a 240 ms WebMCP function directly from page JavaScript. Chrome delivered zero Event Timing entries. The saved long frame was 241 ms and named ToolExecuteCallback. That name told me how the function ran. My own page script was enough to produce it. Firefox and WebKit both reported supportsLoaf: false in the click sweep. Even where the browser supplies the name, it may never reach a RUM dashboard. SpeedCurve removed the invoker and source function name from LoAF entries in its LUX beacon to save space, as documented in the v4.1.2 and v4.1.3 release notes.
WebKit standards-positions #670 and W3C charter-drafts #955 both raise privacy concerns about telling a page that a visitor is using an agent. PostHog already offers opt-in $mcp_tool_call capture (posthog-js #5190), and setting capture_webmcp: { intent: false, model: false } (posthog-js #5191) keeps the basic call event with both metadata fields turned off.
I’d like to be able to follow that 248 ms click back to the tool that occupied the main thread after the timer fired. For that I’d need a link from the blocking callback to the invocation that scheduled it. A browser could give me that link and time my page’s registered tools the same way for every caller.
Run the experiments
The agent-interaction-timing repository holds the raw traces and harness scripts, and there is a live trace viewer for the saved results. To run the harness, use Node 22 or later and a local Chrome 158 installation. For the three-engine sweep, install Playwright’s Firefox and WebKit builds as well. The Chrome harnesses default to the macOS Chrome path and accept a different path in CHROME_BIN.
git clone https://github.com/adityareddy-dev/agent-interaction-timing.git cd agent-interaction-timing npm ci npx playwright-core install firefox webkit npm run repro:browsers npm run repro npm run repro:async npm run repro:inp-tax npm run repro:prod
I put the traces in WICG/agent-interaction-measurement #2. The question I’d like to settle there is what a browser could expose when the longest script in a slow click is just called TimerHandler:setTimeout.