Skip to content

feat(chromium): expose tab strip metadata via page.tabInfo() - #42355

Closed
Yury Semikhatsky (yury-s) wants to merge 2 commits into
microsoft:mainfrom
yury-s:feat-41873
Closed

Yury Semikhatsky (yury-s) wants to merge 2 commits into
microsoft:mainfrom
yury-s:feat-41873

Conversation

@yury-s

Copy link
Copy Markdown
Member

Summary

  • New Chromium-only page.tabInfo() returns the real tab strip state (active, index, pinned, groupId, windowId) from Target.embedderData (Chrome 150+). Returns null on other browsers, older Chromium and the headless shell.
  • Concurrent calls coalesce into a single browser-wide CDP query.
  • The browser_tabs MCP tool marks the tab that is actually visible to the user.

Fixes #41873

Returns the real browser tab state (active, index, pinned, groupId,
windowId) for a page, using Target.embedderData available in Chrome 150+.
Returns null on other browsers, older Chromium and the headless shell.

Concurrent calls share a single browser-wide query. The browser_tabs MCP
tool now marks the tab that is actually visible to the user.

Fixes: microsoft#41873
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

Copy link
Copy Markdown
Contributor

Test results for "tests 1"

3 flaky ⚠️ [chromium-library] › library/video.spec.ts:736 › screencast › should work with video+trace `@chromium-ubuntu-22.04-arm-node20`
⚠️ [chromium-library] › library/tracing.spec.ts:494 › should produce screencast frames fit `@chromium-ubuntu-22.04-node24`
⚠️ [playwright-test] › ui-mode-trace.spec.ts:827 › should update state on subsequent run `@windows-latest-node22`

51359 passed, 1238 skipped


Merge workflow run.

@github-actions

Copy link
Copy Markdown
Contributor

Test results for "MCP"

66 failed
❌ [chrome] › mcp/cli-devtools.spec.ts:217 › video-start-stop @mcp-macos-latest-chrome
❌ [chrome] › mcp/cli-json.spec.ts:123 › tab-new creates a new tab and returns tab list @mcp-macos-latest-chrome
❌ [chrome] › mcp/cli-json.spec.ts:133 › tab-list lists all tabs @mcp-macos-latest-chrome
❌ [chrome] › mcp/cli-json.spec.ts:144 › tab-close closes a tab and returns remaining tabs @mcp-macos-latest-chrome
❌ [chrome] › mcp/screenshot.spec.ts:405 › browser_take_screenshot (viewport without snapshot) @mcp-macos-latest-chrome
❌ [chrome] › mcp/cli-devtools.spec.ts:217 › video-start-stop @mcp-ubuntu-latest-chrome
❌ [chrome] › mcp/cli-json.spec.ts:123 › tab-new creates a new tab and returns tab list @mcp-ubuntu-latest-chrome
❌ [chrome] › mcp/cli-json.spec.ts:133 › tab-list lists all tabs @mcp-ubuntu-latest-chrome
❌ [chrome] › mcp/cli-json.spec.ts:144 › tab-close closes a tab and returns remaining tabs @mcp-ubuntu-latest-chrome
❌ [chrome] › mcp/screenshot.spec.ts:405 › browser_take_screenshot (viewport without snapshot) @mcp-ubuntu-latest-chrome
❌ [chrome] › mcp/cli-devtools.spec.ts:217 › video-start-stop @mcp-windows-latest-chrome
❌ [chrome] › mcp/cli-json.spec.ts:123 › tab-new creates a new tab and returns tab list @mcp-windows-latest-chrome
❌ [chrome] › mcp/cli-json.spec.ts:133 › tab-list lists all tabs @mcp-windows-latest-chrome
❌ [chrome] › mcp/cli-json.spec.ts:144 › tab-close closes a tab and returns remaining tabs @mcp-windows-latest-chrome
❌ [chrome] › mcp/screenshot.spec.ts:405 › browser_take_screenshot (viewport without snapshot) @mcp-windows-latest-chrome
❌ [chromium] › mcp/cli-devtools.spec.ts:217 › video-start-stop @mcp-macos-latest-chromium
❌ [chromium] › mcp/cli-json.spec.ts:123 › tab-new creates a new tab and returns tab list @mcp-macos-latest-chromium
❌ [chromium] › mcp/cli-json.spec.ts:133 › tab-list lists all tabs @mcp-macos-latest-chromium
❌ [chromium] › mcp/cli-json.spec.ts:144 › tab-close closes a tab and returns remaining tabs @mcp-macos-latest-chromium
❌ [chromium] › mcp/screenshot.spec.ts:405 › browser_take_screenshot (viewport without snapshot) @mcp-macos-latest-chromium
❌ [chromium] › mcp/cli-devtools.spec.ts:217 › video-start-stop @mcp-windows-latest-chromium
❌ [chromium] › mcp/cli-json.spec.ts:123 › tab-new creates a new tab and returns tab list @mcp-windows-latest-chromium
❌ [chromium] › mcp/cli-json.spec.ts:133 › tab-list lists all tabs @mcp-windows-latest-chromium
❌ [chromium] › mcp/cli-json.spec.ts:144 › tab-close closes a tab and returns remaining tabs @mcp-windows-latest-chromium
❌ [chromium] › mcp/screenshot.spec.ts:405 › browser_take_screenshot (viewport without snapshot) @mcp-windows-latest-chromium
❌ [chromium] › mcp/cli-devtools.spec.ts:217 › video-start-stop @mcp-ubuntu-latest-chromium
❌ [chromium] › mcp/cli-json.spec.ts:123 › tab-new creates a new tab and returns tab list @mcp-ubuntu-latest-chromium
❌ [chromium] › mcp/cli-json.spec.ts:133 › tab-list lists all tabs @mcp-ubuntu-latest-chromium
❌ [chromium] › mcp/cli-json.spec.ts:144 › tab-close closes a tab and returns remaining tabs @mcp-ubuntu-latest-chromium
❌ [chromium] › mcp/screenshot.spec.ts:405 › browser_take_screenshot (viewport without snapshot) @mcp-ubuntu-latest-chromium
❌ [firefox] › mcp/tabs.spec.ts:36 › list initial tabs @mcp-ubuntu-latest-firefox
❌ [firefox] › mcp/tabs.spec.ts:47 › list first tab @mcp-ubuntu-latest-firefox
❌ [firefox] › mcp/tabs.spec.ts:81 › create new tab with url @mcp-ubuntu-latest-firefox
❌ [firefox] › mcp/tabs.spec.ts:94 › select tab @mcp-ubuntu-latest-firefox
❌ [firefox] › mcp/tabs.spec.ts:123 › close tab @mcp-ubuntu-latest-firefox
❌ [firefox] › mcp/cli-mouse.spec.ts:38 › mousewheel @mcp-windows-latest-firefox
❌ [firefox] › mcp/tabs.spec.ts:36 › list initial tabs @mcp-windows-latest-firefox
❌ [firefox] › mcp/tabs.spec.ts:47 › list first tab @mcp-windows-latest-firefox
❌ [firefox] › mcp/tabs.spec.ts:81 › create new tab with url @mcp-windows-latest-firefox
❌ [firefox] › mcp/tabs.spec.ts:94 › select tab @mcp-windows-latest-firefox
❌ [firefox] › mcp/tabs.spec.ts:123 › close tab @mcp-windows-latest-firefox
❌ [firefox] › mcp/tabs.spec.ts:36 › list initial tabs @mcp-macos-latest-firefox
❌ [firefox] › mcp/tabs.spec.ts:47 › list first tab @mcp-macos-latest-firefox
❌ [firefox] › mcp/tabs.spec.ts:81 › create new tab with url @mcp-macos-latest-firefox
❌ [firefox] › mcp/tabs.spec.ts:94 › select tab @mcp-macos-latest-firefox
❌ [firefox] › mcp/tabs.spec.ts:123 › close tab @mcp-macos-latest-firefox
❌ [msedge] › mcp/cli-devtools.spec.ts:217 › video-start-stop @mcp-windows-latest-msedge
❌ [msedge] › mcp/cli-json.spec.ts:123 › tab-new creates a new tab and returns tab list @mcp-windows-latest-msedge
❌ [msedge] › mcp/cli-json.spec.ts:133 › tab-list lists all tabs @mcp-windows-latest-msedge
❌ [msedge] › mcp/cli-json.spec.ts:144 › tab-close closes a tab and returns remaining tabs @mcp-windows-latest-msedge
❌ [msedge] › mcp/screenshot.spec.ts:405 › browser_take_screenshot (viewport without snapshot) @mcp-windows-latest-msedge
❌ [webkit] › mcp/tabs.spec.ts:36 › list initial tabs @mcp-macos-latest-webkit
❌ [webkit] › mcp/tabs.spec.ts:47 › list first tab @mcp-macos-latest-webkit
❌ [webkit] › mcp/tabs.spec.ts:81 › create new tab with url @mcp-macos-latest-webkit
❌ [webkit] › mcp/tabs.spec.ts:94 › select tab @mcp-macos-latest-webkit
❌ [webkit] › mcp/tabs.spec.ts:123 › close tab @mcp-macos-latest-webkit
❌ [webkit] › mcp/tabs.spec.ts:36 › list initial tabs @mcp-windows-latest-webkit
❌ [webkit] › mcp/tabs.spec.ts:47 › list first tab @mcp-windows-latest-webkit
❌ [webkit] › mcp/tabs.spec.ts:81 › create new tab with url @mcp-windows-latest-webkit
❌ [webkit] › mcp/tabs.spec.ts:94 › select tab @mcp-windows-latest-webkit
❌ [webkit] › mcp/tabs.spec.ts:123 › close tab @mcp-windows-latest-webkit
❌ [webkit] › mcp/tabs.spec.ts:36 › list initial tabs @mcp-ubuntu-latest-webkit
❌ [webkit] › mcp/tabs.spec.ts:47 › list first tab @mcp-ubuntu-latest-webkit
❌ [webkit] › mcp/tabs.spec.ts:81 › create new tab with url @mcp-ubuntu-latest-webkit
❌ [webkit] › mcp/tabs.spec.ts:94 › select tab @mcp-ubuntu-latest-webkit
❌ [webkit] › mcp/tabs.spec.ts:123 › close tab @mcp-ubuntu-latest-webkit

8076 passed, 1361 skipped


Merge workflow run.

@github-actions

Copy link
Copy Markdown
Contributor

🔴 The MCP failures are caused by this PR

Hi, I'm the Playwright bot and I took a look at the failing CI. The 66 MCP failures all trace to the new (visible to user) marker this PR adds to browser_tabs output: only tabs.spec.ts / crash.spec.ts snapshots were updated, and since page.tabInfo() returns null off Chromium, the marker splits by browser and the un-updated snapshots mismatch. The tests 1 job is clean (3 flaky, 0 failed). The lone cli-mouse mousewheel failure is a pre-existing flake.

Details

Overall: renderTabsMarkdown now appends (visible to user) when tab.page.tabInfo()?.active is truthy (tools/backend/tabs.ts, tools/backend/response.ts). tabInfo() returns null on non-Chromium engines, older Chromium and the headless shell, so the marker appears only on Chromium-family channels. The snapshots weren't reconciled with that split.

Caused by this PR

  • mcp/tabs.spec.ts:36,47,81,94,123Firefox and WebKit only. The PR updated these expectations to include (visible to user), but tabInfo() returns null on non-Chromium engines, so the marker is never emitted and expected/actual diverge. They pass on Chromium (where the marker does appear), which is why Chromium isn't in this group.
  • mcp/cli-json.spec.ts:123,133,144 (tab-new / tab-list / tab-close), mcp/screenshot.spec.ts:405 (browser_take_screenshot viewport without snapshot), mcp/cli-devtools.spec.ts:217 (video-start-stop) — chrome / chromium / msedge only. These snapshots were not touched by the PR, so they still expect the old - N: (current) [...] lines. On Chromium-family channels tabInfo().active is now truthy, the output gains (visible to user), and no longer matches. They pass on Firefox/WebKit (marker absent).

The two groups are mirror images of one root cause. Reconciling every browser_tabs / tab-list snapshot with tabInfo()'s per-browser behaviour — only expecting (visible to user) where tabInfo() reports active, and updating the un-touched cli-json / screenshot / cli-devtools Chromium snapshots — should clear all 65 of these.

Pre-existing flake / infra

  • [firefox] › mcp/cli-mouse.spec.ts:38 › mousewheel (@mcp-windows-latest-firefox) — pre-existing flake, unrelated to this PR. In the aggregated results this test failed on Firefox in 4 of 724 runs (~0.6%), on unrelated PRs (#42250 sha 3f1f652a, #42322 sha 810ce801) the PR can't be responsible for, and never failed on chrome/chromium/webkit/msedge. This PR only touches tab-strip rendering, which the mousewheel flow doesn't exercise.

Not a real failure

  • The tests 1 shard reported only 3 flaky tests (video+trace screencast, screencast frames fit, ui-mode-trace state update) and zero failures.

Triaged by the Playwright bot.

Triaged by the Playwright bot - agent run

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.

[Feature]: Expose Chromium foreground-tab and tab-strip metadata (Chrome 150+)

1 participant