#20504: fix: ESC returns to previous menu in configure wizard
commands
size: S
trusted-contributor
Cluster:
Config Redaction Improvements
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
#16301: fix: preserve custom config keys during configure wizard
by superlowburn · 2026-02-14
73.6%
#5880: fix(wizard): resume interrupted installation from last completed step
by gavinbmoore · 2026-02-01
72.3%
#13849: fix(configure): preserve custom config keys across wizard sections
by mcaxtr · 2026-02-11
71.4%
#20674: fix #20495 & #20515: configure UX + Telegram media group fixes
by neipor · 2026-02-19
70.1%
#15306: fix: explicit exit after onboarding command completes
by jeroenbaas · 2026-02-13
70.0%
#20516: fix(tui): preserve streamed text on finalize for pure text responses
by MisterGuy420 · 2026-02-19
69.7%
#6059: fix #6044
by vivganes · 2026-02-01
68.7%
#11529: fix(wizard): strip shell-style backslash escapes from workspace paths
by mcaxtr · 2026-02-07
68.5%
#13577: fix(onboard): validate workspace directory before setup steps
by mcaxtr · 2026-02-10
67.5%
#6624: Web Configure Wizard: channels + skills + agent runtime + diff + do...
by Oruga420 · 2026-02-01
67.3%