Skip to content

Add Dev Instance support to hydrogen dev - #4272

Open
gonzaloriestra wants to merge 5 commits into
2026-04from
gonzalo/hydrogen-dev-preview-instances
Open

gonzaloriestra wants to merge 5 commits into
2026-04from
gonzalo/hydrogen-dev-preview-instances

Conversation

@gonzaloriestra

@gonzaloriestra gonzaloriestra commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

WHY are these changes introduced?

Agents cannot discover a running hydrogen dev session or read its output after it starts in another terminal. Part of https://github.com/shop/issues-develop/issues/24321, following Shopify/cli#8976.

WHAT is this pull request doing?

Use CLI Kit's Dev Instance API to record readiness, URLs, and JSONL logs under the project's .shopify/dev/ directory. Ownership uses the command, project, environment, environment branch, and environment file, so changing the port does not allow a duplicate session.

Capture runtime output while keeping terminal rendering. Exclude session files from file-change logs to prevent feedback loops. Stop owned resources and drain queued logs on startup failure, Ctrl+C, SIGTERM, or lost ownership. Cancel tunnel polling, authentication, storefront prompts, token polling, and environment loading on shutdown or another startup failure. Persist newly created storefronts before honoring cancellation, so the next run reuses their link. Preserve the previous project config if storefront provisioning fails. Wait for startup, config writes, and resource cleanup to settle before releasing ownership. Preserve Admin API network retries when passing a cancellation signal. Restore previous Customer Account URLs if setup is cancelled after the update or saving local config fails. Key symlinked projects by the env file they actually load. Describe session discovery and lifecycle behavior in command help and update the manifest.

Pin CLI Kit to 5.0.0 for the Dev Instance API, including the bundled dependency in create-hydrogen.

HOW to test your changes?

  1. Build and link this checkout's CLI with the repository's usual setup (pnpm patch-cli after building).
  2. Run pnpm shopify hydrogen dev --path /path/to/project against an existing Hydrogen project. Read the matching instance JSON in its .shopify/dev/ directory and follow its logFile. Confirm the status becomes running and URLs appear.
  3. Change a route and visit the local server. Confirm new runtime output appears in the log while the terminal keeps its normal rendering.
  4. Start the same command in another terminal, including with a different port. It should report the existing instance.
  5. Press Ctrl+C once. The instance JSON and lock should disappear, while the JSONL log remains.

Checklist

  • I've read the Contributing Guidelines
  • I've considered possible cross-platform impacts (Mac, Linux, Windows)
  • I've added a changeset if this PR contains user-facing or functional changes
  • I've added tests to cover my changes
  • I've added or updated the documentation

@gonzaloriestra gonzaloriestra changed the title gonzalo/hydrogen dev preview instances [Feature] Add Dev Instance support to hydrogen dev Oct 26, 2026
@shopify

shopify Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Oxygen deployed a preview of your gonzalo/hydrogen-dev-preview-instances branch. Details:

Storefront Status Preview link Deployment details Last update (UTC)
Skeleton (skeleton.hydrogen.shop) ✅ Successful (Logs) Preview deployment Inspect deployment October 28, 2026 4:39 PM

Learn more about Hydrogen's GitHub integration.

@gonzaloriestra gonzaloriestra changed the title [Feature] Add Dev Instance support to hydrogen dev Add Dev Instance support to hydrogen dev Oct 27, 2026
@gonzaloriestra
gonzaloriestra force-pushed the gonzalo/hydrogen-dev-preview-instances branch 2 times, most recently from e75aaa2 to e0d0333 Compare October 27, 2026 12:46
@gonzaloriestra
gonzaloriestra marked this pull request as ready for review October 27, 2026 13:32
@gonzaloriestra
gonzaloriestra requested a review from a team as a code owner October 27, 2026 13:32
@github-actions

This comment has been minimized.

@gonzaloriestra
gonzaloriestra force-pushed the gonzalo/hydrogen-dev-preview-instances branch 8 times, most recently from 424377d to cc3eb1e Compare October 27, 2026 17:03
Comment thread packages/cli/src/lib/tunneling.test.ts Resolved
Comment thread packages/cli/docs/dev-sessions.md Resolved
Comment thread pnpm-workspace.yaml Resolved
Comment thread packages/cli/src/lib/abort.ts Resolved
@fredericoo fredericoo mentioned this pull request Oct 27, 2026
5 tasks done
@gonzaloriestra
gonzaloriestra force-pushed the gonzalo/hydrogen-dev-preview-instances branch 2 times, most recently from 6fc5a83 to 3c0abef Compare October 28, 2026 10:23
@gonzaloriestra
gonzaloriestra force-pushed the gonzalo/hydrogen-dev-preview-instances branch from 3c0abef to 2bd6625 Compare October 28, 2026 15:06
@gonzaloriestra
gonzaloriestra added this pull request to the merge queue Oct 28, 2026
@gonzaloriestra
gonzaloriestra removed this pull request from the merge queue due to a manual request Oct 28, 2026

This branch has not been deployed

No deployments
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