Skip to content

Studio: faster browser agent page reads after a load, and leaner drags - #13602

Merged
danielhanchen merged 2 commits into
mainfrom
studio-browser-faster-page-reads
Oct 13, 2026
Merged

danielhanchen merged 2 commits into
mainfrom
studio-browser-faster-page-reads

Conversation

@danielhanchen

@danielhanchen danielhanchen commented Oct 13, 2026 •

Copy link
Copy Markdown
Member

Follow-up to #13505 and #13532, from a performance pass over the browser agent.

What changes

  • Page reads after a load. The read after browser_navigate waited 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 (status now omits requests there instead of reporting 0).
  • Drags. The drag's document check rides on the two describe calls it already makes instead of two extra status calls, 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:

first open later opens (median per run)
main 831, 1068, 1391 ms ~545, ~568, ~650 ms
this PR 767, 743, 661 ms ~455, ~303, ~300 ms

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 no status round trips before its drop (fails on main); the navigation, Stop and same-document cases still hold.
  • Frontend browser tests (146) pass; tsc is clean.

…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.
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-13T13:37:37.485078Z a3c2570 Manual request
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review 🔄 Running since 2026-10-13T12:37:56.521739Z 4f5b6cb PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. What shall we delve into next?

Reviewed commit: 4f5b6cb565

ℹ️ 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".

…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.
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Oct 13, 2026
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

1 similar comment
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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";

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

1 similar comment
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Hooray!

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".

@danielhanchen
danielhanchen merged commit dd5ec48 into main Oct 13, 2026
@danielhanchen
danielhanchen deleted the studio-browser-faster-page-reads branch October 13, 2026 14:14
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