v1.42.1.1 fix wave: browse launch hardening (2 bug fixes + headed exit-code wiring)#1629
Open
garrytan wants to merge 1 commit into
Open
v1.42.1.1 fix wave: browse launch hardening (2 bug fixes + headed exit-code wiring)#1629garrytan wants to merge 1 commit into
garrytan wants to merge 1 commit into
Conversation
…t-code wiring) Bundles two browse launch-path bug fixes plus the missing exit-code wiring that made the second fix actually work end-to-end. PR #1617 — Chromium sandbox policy at all 3 launch sites - shouldEnableChromiumSandbox() centralizes the Win32 / CI / CONTAINER / root heuristic that previously lived only in the headless launch path. - launch(), launchHeaded() / launchPersistentContext(), and handoff() now share the policy so Playwright stops auto-adding --no-sandbox on every headed launch and the yellow "unsupported command-line flag" infobar disappears on macOS and Linux dev. PR #1626 — clean Cmd+Q stops triggering supervisor respawn - resolveDisconnectCause(browser) reads the underlying Chromium ChildProcess exitCode + signalCode (with a 1s wait for an async exit event) to distinguish clean user-quit from crash. - handleChromiumDisconnect(browser) dispatches the headless launch() disconnect path: clean → exit(0), crash → exit(1). - launchHeaded() disconnect handler resolves cause inline and computes exitCode = 0 (clean) | 2 (crash) before forwarding to onDisconnect. - handoff() disconnect handler uses the same shared helper. Codex-caught propagation fix (this commit, not in either source PR) - BrowserManager.onDisconnect signature widened to accept an exitCode argument. Without this, launchHeaded's locally-computed exit code was dropped before reaching server.ts. - browse/src/server.ts:688 — onDisconnect callback now forwards the resolved code: (code) => activeShutdown?.(code ?? 2). The ?? 2 preserves legacy crash semantics for callers that invoke onDisconnect without an explicit code. Tests - browse/test/browser-manager-unit.test.ts goes from 2 → 17 tests. - 6 new tests pin shouldEnableChromiumSandbox across darwin / linux / win32 / CI / CONTAINER / root. - 7 new tests pin resolveDisconnectCause across already-exited, async-exit, SIGSEGV, SIGKILL, and null-browser. - 2 new tests (this commit) pin the onDisconnect(exitCode) propagation contract including the exact server.ts forwarding callback shape so a refactor that drops the forward fails CI before the user-visible respawn bug returns. Refs PRs #1617, #1626; companion gbrowser PR #23.
This was referenced May 20, 2026
E2E Evals: ✅ PASS7/7 tests passed | $1.47 total cost | 12 parallel runners
12x ubicloud-standard-8 (Docker: pre-baked toolchain + deps) | wall clock ≈ slowest suite |
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.
Summary
Bundles two open browse launch-path bug fix PRs into one fix-wave landing at v1.42.1.1, plus the missing exit-code wiring that Codex caught in PR #1626 (which made the second fix not actually work end-to-end without this change).
Bundled source PRs (left open as fallbacks until this merges):
garrytan/headed-sandbox-on(Chromium sandbox at all 3 launch sites)garrytan/clean-quit-no-restart(Cmd+Q resolves clean-vs-crash from Chromium ChildProcess)Companion (gbrowser side): garrytan/gbrowser#23 — gbd's HealthMonitor reads the exit code this PR now correctly emits.
What this fixes for the user
--no-sandboxinfobar on every headed Chromium launch on macOS and Linux dev — gone. All three launch sites (launch,launchHeaded/launchPersistentContext,handoff) now shareshouldEnableChromiumSandbox()so Playwright stops auto-adding--no-sandboxwhen the sandbox is actually wanted.SIGKILL/SIGSEGV/ OOM still exit 2 (headed) / 1 (headless + handoff) so supervisors still restart on backoff.Codex-caught fix (the difference between this PR and just rebasing #1626)
PR #1626 as written doesn't actually fix the headed-mode respawn bug —
browse/src/server.ts:684hardcodesbrowserManager.onDisconnect = () => activeShutdown?.(2)and the locally-computed clean exit code (0) insidelaunchHeaded()was dropped on the floor bythis.onDisconnect()having no parameter.This PR adds the missing wire:
BrowserManager.onDisconnectsignature widened to((exitCode?: number) => void | Promise<void>) | nulllaunchHeaded()disconnect handler now callsthis.onDisconnect(exitCode)browse/src/server.ts:688—(code) => activeShutdown?.(code ?? 2)(the?? 2preserves legacy crash semantics)browse/test/browser-manager-unit.test.tspins the full propagation contract so a refactor that drops the forward fails CI before the user-visible respawn bug returns.Tests
bun test browse/test/browser-manager-unit.test.ts→ 17 tests, all green (up from 2 baseline; 6 forshouldEnableChromiumSandbox, 7 forresolveDisconnectCause, 2 foronDisconnect(exitCode)propagation)Test plan
bun test browse/test/browser-manager-unit.test.ts— 17/17 passbun run dev launchheaded, Cmd+Q,echo $?reports0kill -9 <chromium pid>,echo $?reports2/land-and-deploy🤖 Generated with Claude Code