Repository navigation
fix(browser): release attached emulation overrides - #3778
Merged
Merged
Conversation
…ice-worker-block-3752
…ice-worker-block-3752
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
Contributor
[Medium impact] The PR appears safe to merge; no blocking issue remains. SummaryAdds
Diagram%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Create environment owner] --> B[Apply environment settings]
B --> C[Run scenario or report failure]
C --> D[Wait for pending application]
D --> E[Reset owned overrides]
E -->|All resets succeed| F[Detach session]
F --> G[Disconnect browser]
E -->|Reset fails and resources remain live| H[Retain owner for retry]
E -->|Page closed or browser disconnected| I[Release terminal owner]
Reviews (3) · Last reviewed commit: "Merge remote-tracking branch 'origin/mai..." · Reviewed by Greptile |
This was referenced Oct 15, 2026
2 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:fastnpm run build:cached(fresh compile)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.14d9e2525merged latest main59f528f0e; 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 155browser / real-browserpassed. Greptile reviewed this exact head at 5/5 with no blocking issue.Closes #3752