Skip to content

perf: reduce unnecessary post-click latency in click_ax #3064

Description

@alectimison-maker

Problem

click_ax dispatches the page's synthetic el.click() before entering its post-click observation path. When there is no immediate target-state proof, the observer samples after 250 ms and may poll for up to 1,250 ms. For fallback-eligible targets, it can then spend up to another 800 ms in a final settle window before considering a trusted CDP click.

These checks help prevent duplicate submissions and other repeated side effects, but they can make a click_ax tool call feel slow even when the page has already responded. The click event itself is dispatched earlier; this issue is about the latency before the agent receives the click result and can continue.

This is separate from #214, which discusses warming the initial accessibility-tree read. This issue focuses on post-dispatch click verification.

Proposal

  • Add stage-level timing for click_ax: preflight, synthetic dispatch, post-click observation, trusted-fallback preparation/dispatch, and result return.
  • Measure representative immediate, delayed, no-op, navigation, and state-changing clicks before changing the wait policy.
  • Evaluate early exits or adaptive observation budgets for cases with reliable, target-specific progress evidence.
  • Preserve the current safety behavior when a click may already have caused a side effect or its outcome is unknown.

Acceptance criteria

  • Traces or benchmark output make pre-dispatch, dispatch, observation, fallback, and total tool latency distinguishable.
  • A repeatable comparison reports p50/p95 click-to-tool-result latency, overall task success, and duplicate/unsafe dispatches for the current and proposed behavior.
  • Strong progress evidence can end observation early without waiting out a fixed timeout.
  • Relevant network mutation, download, tab-change, recipient-binding, or unknown-outcome signals continue to suppress an unsafe trusted retry.
  • A dispatched click is never blindly replayed because its result was slow or inconclusive.
  • No global wait reduction is enabled unless the measurements show lower latency without worse task success or duplicate side effects.

Out of scope

Removing click verification globally; changing permission or recipient checks; replacing the AX/ref_id path; changing the Firefox synthetic-click behavior; adding a remote judge/model dependency; revisiting initial AX warmup (#214).


Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions