v1.57.4.0 fix(setup): Playwright Chromium failure becomes best-effort warn, not exit 1#1900
Conversation
|
Merging to
After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here |
|
Verified — this is the Playwright carve-out from #1883 and it's correct. On |
396ab7e to
0a6c5bf
Compare
…ability
setup used to interleave trivial filesystem ops, expensive compute,
settings.json mutations, and network/sudo steps in whatever order the
script grew. A Playwright Chromium download failing at step 2 would
abort before skills got registered at step 4, hooks landed at step 10,
or migrations ran at step 8.
This commit groups work by where failures actually come from:
Phase A — filesystem (always succeeds): ~/.gstack/, welcome, GBrain detection
Phase B — local compute (low fail): bun build, skill linking, migrations, regen
Phase C — settings.json mutation (medium fail, reversible): team-mode + plan-tune hooks
Phase D — external network/sudo/package managers (highest fail): coreutils, font, Playwright
Each phase is bracketed with a header comment; steps within are
renumbered (A1, A2, B1, B2a...).
The biggest behavior shift is the GBrain detect/regen split that the
new order requires: detection moves to A3 (filesystem scan only, no
dependencies), regen moves to B6 (runs after the binary is built and
skill docs are generated). Detection persists to
~/.gstack/gbrain-detection.json so B6 can read it.
A safety guard for that split: when gstack-gbrain-detect exits non-zero,
A3 removes both the temp file AND any pre-existing detection file from a
prior successful run. Without the guard, a stale "ok" detection file
would survive a failed detect and silently apply ~250 tokens of overhead
per planning skill to a user whose gbrain may no longer be installed.
Behavior preservation:
- bun_cmd routing in link_{codex,factory,opencode}_skill_dirs is
unchanged (still buggy here). The fix is in garrytan#1898.
- gen:skill-docs:user still pipes through `tail -3` in B6 (still buggy
here). The fix is in garrytan#1898.
- Playwright Chromium install/verify in D3 still exits 1 on failure
(unchanged). The warn-don't-exit conversion is in garrytan#1900 and
coordinates with garrytan#1838.
Splitting those keeps this PR reviewable as "a move plus the gbrain
split that the move requires," per @jbetala7's request on garrytan#1883.
0a6c5bf to
0668240
Compare
… exit 1 Replaces both `exit 1` paths in the Playwright install/verify block with a $_PW_FAIL_REASON accumulator that prints a named warning to stderr and returns control. Previously a Chromium download failure (network blip, locked-down corporate machine, missing Node.js on Windows) would abort ./setup mid-run with no skills registered, no hooks installed, no migrations applied — and a re-run would start over from the top. Now the failure only disables browser-driven features (/qa, /design-review, make-pdf, sidebar, /pair-agent); skills, hooks, and migrations land normally. The warning names which sub-step failed (chromium-install / windows-no-node / windows-node-modules / post-install-launch) so users and bug reports can be specific, and tells the user to re-run ./setup to retry just this step. Tests (5) exercise the actual block from setup with stubbed ensure_playwright_browser and bunx, simulate install + post-install failures, and assert the script exits 0 with the named warning. One side-by-side test inlines the OLD bug shape and confirms it returned non-zero, so the exit-code difference is proven, not just asserted. Coordinates with garrytan#1838 (pins Playwright install version): both touch the same code block, so whichever lands first needs the other to rebase. The changes are complementary — garrytan#1838 fixes which Chromium build gets installed; this PR fixes what happens when the install fails. Carved out from garrytan#1883 per @jbetala7's review request.
0668240 to
12c0b89
Compare
Carving out the Playwright-warn change from #1883 as a focused PR per
@jbetala7's review request. Coordinated with #1838 — see "Relationship
to #1838" below.
Problem
The Playwright Chromium install in
./setupis the riskiest step in thewhole script: it needs network, talks to a Microsoft CDN, on Windows it
bounces through Node.js because of a Bun pipe bug, and on locked-down
corporate machines it may not even be allowed to run. Until now, any
failure in that step was fatal (
exit 1) and aborted./setupmid-run,before skills got registered, hooks got installed, or migrations ran.
A re-run would start over from the top, hit the same Chromium download
issue, fail the same way. There was no clean way to get a working gstack
install on a machine where Chromium was unreachable, even though every
non-browser feature would have worked fine.
Fix
Replace both
exit 1paths in the Playwright install/verify block with a$_PW_FAIL_REASONaccumulator. On failure, the script:chromium-install,windows-no-node,windows-node-modules, orpost-install-launch./qa,/design-review,make-pdf, sidebar,/pair-agent).node -e "require('playwright')"verify command../setupto retry — at which point only thePlaywright step needs to succeed, because skills, hooks, and
migrations are already in place from earlier steps.
All other setup behavior is unchanged. The script exits 0 in the
warn-only path and the user gets a usable gstack install minus browser
features.
Tests
test/setup-playwright-warn-not-exit.test.ts— 5 tests, exit-code-pathexercised (not source-grep):
exit 1reachable from the block — source-anchored regexon the live block extracted from
setup._PW_FAIL_REASONaccumulator + named warning present — samesource-anchored extraction.
block in bash with stubbed
ensure_playwright_browser(always fails)and stubbed
bunx(fails). Asserts script exits 0, stderr containswarning: Playwright Chromium is unavailable (chromium-install),and the retry hint fires.
exit 1path with the same stubs and confirms it returned non-zero. Proves
the exit-code difference is real, not a quoting illusion.
bunxsucceeds,ensure_playwright_browserkeeps failing — assertsexit 0 with reason
post-install-launch.Test plan
bun test test/setup-playwright-warn-not-exit.test.ts— 5 passbun test test/setup-*.test.ts— 70 passbash -n setup— syntax OK_PW_FAIL_REASONvalueRelationship to #1838
This PR and #1838 modify the same Playwright block in
setupbutsolve non-overlapping problems:
bunx playwright installto the bundledplaywright/package.jsonversion so the install-time and runtime versions don't drift) + tightensensure_playwright_browser()to assertexecutablePath()exists.exit 1→_PW_FAIL_REASONaccumulator + named warning, no abort).Both can land — they're complementary. Whichever lands first, the other
needs a small rebase. I'm happy to rebase this PR onto #1838 if the
maintainers prefer that order (likely the cleaner sequence, since #1838
is closer to merging).
Relationship to #1883
This PR is the "(2) Playwright warn-don't-exit" split @jbetala7 asked
for on #1883. The third split — the phase reorder — will be a separate
PR against fresh
mainwith an issue describing the failure modes itfixes. #1883 stays open until all three splits are visible, then I'll
close it with links to all three.
Sibling: #1898 (the two bug fixes, opened first).