[PR #3778] [MERGED] fix(browser): release attached emulation overrides #5892

Closed
opened 2026-10-31 01:10:14 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

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

Base: main ← Head: fix/windows-edge-service-worker-block-3752


📝 Commits (7)

  • dd9b601 fix(browser): release attached emulation overrides
  • 3c92c72 Merge remote-tracking branch 'origin/main' into fix/windows-edge-service-worker-block-3752
  • 7209bec fix(browser): preserve unowned environment state
  • a6dfa9c Merge remote-tracking branch 'origin/main' into fix/windows-edge-service-worker-block-3752
  • d145821 fix(browser): coordinate attached environment cleanup
  • 151ccc9 Merge remote-tracking branch 'origin/main' into fix/windows-edge-service-worker-block-3752
  • 14d9e25 Merge remote-tracking branch 'origin/main' into fix/windows-edge-service-worker-block-3752

📊 Changes

2 files changed (+466 additions, -46 deletions)

View changed files

📝 src/browser/PlaywrightScenarioBrowser.test.ts (+270 -3)
📝 src/browser/PlaywrightScenarioBrowser.ts (+196 -43)

📄 Description

Sequential attached-browser scenarios could fail before navigation because Chromium retained the preceding scenario's target-scoped locale override after REA disconnected. For example, the Windows Edge workflow completed its environment scenario, then the later service-worker scenario failed with Emulation.setLocaleOverride: Another locale override is already in effect.

This change gives attached environment mutations an explicit cleanup owner. It restores timezone and locale, clears device metrics, disables media emulation, and only then releases the CDP session and browser transport. Cleanup waits for an in-flight environment command before reading its ownership flags. Successful resets are retained across retries; a live target with unresolved state remains owned, while a destroyed target or disconnected browser releases an owner that cannot make further progress. An override is marked owned only after application succeeds, so REA does not clear caller-owned state when acquisition fails.

Validation:

  • npm run test:local -- src/browser/PlaywrightScenarioBrowser.test.ts (15/15, including pending-command cancellation and terminal target/transport loss)
  • npm run check:fast
  • npm run build:cached (fresh compile)
  • Real Windows Edge 154 full environment/storage/service-worker prefix passed with external-target preservation and Job0.
  • Exact review fix: real environment workflow passed CLI, stdio MCP, concurrent captures, initialization/action failures, cancellation, restoration, and external-target preservation; 59.60 s Job wall, 45.25 sampled CPU seconds, 969,183,232-byte Job peak, 1,205,497,856-byte sampled family working-set peak, Job0.
  • Exact real-browser head 151ccc960: two sequential public CLI locale/timezone scenarios passed on one external Edge target; 53.49 s Job wall, 45.42 sampled CPU seconds, 869,965,824-byte Job peak, 1,138,589,696-byte sampled family working-set peak, 12,068 parsed CLI JSON bytes, Job0.
  • Final PR head 14d9e2525 merged latest main 59f528f0e; the intervening main delta only changes JavaScript analysis files, and the browser source/test blobs are unchanged. Focused 15/15, check:fast, fresh build, all five CI shards, package/portable gates, and Chrome 155 browser / real-browser passed. Greptile reviewed this exact head at 5/5 with no blocking issue.
  • The same production verifier also passed locally under Chrome 150 in 177.20 s wall, 133.30 CPU seconds, and 557,496 KiB maximum resident set. An earlier Chrome 155 CI attempt failed once after environment/storage, then passed on the final head without code changes; it is treated as a runner/browser transient rather than fixed in this PR.
  • Three earlier independent six-round lanes passed (18/18). Full agent-token cost and an equivalent successful baseline were not measured, so no speed or token reduction is claimed.

Closes #3752


🔄 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/3778 **Author:** [@N0zoM1z0](https://github.com/N0zoM1z0) **Created:** 10/15/2026 **Status:** ✅ Merged **Merged:** 10/15/2026 **Merged by:** [@N0zoM1z0](https://github.com/N0zoM1z0) **Base:** `main` ← **Head:** `fix/windows-edge-service-worker-block-3752` --- ### 📝 Commits (7) - [`dd9b601`](https://github.com/morluto/rea/commit/dd9b60143d054b68ddb7af504dc0490dc33da01c) fix(browser): release attached emulation overrides - [`3c92c72`](https://github.com/morluto/rea/commit/3c92c7251e5f3fe30182ae4ad0c0c0e447c8d49a) Merge remote-tracking branch 'origin/main' into fix/windows-edge-service-worker-block-3752 - [`7209bec`](https://github.com/morluto/rea/commit/7209bec1e4fe2a28b55c11a4c1532b45083f465c) fix(browser): preserve unowned environment state - [`a6dfa9c`](https://github.com/morluto/rea/commit/a6dfa9ca029e5775b56b3221510ace9f4480e602) Merge remote-tracking branch 'origin/main' into fix/windows-edge-service-worker-block-3752 - [`d145821`](https://github.com/morluto/rea/commit/d145821e258ce697a6332537cc06b303f1e5d040) fix(browser): coordinate attached environment cleanup - [`151ccc9`](https://github.com/morluto/rea/commit/151ccc96034585d2ccaf53284bf2e37086a82860) Merge remote-tracking branch 'origin/main' into fix/windows-edge-service-worker-block-3752 - [`14d9e25`](https://github.com/morluto/rea/commit/14d9e2525a5958bbd4de058f6bba6b98bd130159) Merge remote-tracking branch 'origin/main' into fix/windows-edge-service-worker-block-3752 ### 📊 Changes **2 files changed** (+466 additions, -46 deletions) <details> <summary>View changed files</summary> 📝 `src/browser/PlaywrightScenarioBrowser.test.ts` (+270 -3) 📝 `src/browser/PlaywrightScenarioBrowser.ts` (+196 -43) </details> ### 📄 Description Sequential attached-browser scenarios could fail before navigation because Chromium retained the preceding scenario's target-scoped locale override after REA disconnected. For example, the Windows Edge workflow completed its environment scenario, then the later service-worker scenario failed with `Emulation.setLocaleOverride: Another locale override is already in effect`. This change gives attached environment mutations an explicit cleanup owner. It restores timezone and locale, clears device metrics, disables media emulation, and only then releases the CDP session and browser transport. Cleanup waits for an in-flight environment command before reading its ownership flags. Successful resets are retained across retries; a live target with unresolved state remains owned, while a destroyed target or disconnected browser releases an owner that cannot make further progress. An override is marked owned only after application succeeds, so REA does not clear caller-owned state when acquisition fails. Validation: - `npm run test:local -- src/browser/PlaywrightScenarioBrowser.test.ts` (15/15, including pending-command cancellation and terminal target/transport loss) - `npm run check:fast` - `npm run build:cached` (fresh compile) - Real Windows Edge 154 full environment/storage/service-worker prefix passed with external-target preservation and Job0. - Exact review fix: real environment workflow passed CLI, stdio MCP, concurrent captures, initialization/action failures, cancellation, restoration, and external-target preservation; 59.60 s Job wall, 45.25 sampled CPU seconds, 969,183,232-byte Job peak, 1,205,497,856-byte sampled family working-set peak, Job0. - Exact real-browser head `151ccc960`: two sequential public CLI locale/timezone scenarios passed on one external Edge target; 53.49 s Job wall, 45.42 sampled CPU seconds, 869,965,824-byte Job peak, 1,138,589,696-byte sampled family working-set peak, 12,068 parsed CLI JSON bytes, Job0. - Final PR head `14d9e2525` merged latest main `59f528f0e`; the intervening main delta only changes JavaScript analysis files, and the browser source/test blobs are unchanged. Focused 15/15, `check:fast`, fresh build, all five CI shards, package/portable gates, and Chrome 155 `browser / real-browser` passed. Greptile reviewed this exact head at 5/5 with no blocking issue. - The same production verifier also passed locally under Chrome 150 in 177.20 s wall, 133.30 CPU seconds, and 557,496 KiB maximum resident set. An earlier Chrome 155 CI attempt failed once after environment/storage, then passed on the final head without code changes; it is treated as a runner/browser transient rather than fixed in this PR. - Three earlier independent six-round lanes passed (18/18). Full agent-token cost and an equivalent successful baseline were not measured, so no speed or token reduction is claimed. Closes #3752 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-31 01:10:14 +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#5892
No description provided.