Skip to content

chore: add patch-package postinstall for node24 inquirer prompts#14959

Draft
sarayev wants to merge 7 commits into
devfrom
fix/node24-inquirer-baseui-patch-package-2
Draft

chore: add patch-package postinstall for node24 inquirer prompts#14959
sarayev wants to merge 7 commits into
devfrom
fix/node24-inquirer-baseui-patch-package-2

Conversation

@sarayev

@sarayev sarayev commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Description of changes

Adds patch-package as a dev dependency and appends it to the postinstall hook so that patches/inquirer+7.3.3.patch is applied automatically after yarn install. This fixes interactive prompt rendering (inquirer / base-ui) under Node 24.

Also updates scripts/cloud-pr.sh:

  • Adds a CLOUD_PR_SKIP_MWINIT escape hatch to skip mwinit when already authenticated or running non-interactively.
  • Removes the --debug-session-enabled flag from the aws codebuild start-build-batch call; AWS CLI v1 does not support this flag.

Issue #, if available

N/A

Description of how you validated changes

Manually verified yarn install applies the patch and prompts work under Node 24.

Checklist

  • PR description included
  • yarn test passes
  • Tests are changed or added
  • Relevant documentation is changed or added (and PR referenced)

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

sarayev added a commit that referenced this pull request Jul 16, 2026
…split e2e)

Replace the ignore-failure approach to the split-e2e wave-chain cascade
with a pure ordering fix. The sliding-window chain in
arrangeSlidingWindow places shard p to depend-on shard p-W as a
concurrency throttle; a CodeBuild build-graph edge only resolves on
predecessor SUCCESS, so a flaky shard in an early (successor-bearing)
slot STOPs its follower and fails the batch (the
w_auth_4c_auth_3c <- notifications SMS shard cascade).

Revert the arrangeSlidingWindow ignore-failure addition and instead pin
the flaky notifications SMS shard family into the terminal
(no-successor) region via the existing KNOWN_RED_SHARD_FRAGMENTS
force-terminal mechanism. Two substring fragments cover the whole
family across both Linux and Windows:
notifications_analytics_compatibility_sms (sms-1/sms-2 compatibility
shards) and notifications_sms (notifications-sms, notifications-sms-pull,
notifications-sms-update). The api_6c OpenSearch no-output timeout fix
is left untouched.

Regenerated the split specs: all five SMS shards per OS now sit in the
terminal region (index >= n-W) with zero shards depending on them, and
no ignore-failure throttle additions remain. Shard-count reconciliation
holds (linux 159, windows 133 identifiers unchanged, no
lost/duplicated). Projected makespan excl. prep: linux ~194m,
windows ~164m.

Tested: ran the generator; verified terminal placement and zero
dependents for every SMS shard; confirmed ignore-failure count is 0 in
both generated specs; confirmed the api_6c timeout fix remains.

---
Prompt: On the node24 branch (PR #14959), REPLACE the wave-chain
cascade fix: REVERT the ignore-failure change and instead fix it by
ORDERING -- place the flaky SMS/notifications shard(s) into a TERMINAL
slot of the sliding window so NO shard depends on them. Keep the api_6c
no-output timeout fix. Then push.
sarayev added a commit that referenced this pull request Jul 16, 2026
… patch-package)

Replaces the two patch-package patches with code-owned fixes so the
Node 24 behavior ships in compiled source rather than post-install
patches.

A new bootstrap shim (packages/amplify-cli/src/node24-inquirer-shim.ts)
overrides inquirer's base UI.close() to skip rl.pause() on an
already-closed readline, avoiding ERR_USE_AFTER_CLOSE on Node 24. It is
installed idempotently as the first statement of run() in index.ts, so
it ships to customers via the compiled cli-internal lib and runs before
any prompt can fire.

The e2e asciinema recorder now spawns node-pty with useConpty: false to
avoid the Windows ConPTY AttachConsole failure during PTY teardown on
Node 24, while keeping ...this.options last so callers can override.

The inquirer+7.3.3 and node-pty+1.1.0 patch files are removed since the
code fixes replace them. The patch-package devDependency and postinstall
hook are intentionally left in place as a harmless no-op (minimal
change; husky untouched).

---
Prompt: On the node24 branch (PR #14959), replace the two patch-package
patches with code-owned fixes: A1 (inquirer bootstrap shim in
amplify-cli source) + B (useConpty: false in the e2e harness), and
remove both .patch files. Then build/validate, commit, push.
sarayev added 7 commits July 16, 2026 09:45
Adds patch-package as a dependency and a postinstall hook to apply
local patches that fix inquirer/base-ui interactive prompt behavior
under Node 24. The patch file patches/inquirer+7.3.3.patch is also
included. Also updates scripts/cloud-pr.sh to add a
CLOUD_PR_SKIP_MWINIT escape hatch and drop the --debug-session-enabled
flag, which AWS CLI v1 does not support.
---
Prompt: Move stashed node24 inquirer/base-ui patch-package WIP to a
new branch, then commit and create a draft PR.
Adds the yarn.lock entries for patch-package and its transitive
dependencies (ci-info, find-yarn-workspace-root, tmp) that were
missing after patch-package was added to the root devDependencies.
Without this, CodeBuild's immutable install fails with YN0028.

---
Prompt: Fix the e2e build_linux YN0028 lockfile failure by regenerating
and committing yarn.lock.
Runs yarn dedupe to satisfy the verify_yarn_lock CI check after
adding patch-package. Deduplicates ci-info and tmp to their highest
resolved versions. No product code changes.

---
Prompt: Fix the verify_yarn_lock CI failure by running yarn dedupe and
committing yarn.lock.
…e2e)

Add a patch-package patch for node-pty@1.1.0 that wraps the
getConsoleProcessList(shellPid) call in conpty_console_list_agent.js
in a try/catch. Under Node v24 on Windows, the forked ConPTY console
list agent calls the native getConsoleProcessList, which invokes Win32
AttachConsole and can throw "AttachConsole failed" during PTY teardown.
The uncaught throw destabilizes the PTY so the nexpect harness can no
longer answer interactive prompts, causing e2e Windows shards (e.g.
geo_multi_env_searchable_datastore) to hang until the 1200s no-output
kill.

The guard falls back to [shellPid] on failure so the agent still sends
a valid console process list and exits 0, letting the parent kill()
proceed cleanly.

---
Prompt: Add a patch-package patch that fixes the Node 24 / Windows
ConPTY `AttachConsole failed` crash in node-pty, on the node24 branch,
and push it.
…re cascade

Two e2e CI-hardening fixes for the split-batch (sliding-window) workflow.

Cascade STOP: the split-e2e generator caps in-progress fan-out with an
index-offset sliding-window chain where the shard at position p
depend-on's the shard at position p-W. That edge is a pure concurrency
throttle, not a semantic dependency, but a CodeBuild build-graph edge
only resolves on predecessor SUCCESS -- so a flaky shard in an
early (successor-bearing) slot STOPs its follower and fails the batch
(e.g. a Windows node-pty/ConPTY flake in an SMS shard stopping
w_auth_4c_auth_3c). arrangeSlidingWindow now marks every shard that has
a successor (idx + windowSize < n) with ignore-failure: true, so a
flake reaches an ignorable terminal state: the batch is not failed by
it and its follower still runs. Only throttle-chain predecessors are
marked; the prep edges (build_linux/build_windows/upb) are untouched.
Regenerating adds ignore-failure to exactly n-W early shards per batch
(61 linux, 49 windows) with no reordering or depend-on changes.

Searchable no-output timeout: api_6c "recreates tables for searchable
models" provisions and re-provisions an OpenSearch
(t2.small.elasticsearch) domain, which is output-silent for well over
the default 20-minute no-output watchdog and trips "Killed the process
as no output received for 1200 Sec". amplifyPushOverride and rebuildApi
now accept an optional per-command no-output timeout, and api_6c passes
40 minutes for its two OpenSearch-bound commands. The 1-hour Jest
test-level timeout comfortably covers this.

Tested: tsc --noEmit on amplify-e2e-core passes; eslint clean on all
touched files; ran the generator and verified the generated
linux/windows specs are pure additions of ignore-failure on early-slot
shards only (combined e2e_workflow_generated.yml unchanged).

---
Prompt: On the node24 branch, implement two e2e CI-hardening fixes: (1)
fix the api_6c OpenSearch no-output timeout, and (2) fix the
cascade-STOP where a flaky shard STOPs its wave-window follower.
Investigate first, then implement, then push.
…split e2e)

Replace the ignore-failure approach to the split-e2e wave-chain cascade
with a pure ordering fix. The sliding-window chain in
arrangeSlidingWindow places shard p to depend-on shard p-W as a
concurrency throttle; a CodeBuild build-graph edge only resolves on
predecessor SUCCESS, so a flaky shard in an early (successor-bearing)
slot STOPs its follower and fails the batch (the
w_auth_4c_auth_3c <- notifications SMS shard cascade).

Revert the arrangeSlidingWindow ignore-failure addition and instead pin
the flaky notifications SMS shard family into the terminal
(no-successor) region via the existing KNOWN_RED_SHARD_FRAGMENTS
force-terminal mechanism. Two substring fragments cover the whole
family across both Linux and Windows:
notifications_analytics_compatibility_sms (sms-1/sms-2 compatibility
shards) and notifications_sms (notifications-sms, notifications-sms-pull,
notifications-sms-update). The api_6c OpenSearch no-output timeout fix
is left untouched.

Regenerated the split specs: all five SMS shards per OS now sit in the
terminal region (index >= n-W) with zero shards depending on them, and
no ignore-failure throttle additions remain. Shard-count reconciliation
holds (linux 159, windows 133 identifiers unchanged, no
lost/duplicated). Projected makespan excl. prep: linux ~194m,
windows ~164m.

Tested: ran the generator; verified terminal placement and zero
dependents for every SMS shard; confirmed ignore-failure count is 0 in
both generated specs; confirmed the api_6c timeout fix remains.

---
Prompt: On the node24 branch (PR #14959), REPLACE the wave-chain
cascade fix: REVERT the ignore-failure change and instead fix it by
ORDERING -- place the flaky SMS/notifications shard(s) into a TERMINAL
slot of the sliding window so NO shard depends on them. Keep the api_6c
no-output timeout fix. Then push.
… patch-package)

Replaces the two patch-package patches with code-owned fixes so the
Node 24 behavior ships in compiled source rather than post-install
patches.

A new bootstrap shim (packages/amplify-cli/src/node24-inquirer-shim.ts)
overrides inquirer's base UI.close() to skip rl.pause() on an
already-closed readline, avoiding ERR_USE_AFTER_CLOSE on Node 24. It is
installed idempotently as the first statement of run() in index.ts, so
it ships to customers via the compiled cli-internal lib and runs before
any prompt can fire.

The e2e asciinema recorder now spawns node-pty with useConpty: false to
avoid the Windows ConPTY AttachConsole failure during PTY teardown on
Node 24, while keeping ...this.options last so callers can override.

The inquirer+7.3.3 and node-pty+1.1.0 patch files are removed since the
code fixes replace them. The patch-package devDependency and postinstall
hook are intentionally left in place as a harmless no-op (minimal
change; husky untouched).

---
Prompt: On the node24 branch (PR #14959), replace the two patch-package
patches with code-owned fixes: A1 (inquirer bootstrap shim in
amplify-cli source) + B (useConpty: false in the e2e harness), and
remove both .patch files. Then build/validate, commit, push.
@sarayev
sarayev force-pushed the fix/node24-inquirer-baseui-patch-package-2 branch from 8c806b1 to 76859f2 Compare July 16, 2026 09:49
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.

1 participant