[PR #1321] [MERGED] fix(browser): release attached viewport overrides without resizing the external page #2798

Closed
opened 2026-10-17 21:10:23 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/1321
Author: @dakjdakd
Created: 10/9/2026
Status: ✅ Merged
Merged: 10/9/2026
Merged by: @N0zoM1z0

Base: main ← Head: fix/browser-attached-emulation


📝 Commits (2)

  • 1dc4442 fix(browser): retain attached scenario emulation until cleanup
  • 9319331 fix(browser): keep attached viewport overrides scoped to the scenario

📊 Changes

2 files changed (+14 additions, -10 deletions)

View changed files

📝 scripts/lib/browser-scenario-environment-e2e.mjs (+11 -5)
📝 src/browser/PlaywrightScenarioBrowser.ts (+3 -5)

📄 Description

Closes #1320.

Attached browser scenarios need their locale, timezone and device metrics to remain active during capture, then release them without changing the external page's original viewport. The initial emulation fix and same-target serialization already landed on main in a0523b37 and cfce91d4. This follow-up retains those changes and fixes the remaining viewport effect observed through the real CLI.

Playwright setViewportSize and the default CDP metrics override change the underlying visible view size. Disconnect resets the emulation values but leaves that size behind. Attached scenarios now set their dimensions through a CDP override with dontSetVisibleSize: true, so the requested viewport is observed during capture and the original viewport returns afterward. The real verifier uses the named current tool contract for SDK output validation, avoiding unrelated catalog-wide validator compilation.

Verification:

  • 20 focused browser lifecycle/provider tests pass.
  • Real headless Chrome through the public CLI and SDK-validated stdio MCP observes the selected locale, timezone, DPR and dimensions. The original environment is restored after success, initialization failure, action failure and cancellation; the external target stays open. The same-target queued/concurrent/cancelled scenario flow also passes. Sampled process-family peak: 1.77 GiB under the existing 2.25 GiB guard.
  • The full browser lane exposed the original viewport failure. Subsequent full-lane attempts reached the local process-family memory guard, so they are not claimed as successful; the focused real CLI/MCP flow above verifies the affected behavior. CI runs the complete browser lane on the final head.

No real Hopper/Ghidra claim is made for this browser-only change.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/morluto/rea/pull/1321 **Author:** [@dakjdakd](https://github.com/dakjdakd) **Created:** 10/9/2026 **Status:** ✅ Merged **Merged:** 10/9/2026 **Merged by:** [@N0zoM1z0](https://github.com/N0zoM1z0) **Base:** `main` ← **Head:** `fix/browser-attached-emulation` --- ### 📝 Commits (2) - [`1dc4442`](https://github.com/morluto/rea/commit/1dc4442d46b5858c8c80764f7fbdcded8b5b531d) fix(browser): retain attached scenario emulation until cleanup - [`9319331`](https://github.com/morluto/rea/commit/93193315be24ab87d3afe6834330dc832dc39f39) fix(browser): keep attached viewport overrides scoped to the scenario ### 📊 Changes **2 files changed** (+14 additions, -10 deletions) <details> <summary>View changed files</summary> 📝 `scripts/lib/browser-scenario-environment-e2e.mjs` (+11 -5) 📝 `src/browser/PlaywrightScenarioBrowser.ts` (+3 -5) </details> ### 📄 Description Closes #1320. Attached browser scenarios need their locale, timezone and device metrics to remain active during capture, then release them without changing the external page's original viewport. The initial emulation fix and same-target serialization already landed on main in a0523b37 and cfce91d4. This follow-up retains those changes and fixes the remaining viewport effect observed through the real CLI. Playwright `setViewportSize` and the default CDP metrics override change the underlying visible view size. Disconnect resets the emulation values but leaves that size behind. Attached scenarios now set their dimensions through a CDP override with `dontSetVisibleSize: true`, so the requested viewport is observed during capture and the original viewport returns afterward. The real verifier uses the named current tool contract for SDK output validation, avoiding unrelated catalog-wide validator compilation. Verification: - 20 focused browser lifecycle/provider tests pass. - Real headless Chrome through the public CLI and SDK-validated stdio MCP observes the selected locale, timezone, DPR and dimensions. The original environment is restored after success, initialization failure, action failure and cancellation; the external target stays open. The same-target queued/concurrent/cancelled scenario flow also passes. Sampled process-family peak: 1.77 GiB under the existing 2.25 GiB guard. - The full browser lane exposed the original viewport failure. Subsequent full-lane attempts reached the local process-family memory guard, so they are not claimed as successful; the focused real CLI/MCP flow above verifies the affected behavior. CI runs the complete browser lane on the final head. No real Hopper/Ghidra claim is made for this browser-only change. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-17 21:10:23 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
morluto/rea#2798
No description provided.