Skip to content

Fix Function replay shutdown and process cancellation - #9057

Draft
isaacroldan wants to merge 1 commit into
codex/function-replay-shared-watchfrom
codex/function-replay-shutdown
Draft

isaacroldan wants to merge 1 commit into
codex/function-replay-shared-watchfrom
codex/function-replay-shutdown

Conversation

@isaacroldan

@isaacroldan isaacroldan commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

WHY are these changes introduced?

Cancelling Function replay must stop active runner processes and queued rebuilds before replay finishes.

WHAT is this pull request doing?

Cancel active runner processes and build-lock waits, prevent queued builds from starting after cancellation, and wait for active work and watcher cleanup before the final cancellation record. Remove process abort listeners after execution. Stop the replay-local scan and startup change waiters, including when stop is called without an abort signal.

This PR follows #9108, which follows #9056. Its diff contains shutdown behavior and tests. The JSON feature and broader startup refactor remain in the preceding PRs. Preserve the readiness opt-out while adding shutdown cleanup.

How to manually test your changes?

Use a test app with a Function and a saved Function log.

  1. Run pnpm shopify app function replay --path <function-directory> --log <log-id> --json --no-input.
  2. Edit the Function to start a rebuild. Press Ctrl-C while the build or runner is active. Check that active work stops, the final record is cancelled, and the command exits with code 130.
  3. Repeat with a build waiting for another process to release .build-lock. Cancel replay, then release the lock. Check that no new build starts.
  4. Repeat without --json to check text replay. Use --no-watch --json to check single-result output.

Validation

  • 408 related Function, replay, watcher, startup, build cancellation, and dev session tests passed on the rebased head.
  • All 11 subprocess cancellation tests passed.
  • App type checking, scoped ESLint, formatting, and diff checks passed. The rebase retains the readiness opt-out and the shared startup state handling.
  • Local checks ran on macOS ARM with Node 24.22.1. Native probes use a controlled runner capture.

Checklist

  • I've considered possible cross-platform impacts (Mac, Linux, Windows)
  • I've considered possible documentation changes
  • I've considered analytics changes to measure impact
  • The change is user-facing and has changesets.

@isaacroldan
isaacroldan added this pull request to stack #9058 November 2, 2026 13:19
@github-actions github-actions Bot added the Area: @shopify/cli @shopify/cli package issues label Nov 2, 2026
@isaacroldan
isaacroldan force-pushed the codex/function-replay-shutdown branch 5 times, most recently from f8ab107 to dc6793d Compare November 3, 2026 13:06
@isaacroldan
isaacroldan force-pushed the codex/function-replay-shutdown branch 3 times, most recently from 6360547 to 6c7547f Compare November 4, 2026 12:51
@isaacroldan
isaacroldan force-pushed the codex/function-replay-shutdown branch 3 times, most recently from afa350a to e3a6834 Compare November 9, 2026 12:44
@isaacroldan
isaacroldan removed this pull request from stack #9058 November 9, 2026 12:49
@isaacroldan
isaacroldan changed the base branch from codex/function-replay-json to codex/function-replay-shared-watch November 9, 2026 12:50
@isaacroldan
isaacroldan added this pull request to stack #9109 November 9, 2026 12:50
@isaacroldan
isaacroldan force-pushed the codex/function-replay-shutdown branch from e3a6834 to 0cf67e0 Compare November 9, 2026 14:49
@isaacroldan
isaacroldan removed this pull request from stack #9109 November 9, 2026 17:12
@isaacroldan
isaacroldan force-pushed the codex/function-replay-shutdown branch from 0cf67e0 to 4333e5c Compare November 9, 2026 17:13
@isaacroldan
isaacroldan added this pull request to stack #9110 November 9, 2026 17:13

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

Area: @shopify/cli @shopify/cli package issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant