Skip to content

Allow astro preview --ignore-lock from AI agent environments - #17941

Open
matthewp wants to merge 1 commit into
mainfrom
fix/17903-preview-ignore-lock-agent-gate
Open

Allow astro preview --ignore-lock from AI agent environments#17941
matthewp wants to merge 1 commit into
mainfrom
fix/17903-preview-ignore-lock-agent-gate

Conversation

@matthewp

@matthewp matthewp commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Changes

  • astro preview --ignore-lock and astro dev --ignore-lock no longer error when an AI agent is detected (e.g. CLAUDECODE set in the environment). Agent detection only infers background mode, while --ignore-lock explicitly asks for a one-off foreground server that stop/status/logs won't track — the flag now wins and the server starts in the foreground. This unblocks Playwright's webServer (npx astro preview --ignore-lock --port <port>) when run from an agent session.
  • Agent-inferred background is dropped whenever --ignore-lock is set; an explicit --background combined with --ignore-lock still errors, unchanged.
  • Fixes astro preview --ignore-lock is refused whenever an AI agent is detected, so Playwright webServer cannot use it from an agent session #17903.

Testing

  • Added unit tests for both preview and dev that exercise the CLI path with an agent env var set (CLAUDECODE=1) plus --ignore-lock, asserting a foreground server starts and serves HTTP 200.
  • Updated getBackgroundIgnoreLockConflict tests for its new single-argument signature; the previous assertion that agent-implied background conflicts was removed, since that combination no longer errors.

Docs

  • No docs update needed: the CLI help text for --ignore-lock is unchanged and still accurate.

@changeset-bot

changeset-bot Bot commented Sep 8, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 869b3e9

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions Bot added the pkg: astro Related to the core `astro` package (scope) label Sep 8, 2026
@codspeed-hq

codspeed-hq Bot commented Sep 8, 2026

Copy link
Copy Markdown

Merging this PR will improve performance by 17.44%

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

⚡ 1 improved benchmark
✅ 20 untouched benchmarks

Performance Changes

Benchmark BASE HEAD Efficiency
many-components (markHTMLString, isHTMLString, validateProps) 11.3 ms 9.6 ms +17.44%

Tip

Curious why performance improved? Comment @codspeedbot explain why performance improved on this PR, or directly use the CodSpeed MCP with your agent.


Comparing fix/17903-preview-ignore-lock-agent-gate (869b3e9) with main (42e9188)1

Open in CodSpeed

Footnotes

  1. No successful run was found on main (8eaa4f2) during the generation of this report, so 42e9188 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@matthewp
matthewp marked this pull request as ready for review September 8, 2026 18:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pkg: astro Related to the core `astro` package (scope)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

astro preview --ignore-lock is refused whenever an AI agent is detected, so Playwright webServer cannot use it from an agent session

1 participant