perf(extension): overlap Jev intent with DOM settle and observe's snapshot - #2993
Draft
miguelg719 wants to merge 1 commit into
Draft
miguelg719 wants to merge 1 commit into
miguelg719 wants to merge 1 commit into
Conversation
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stack
Stack: #2951 snapshot editable ids → #2952 library → #2953 act pipeline → #2954 observe + cache check → #2955 extract → #2988 WebMCP tools → this PR. Base:
jev/6-webmcp-tools.Why
Every
act()first waits for the DOM to settle, which is a quiet window of at least 500 ms. The Jev intent request needs no page, only the instruction, yet it waited for that too. Same shape inobserve(): intent was asked after the snapshot it does not depend on.What
actService.ts: with Jev enabled, the DOM-settle wait is started but not awaited up front. It is passed to the pipeline assettled; cache replay and the LLM fallback await it before touching the page. With Jev off nothing changes (awaitas before).jevAct/pipeline.ts: the intent request runs whilesettledis pending.snapshot()and the action helper (press / whole-page scroll never take a snapshot) await it first, so nothing reads or touches the page before the settle wait is over. A WebMCP tool call (feat(extension): experimental Jev WebMCP tool selection in act() #2988) does not wait for it at all.jevAct/observe.ts: intent is asked while the snapshot is captured.totalMs, measured from the start ofact()with settle included.durationMswas started after the settle wait, so it under-reported what a caller waits for, equally in the LLM and Jev arms.Tried and dropped: starting the first snapshot before intent answers. Settle always outlasts the intent request, so it gained nothing, and it made press / not-an-action acts capture a snapshot they do not need.
Results
Browserbase, gemini-3.8-flash fallback, 1 trial, Jev + LLM fallback:
vantechjournal, fails on every arm)The two extra breadth failures are not timing:
dup_sauce_second_item_cartfailed before its first act, andnav_usajobs_collapse_grouplanded on the Help Center root where the target section does not exist (the LLM fallback failed on it too).Where a Jev-only act's time goes now (act suite, median of 35 acts): total 1001 ms = intent 138 ms (now inside the settle wait) + picks, action and checks 274 ms + ~560 ms that is settle and snapshot. Before, intent came after settle, so the saving is the intent request: ~140–250 ms per act. Tool acts on a local Chrome went from 672–785 ms to 244–398 ms because they skip the wait entirely.
What is left is the settle window itself: more than half of a Jev act. That is core
act()behaviour shared with the LLM path, so it is not touched here.Testing
New pipeline test: intent is requested before
settledresolves and the action runs only after it. Existing "no snapshot for press / not-an-action / low-confidence" tests still hold. Full extension/protocol/sdk-ts/root suites, typecheck, lint, fmt,extensionpack --checkpass locally.Summary by cubic
Previously the Jev intent request waited for the DOM settle window even though it only needs the instruction. Now it runs while the DOM settles, making Jev acts faster while every page read and action still waits for the settle to finish.
Details
observe()asks its intent while the snapshot is being captured.totalMs, measured from the start ofact(), whiledurationMsstill measures only the pipeline.act()continues to await the settle wait up front.Written for commit 577eb9f. Summary will update on new commits.