Skip to content

Wait for page discovery after sharing an existing browser tab - #346638

Merged
Kyle Cutler (kycutler) merged 1 commit into
mainfrom
kycutler/341248-browser-openbrowserpage-fails-with-page
Nov 6, 2026
Merged

Kyle Cutler (kycutler) merged 1 commit into
mainfrom
kycutler/341248-browser-openbrowserpage-fails-with-page

Conversation

@kycutler

Copy link
Copy Markdown
Collaborator

openBrowserPage → "Yes, share" called getSummary, which scans once and threw Page "…" not found before Playwright registered the newly shared page. It now uses waitForPageAndGetSummary(..., OPEN_PAGE_READY_TIMEOUT_MS), like new pages.

Also, convertToolCallResult now adds the error message as a text block when a failed result has no content, so Claude no longer sees only "Unknown error".

Tests: ./scripts/test.sh --run openBrowserTool.test.ts --run claudeClientToolResult.test.ts pass; eslint clean.

Fixes #341248

openBrowserPage called getSummary right after sharing an existing tab,
which scans once and failed with 'Page not found' before Playwright had
registered the page. Use waitForPageAndGetSummary like new pages do.

Also surface a client tool's error message to Claude when the result has
no content, instead of the SDK's generic 'Unknown error'.

Ref: #341248

Co-authored-by: Copilot <[email protected]>
Copilot AI balanced review requested due to automatic review settings November 6, 2026 20:15

Copilot AI 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.

🟢 Approval recommended

No active review issues require resolution.

No open issues 🎉

What changed in this PR

Addresses #341248 by waiting for Playwright to discover an existing browser tab after sharing it and preserving error details in Claude client-tool results.

Changes:

  • Uses the existing page-readiness wait and timeout before returning a newly shared tab’s summary.
  • Adds error-message text when a tool result has no content.
  • Adds regression tests for both behaviors.
File Description
src/​vs/​workbench/​contrib/​browserView/​test/​electron-browser/​tools/​openBrowserTool.test.ts Tests the readiness wait after sharing an existing tab.
src/​vs/​workbench/​contrib/​browserView/​electron-browser/​tools/​openBrowserTool.ts Waits for page discovery before retrieving the shared tab’s summary.
src/​vs/​platform/​agentHost/​test/​node/​clientTools/​claudeClientToolResult.test.ts Tests error-message fallback for empty tool results.
src/​vs/​platform/​agentHost/​node/​claude/​clientTools/​claudeClientToolResult.ts Preserves error messages as text when result content is empty.

Review effort: Balanced

@vs-code-engineering

Copy link
Copy Markdown
Contributor

📬 CODENOTIFY

The following users are being notified based on files changed in this PR:

TylerLeonhardt

Matched files:

  • src/vs/platform/agentHost/node/claude/clientTools/claudeClientToolResult.ts

Joaquín Ruales (@jruales)

Matched files:

  • src/vs/workbench/contrib/browserView/electron-browser/tools/openBrowserTool.ts
  • src/vs/workbench/contrib/browserView/test/electron-browser/tools/openBrowserTool.test.ts

@kycutler
Kyle Cutler (kycutler) merged commit 99baac4 into main Nov 6, 2026
53 checks passed
@kycutler
Kyle Cutler (kycutler) deleted the kycutler/341248-browser-openbrowserpage-fails-with-page branch November 6, 2026 23:48
@vs-code-engineering vs-code-engineering Bot added this to the 1.146.0 milestone Nov 6, 2026
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.

Browser: openBrowserPage fails with 'Page not found' after choosing "Yes, share" on an existing tab; agent only sees 'Unknown error'

3 participants