Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat(browse): add GSTACK_HEADED_NOGPU opt-in for headed mode on virtual displays (Xvnc/Xvfb)#1915

Open
auroracapital wants to merge 1 commit into
garrytan:main from
auroracapital:fix/headed-nogpu-virtual-display
Open

feat(browse): add GSTACK_HEADED_NOGPU opt-in for headed mode on virtual displays (Xvnc/Xvfb) #1915
auroracapital wants to merge 1 commit into
garrytan:main from
auroracapital:fix/headed-nogpu-virtual-display

Conversation

@auroracapital

@auroracapital auroracapital commented Jun 8, 2026

Copy link
Copy Markdown

Problem

On headless Linux servers using virtual displays (Xvnc, Xvfb), Playwright's bundled Chromium crashes with SIGTRAP during GPU process initialization when headed mode is requested. This makes /browse --headed completely non-functional on remote Linux dev boxes.

Root cause: virtual display drivers (Xvnc, Xvfb) have no real GPU. Chromium's GPU process init path raises SIGTRAP when it can't initialize hardware acceleration, crashing the browser before the page loads.

Solution

Add an opt-in env var GSTACK_HEADED_NOGPU=1 that appends GPU-disabling Chromium flags at launch:

  • --disable-gpu
  • --disable-gpu-compositing
  • --disable-software-rasterizer
  • --disable-dev-shm-usage

This bypasses the GPU process entirely, keeping headed mode alive on VNC-backed virtual displays.

Usage

GSTACK_HEADED_NOGPU=1 browse --headed https://example.com

Or export it for a session:

export GSTACK_HEADED_NOGPU=1
browse --headed ...

Safety

  • Opt-in only — users on real displays (macOS, physical Linux desktop) are unaffected; they never set this flag
  • No behavioral change when the env var is unset (default)
  • Tested on Amazon Linux 2023 aarch64 with Xvnc :2 using system Brave 148 as the Chromium path

Context

This came up while using gstack /browse --headed on an EC2 dev box with a VNC display for interactive browser automation. The fix unblocks headed mode for the growing number of users running Claude Code on remote Linux servers.

On headless virtual displays (Xvnc/Xvfb on EC2/Linux), Playwright's
bundled Chromium crashes at GPU process init (SIGTRAP) when headed mode
is requested. This renders headed browse completely unusable on remote
Linux servers.
Add GSTACK_HEADED_NOGPU=1 env opt-in that appends --disable-gpu,
--disable-gpu-compositing, --disable-software-rasterizer, and
--disable-dev-shm-usage to launch args so the GPU process is bypassed
entirely. This keeps headed mode alive on VNC-backed displays without
affecting users on real displays who don't set the flag.

trunk-io Bot commented Jun 8, 2026

Copy link
Copy Markdown

Merging to main in this repository is managed by Trunk.

  • To merge this pull request, check the box to the left or comment /trunk merge below.

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

Copy link
Copy Markdown
Author

/trunk merge

trunk-io[bot] reacted with thumbs down emoji

trunk-io Bot commented Jun 9, 2026

Copy link
Copy Markdown

An error occurred while submitting your PR to the queue: Only users that are a part of this repo's Trunk organization or have write permissions to the repo can submit a PR to the queue

Copy link
Copy Markdown
Contributor

Directionally useful for VNC-backed boxes. Two notes:

1. Coverage gap on the handoff path. The NOGPU flags are only added to the launchArgs array in launchHeaded() (~L439). The headless→headed handoff relaunch builds its own launchArgs = ['--hide-crash-restore-bubble'] (~L1559) and never gets them, so a /browse session that starts headless and is later promoted to headed on a Xvnc/Xvfb display would still SIGTRAP — the exact crash this PR targets. Adding the same GSTACK_HEADED_NOGPU block to that second launchArgs would close the path.

2. --disable-dev-shm-usage isn't a GPU flag — it controls /dev/shm usage, not GPU init. Fine to keep (it's a common headless-stability flag), but it widens the opt-in beyond what the env var name advertises; a one-line note in the comment/docs would help.

Coordination: #1933 adds a general GSTACK_CHROMIUM_ARGS passthrough that could express these GPU flags directly, and both it and #1968 touch this same launch path — flagging for merge-order / possible consolidation.

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

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /