Skip to content

fix(cli): preserve alias recovery while guarding destructive suggestions - #26934

Merged
nwparker merged 1 commit into
mainfrom
nwparker/reproducible-cli-suggestions-10-09
Oct 10, 2026
Merged

nwparker merged 1 commit into
mainfrom
nwparker/reproducible-cli-suggestions-10-09

Conversation

@nwparker

@nwparker nwparker commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​191 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​191
Prod 7 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​27 $\color{#cf222e}{\Huge{\mathbf{−}}}$​21 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​6

ELI5

A mistyped orchestration resume could 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 deset suggest delete. Checking only each command's own aliases removed legitimate environment remov → rm recovery. 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 final e6d513b08f8ea758fb4632046aa22686a4e7e47e. Actual harmless compiled CLI invocations show the behavior below; every input first returned unknown-command help and then exited 1 with invalid_argument and runtimeId: null, without connecting to a runtime or creating its isolated profile.

Mistyped command Before After
orchestration resume reset none
artifacts deset list list
environment remov recover, rm recover, rm
emulator ball kill, ax, tap ax, tap
emulator showdown shutdown none
orchestration worker-showw worker-show, worker-stop worker-show
orchestration worker-relay worker-read, worker-release, worker-retain worker-read, worker-retain
tab clues close none
environment rollbook rollback none
linear relation move relation remove none

Before: recorded CLI output

After: recorded CLI output

The established one-edit boundary still permits tab clone → close. Genuine one-edit destructive recovery remains supported. No suggested destructive command was executed.

Testing

  • I manually tested these changes locally
  • Automated tests added/updated, or explained why not below

Current verification, October 10: the published source remains e6d513b08f8ea758fb4632046aa22686a4e7e47e. It passes 179 tests across nine suites both directly and integrated with pinned main b3aa719a57ca7f5b8fe7db38abf3e9dc4b58a4bb. 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/rm recovery while unrelated reset verbs 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

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

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

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

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]>
@nwparker
nwparker marked this pull request as ready for review October 9, 2026 18:58
@coderabbitai

coderabbitai Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 30eb754e-b021-4478-a1ef-96cb68c79bdd

📥 Commits

Reviewing files that changed from the base of the PR and between 3eea6a5 and e6d513b.


📒 Files selected for processing (10)
  • src/cli/command-suggestion-budget.test.ts
  • src/cli/command-suggestion-destructive-families.test.ts
  • src/cli/command-suggestion.ts
  • src/cli/index.test.ts
  • src/cli/specs/browser-basic.ts
  • src/cli/specs/emulator.ts
  • src/cli/specs/linear-mcp.ts
  • src/cli/specs/managed-server.ts
  • src/cli/specs/orchestration-worker-specs.ts
  • src/cli/specs/orchestration.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.



📝 Walkthrough

Walkthrough

The CLI marks additional command specs as destructive. Suggestion matching now checks each destructive candidate against its declared destructive verb family instead of a global set of destructive verbs. Tests cover command recovery, alias equivalence, CLI error handling, and long inputs.


Priority: ⬇️ Low

Severity of issue fixed: Low

Merge Risk: ⚪ Minimal · up to e6d51

No actionable merge-blocking risk is established. The change is ready for normal checks, including pending CI.

Pre-merge checks | Passed 4 | Failed 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 40.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 10 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check Passed The change meets #25571. src/cli/specs/orchestration.ts marks orchestration reset as destructive: true. src/cli/command-suggestion.ts checks intent against the candidate's declared destructive…
Out of Scope Changes check Passed The additional destructive markers for worker stop/release, emulator kill/shutdown, tab close, managed-server rollback, and Linear relation removal support the same typo-suggestion safety rule. The al…
Title check Passed The title clearly summarizes the primary change: preserving alias recovery while adding safeguards for destructive CLI suggestions.
Description check Passed The description is complete and follows the repository template. It explains the user impact, implementation, motivation, linked issues, behavior proof, testing, review scope, compatibility considerat…

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@nwparker
nwparker merged commit eaf5dbe into main Oct 10, 2026
59 checks passed
@nwparker
nwparker deleted the nwparker/reproducible-cli-suggestions-10-09 branch October 10, 2026 22:16
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.

[Bug]: orchestration reset is not marked destructive, so CLI typo recovery suggests it

1 participant