← Back to PRs

#20504: fix: ESC returns to previous menu in configure wizard

by MisterGuy420 open 2026-02-19 01:20 View on GitHub →
commands size: S trusted-contributor
Fixes #20495 ## What changed - Modified function in to throw instead of a generic error when ESC is pressed - This allows the existing try-catch block in to catch the cancellation and continue to the next menu iteration instead of exiting the entire wizard ## AI-assisted contribution - This fix was generated by an AI agent (OpenClaw cron: gh-issues-fix) - Testing depth: validated with pnpm build && pnpm tsgo - The fix addresses the root cause described in the issue by making ESC return to the previous menu instead of quitting the whole configure program <!-- greptile_comment --> <h3>Greptile Summary</h3> Changed `guardCancel` to throw `WizardCancelledError` instead of generic `Error` when ESC is pressed during wizard prompts, ensuring proper error handling by the catch block in `runConfigureWizard` - Imports `WizardCancelledError` from `../wizard/prompts.js` - Updates `guardCancel` to throw specific error type that the wizard's try-catch expects - Renames parameter from `runtime` to `_runtime` (underscore prefix suggests unused, but function still calls it) <h3>Confidence Score: 2/5</h3> - This PR has a critical logic error that prevents the fix from working as intended - The fix correctly changes the error type to `WizardCancelledError`, but the code still calls `_runtime.exit(0)` before throwing, which means the thrown error is unreachable and the process exits immediately with code 0 rather than being caught by the try-catch handler - src/commands/onboard-helpers.ts requires attention - remove the `_runtime.exit(0)` call <sub>Last reviewed commit: 2ce941b</sub> <!-- greptile_other_comments_section --> <!-- /greptile_comment -->

Most Similar PRs