Skip to content

Honor GSTACK_CHROMIUM_PATH on the headless launch and setup paths#1633

Open
ryanlaiwy wants to merge 1 commit into
garrytan:mainfrom
ryanlaiwy:honor-chromium-path-headless
Open

Honor GSTACK_CHROMIUM_PATH on the headless launch and setup paths#1633
ryanlaiwy wants to merge 1 commit into
garrytan:mainfrom
ryanlaiwy:honor-chromium-path-headless

Conversation

@ryanlaiwy
Copy link
Copy Markdown

Problem

GSTACK_CHROMIUM_PATH lets you point gstack at a custom Chromium binary. The headed path (launchPersistentContext) already honors it, but two paths ignored it:

  • BrowserManager's headless chromium.launch() — a custom binary was used in headed mode only.
  • setup's ensure_playwright_browser self-test — always launched Playwright's bundled Chromium.

On NixOS the bundled chrome-headless-shell can't run (it expects /lib64/ld-linux-x86-64.so.2, absent on a Nix filesystem), so ./setup bails before registering sub-skills and headless browse fails — even with GSTACK_CHROMIUM_PATH set to a working system Chromium.

Change

  • Pass executablePath on the headless chromium.launch() when GSTACK_CHROMIUM_PATH is set.
  • ensure_playwright_browser verifies that same binary (with --no-sandbox) when the env var is set.

Both are no-ops when GSTACK_CHROMIUM_PATH is unset — zero impact on normal installs.

Testing

Verified on a NixOS-style container (Replit): with GSTACK_CHROMIUM_PATH pointed at the system Chromium, ./setup completes and registers all sub-skills, and headless browse navigates and screenshots correctly. Without the env var, behavior is unchanged.

🤖 Generated with Claude Code

The headed path (launchPersistentContext) already passes executablePath
from GSTACK_CHROMIUM_PATH, but the headless chromium.launch() ignored it,
so a custom Chromium was used in headed mode only. setup's
ensure_playwright_browser self-test had the same gap — it always launched
Playwright's bundled Chromium.

On NixOS the bundled chrome-headless-shell can't run (it expects
/lib64/ld-linux-x86-64.so.2, absent on a Nix filesystem), so ./setup
bails before registering sub-skills and headless browsing fails even when
GSTACK_CHROMIUM_PATH points at a working system Chromium.

Pass executablePath on the headless launch, and teach
ensure_playwright_browser to use the same binary. No-op when the env var
is unset — zero impact on normal installs.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@jbetala7
Copy link
Copy Markdown
Contributor

The setup self-test half looks useful, but the browser-manager.ts half needs to pick up the same baked-extension guard that #1614 added after review.

Right now this adds executablePath: process.env.GSTACK_CHROMIUM_PATH to the headless/off-screen launch path while leaving the if (extensionsDir) block unconditional. With BROWSE_EXTENSIONS_DIR plus a GBrowser/GStack Browser binary that already has the extension baked in, that path still passes --disable-extensions-except / --load-extension and can double-load the extension. launchHeaded() already avoids that via isCustomChromium(), and #1614 now mirrors that guard for the headless path.

Can this either rebase/port #1614's isCustomChromium() guard and add a regression for GSTACK_CHROMIUM_KIND=custom-extension-baked or a GBrowser path, or split this down to just the setup verification change if #1614 remains the canonical browser-manager PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants