Repository navigation
fix(cli): preserve alias recovery while guarding destructive suggestions - #26934
Conversation
Keep close destructive typos recoverable through declared equivalent aliases, without allowing intent for one action to unlock another destructive command. Mark the handler-proved reset, process/page teardown, relation deletion and managed rollback commands that were missing destructive suggestion metadata. Preserve accepted paths, one-edit intent, ranking and length budgets. Include live registry, parser, CLI recovery and performance-boundary regressions. Co-authored-by: kambarakun <[email protected]>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ⬇️ Low Severity of issue fixed: Low Merge Risk: ⚪ Minimal · up to No actionable merge-blocking risk is established. The change is ready for normal checks, including pending CI. Pre-merge checks |
|
ELI5
A mistyped
orchestration resumecould suggest resetting saved orchestration data. Destructive suggestions now require a close typo of that action or one of its declared equivalent verbs.What Changed
Use the registry's declared aliases to group equivalent destructive verbs, then check intent for each candidate. Add the missing destructive markers for reset, supervised worker stop/release, emulator kill/shutdown, browser tab close, managed-server rollback, and Linear relation deletion after checking their actual handlers.
Why
Marking reset alone also made
artifacts desetsuggest delete. Checking only each command's own aliases removed legitimateenvironment remov → rmrecovery. Declared equivalence keeps that recovery without letting reset unlock deletion. Parsing, accepted paths, one-edit intent, length limits, and ranking remain unchanged.Thanks to @matbrgz for reporting #25571 and @kambarakun for #25699's reset marker and candidate-specific guard approach. This extends that approach to preserve existing alias recovery; the original PR remains open.
Linked Issue
Fixes #25571
Related: #25699
Visual Proof
The attachments render exact error.data excerpts from saved real CLI stdout, rather than an app screenshot. Before uses pinned baseline
51e7181850b0, except worker-relay uses its recorded seven-marker checkpoint; After uses reviewed finale6d513b08f8ea758fb4632046aa22686a4e7e47e. Actual harmless compiled CLI invocations show the behavior below; every input first returned unknown-command help and then exited 1 withinvalid_argumentandruntimeId: null, without connecting to a runtime or creating its isolated profile.The established one-edit boundary still permits
tab clone → close. Genuine one-edit destructive recovery remains supported. No suggested destructive command was executed.Testing
Current verification, October 10: the published source remains
e6d513b08f8ea758fb4632046aa22686a4e7e47e. It passes 179 tests across nine suites both directly and integrated with pinned mainb3aa719a57ca7f5b8fe7db38abf3e9dc4b58a4bb. The integration preserves all 254 canonical commands and 265 accepted paths; existing aliases and handlers are unchanged apart from the eight reviewed destructive markers.Fresh Windows x64 Node 24.18.0 and Linux x64 Node 24.21.0 checks each pass the same 179 tests, the CLI/process-host builds and package boundary, and 53 compiled CLI probes: 33 JSON errors, 14 human errors, and six help controls. Unknown commands exit before runtime selection with
invalid_argument,runtimeId: null, and an uncreated disposable profile; help exits successfully. Native process probes use a 4,096-character long input because Windows limits process command-line length. The pure-function suite retains its 32,768-character budget case, and macOS retains the original long-process proof. No suggested command was executed. These checks use existing locked dependencies and owned build/cache directories; Electron installation is disabled in the fresh Windows capsule. Linux uses installed Electron only in RunAsNode mode, with no app or window.CLI typecheck, ordinary CLI build/package boundary, full-file quality checks, formatting, diff check and canonical changed-code quality pass. Earlier pinned-baseline tests reproduce 19 initial failures plus three worker-release failures before its marker. The original exact-head ordinary CI and readiness follow-ons remain green: all 59 contexts are successful or skipped. Live SSH execution was not run; filtering occurs before choosing a runtime.
AI Disclosure
Review
Root and independent reviewers read the complete policy and relevant registry handlers. Declared alias families retain legitimate
remove/rmrecovery while unrelatedresetverbs do not unlock deletion. Actual source, registry normalization, errors and compiled probes were reviewed; no speculative policy rewrite was needed. No execution handler, accepted path, remote protocol or graphical UI changes.Agent skill upstream boundary
Notes
Suggestion filtering runs before selecting any local, folder-workspace, SSH, or paired runtime. All 250 commands at the published head retain their canonical paths, declared aliases, and other metadata; the pinned-main integration has 254 canonical commands. Only eight destructive markers change. Existing guarded candidates gain no destructive intent verbs. Reversible input/capture/issue-field edits and retired no-effects commands retain their metadata.
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)