Skip to content

fix(cli): apply headless default on implicit daemon auto-start#2236

Open
inwaar wants to merge 1 commit into
ChromeDevTools:mainfrom
inwaar:fix/implicit-auto-start-headless
Open

fix(cli): apply headless default on implicit daemon auto-start#2236
inwaar wants to merge 1 commit into
ChromeDevTools:mainfrom
inwaar:fix/implicit-auto-start-headless

Conversation

@inwaar

@inwaar inwaar commented Jun 20, 2026

Copy link
Copy Markdown

The chrome-devtools start command handler defaults headless: true when not explicitly provided, but the implicit auto-start path (triggered transparently when running a tool command like new_page with no running daemon) bypassed this logic entirely. This meant the daemon would launch in headful mode by default when auto-started from a tool command, causing failures in environments without an X server (e.g., devcontainers, CI).

This PR extracts a shared getDefaultedStartArgs() helper that applies the same defaults (headless: true, isolated: true) for both the explicit start command and the implicit auto-start path.

Related: the start command handler also had a // Defaults but we do not want to affect the yargs conflict resolution. comment explaining why defaults are applied after yargs parsing rather than via the option definitions — this behavior is preserved in the extracted helper.

The `chrome-devtools start` command handler defaults headless to true
when not explicitly provided, but the implicit auto-start path (triggered
transparently when running a tool command like `new_page` with no
running daemon) bypassed this logic entirely, inheriting the MCP server's
built-in default of headless=false. This caused failures in environments
without an X server (e.g., devcontainers, CI).

Extract a shared getDefaultedStartArgs() helper that applies the same
defaults (`headless: true`, `isolated: true`) for both the explicit
`start` command and the implicit auto-start path.
@google-cla

google-cla Bot commented Jun 20, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@inwaar inwaar marked this pull request as ready for review June 20, 2026 12:29

@Lightning00Blade Lightning00Blade left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, can we add a test and fix the error from CI about the docs (npm run gen should fix them).

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