Repository navigation
Studio: faster browser agent page reads after a load, and leaner drags - #13602
Conversation
…rag with two fewer round trips The proxied page shell now watches the DOM from the document's start, so the agent's status reports how long the page has really been still instead of counting from when the agent arrived after the load. A drag takes the page's document token from the describes it already makes rather than two extra status calls.
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. What shall we delve into next? Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
…et, not 350 Measured in two Studios, the shell-side quiet tracker bought nothing: the agent arrives within milliseconds of the page's last change, so the wait is real time since the page was drawn. Drop it. Instead, when the shell counts the page's requests and none was open during the wait, 120 ms of quiet is enough; content still on its way arrives by a request, which is waited on as before. Native views report no count and keep the full quiet.
|
@codex review |
1 similar comment
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a3c25708f4
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| async function untilFilled(tab: BrowserTab, since: number, signal?: AbortSignal): Promise<boolean> { | ||
| const entry = currentEntry(tab); | ||
| return (await waitOnPage(tab.id, (now) => currentEntry(now) !== entry, since, FILL_QUIET_MAX_MS, signal)) === "loading"; | ||
| return (await waitOnPage(tab.id, (now) => currentEntry(now) !== entry, since, FILL_QUIET_MAX_MS, signal, FILL_IDLE_QUIET_MS)) === "loading"; |
There was a problem hiding this comment.
Don't treat a currently idle page as fully loaded
When a freshly loaded page schedules its data fetch after more than 120 ms—for example through a debounce, setTimeout, or lazy hydration—the initial status polls report requests: 0, so opened remains false and this call returns before the request starts or its content renders. The resulting navigation snapshot can therefore omit page data that the previous 350 ms quiet window would have caught; an instantaneous in-flight count cannot establish that no request will start, so retain the full observation window or track request activity from page load.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Intentional trade, measured: in two Studios opening the same six static pages three times, a page open takes about 300 ms here against 540 to 650 ms on main. Pages whose data arrives by a request started at or before the read are still waited on, request by request, with the full quiet after it closes; native views keep the full window. What this gives up is a page that starts its first request more than 120 ms after load with nothing open before it; the agent can snapshot again, and main before #13532 read such pages with no wait at all.
|
@codex review |
1 similar comment
|
@codex review |
|
Codex Review: Didn't find any major issues. Hooray! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Follow-up to #13505 and #13532, from a performance pass over the browser agent.
What changes
browser_navigatewaited for 350 ms of DOM quiet, so every page, static or not, paid about that much. When the proxied shell counts the page's requests and none was open during the wait, 120 ms of quiet is now enough. A page that had any request open still gets the full 350 ms after its requests close, and native views, which have no request count, keep the full window (statusnow omitsrequeststhere instead of reporting 0).describecalls it already makes instead of two extrastatuscalls, and it checks the document before any recheck that could send a cancel, so a cancel never reaches a replacement page.Trade-off: a page that starts its first request more than 120 ms after load, with nothing open before it, can now be read before that request's content arrives; the agent can snapshot again. Before #13532 such pages were read with no wait at all.
A first attempt (the shell watching the DOM from the document's start) measured no gain: the page's last change is its own load, milliseconds before the agent arrives. It is not in this PR.
Measured
Two Studios, main and this branch, each opening the same six static pages (example.com, example.org, iana.org, twice) through the real executor and panel, three runs, time from the action reaching the panel to its result:
Verification
tests/browser-agent-page-wait.test.ts: a page with no request is read after the short quiet; one whose requests nothing counts gets the full quiet; one that had a request open gets the full quiet after it closes.tests/browser-agent-drag.test.ts: a drag makes nostatusround trips before its drop (fails on main); the navigation, Stop and same-document cases still hold.tscis clean.