Skip to content

fix(desktop-browser): wait for the first page before the action records page state, inside its cancellation - #10384

Merged
waleedlatif1 merged 2 commits into
stagingfrom
fix/desktop-browser-first-page-cancellation
Nov 24, 2026
Merged

waleedlatif1 merged 2 commits into
stagingfrom
fix/desktop-browser-first-page-cancellation

Conversation

@waleedlatif1

@waleedlatif1 waleedlatif1 commented Nov 24, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Follow-up to #10382, which merged before its review round was addressed. Its first-page wait sat inside execInPage, below where tools record page state and check cancellation, which left two bugs (both flagged in #10382's review):

  • A popup snapshot still failed: captureSnapshot records the page's navigation and capture counters before calling execInPage, so the first page committing during the wait changed them and the finished snapshot was rejected as "The tab changed while its snapshot was being captured"
  • A cancelled action still ran: the wait ignored cancellation, so a browser_scroll cancelled mid-wait ran on the page once it loaded, possibly alongside newer browser work

This moves the wait into executeTool, before the execution epoch and any page state are taken:

  • Only tools that read or act in the page wait (BROWSER_TOOL_USES_PAGE, exhaustive over BrowserToolName so a new tool must choose); navigation and tab management never wait on a loading popup
  • It waits only when the agent's tab is blank and still loading, so other calls keep their timing exactly
  • waitForLoadComplete takes the execution's abort signal; the wait is raced with the cancellation promise (so its rejection is always observed) and re-checks the abort afterwards, since a cancel aborts the signal before rejecting
  • Bounded like yieldToUser: half the tool's watchdog, at most the navigation timeout
  • execInPage is back to its exact pre-fix(desktop-browser): wait for a new tab's first page before calling it blank #10382 form: a page that outlasts the bounded wait is refused as blank right away, with no second, uncancellable wait

Type of Change

  • Bug fix

Testing

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing (new tests pass the test-audit authoring gate)
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel

vercel Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
docs Skipped Skipped Nov 24, 2026 10:31pm UTC

Request Review

@greptile-apps

greptile-apps Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge.

Summary

Moves the first-page wait before page state is recorded and makes cancellation stop the wait.

  • Page tools wait for a blank tab’s first page before running.

Reviews (2) · Last reviewed commit: "fix(desktop-browser): drop the uncancell..." · Reviewed by Greptile

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All reported issues were addressed across 2 files

Reply with feedback, questions, or to request a fix.

Turn on auto-fix | Re-trigger cubic

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No issues found across 2 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Turn on auto-fix | Re-trigger cubic

@waleedlatif1
waleedlatif1 merged commit b660380 into staging Nov 24, 2026
49 of 50 checks passed
@waleedlatif1
waleedlatif1 deleted the fix/desktop-browser-first-page-cancellation branch November 24, 2026 22:35

This branch was previously deployed

1 inactive deployment
Preview — 4a87c589 Deployed Nov 24, 2026 by vercel[bot]
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