Skip to content

fix(init): fail closed on uninstall for agents without an uninstaller - #3420

Open
RawNuke wants to merge 3 commits into
rtk-ai:developfrom
RawNuke:fix/uninstall-fail-closed-for-unwired-agents
Open

fix(init): fail closed on uninstall for agents without an uninstaller#3420
RawNuke wants to merge 3 commits into
rtk-ai:developfrom
RawNuke:fix/uninstall-fail-closed-for-unwired-agents

Conversation

@RawNuke

@RawNuke RawNuke commented Aug 4, 2026

Copy link
Copy Markdown

Closes #3404

The bug

The uninstall dispatcher (uninstall_init_dispatch) routed Hermes, Droid, Cursor and Pi explicitly and sent everything else to the Claude uninstaller. AgentTarget has ten variants; the five unwired ones — Windsurf, Cline, Kilocode, Antigravity, Kimi — fell into the else arm with both cursor and pi false, which is exactly the Claude path.

So rtk init --uninstall -g --agent kilocode reported success while:

  • deleting ~/.claude/RTK.md
  • rewriting ~/.claude/CLAUDE.md
  • stripping the rtk hook from ~/.claude/settings.json
  • removing nothing for Kilo Code

A user running rtk with both Claude Code and Kilo Code who wants to remove only the Kilo Code integration loses their Claude integration instead.

The fix

Replace the if/else chain with an explicit match on AgentTarget:

  • Hermes → Hermes uninstaller (unchanged)
  • Droid → Droid uninstaller (unchanged)
  • Claude → standard uninstaller (unchanged, explicit)
  • Cursor → standard uninstaller with cursor: true (unchanged, explicit)
  • Pi → standard uninstaller with pi: true (unchanged, explicit)
  • Windsurf | Cline | Kilocode | Antigravity | Kimi → error: uninstall is not supported for --agent <name>; remove the RTK block from the agent's rules file manually
  • None → standard uninstaller (Claude default, unchanged)

A match also makes the compiler flag the next variant added to the enum, so a new agent can never silently fall into the wrong uninstaller again.

Verification

  • cargo test passes (8 suites, all ok); 5 new dispatch tests cover Hermes routing, Cursor/Pi flag routing, the Claude default, and fail-closed errors for all five unwired agents (asserting the standard uninstaller is never called).
  • cargo clippy --all-targets: clean.
  • Manual run against a scratch HOME:
$ rtk init --uninstall -g --agent kilocode
rtk: uninstall is not supported for --agent kilocode; remove the RTK block from the agent's rules file manually

(also verified windsurf, cline, antigravity, kimi). The default rtk init --uninstall path is unchanged.

RawNuke added 3 commits August 5, 2026 00:14
yadm manages a separate dotfiles repository whose work-tree is HOME.
The git rewrite rule enumerated yadm in its pattern and rewrite
prefixes, so yadm commit/push/checkout/add were rewritten to 'rtk git'
and acted on whatever project the shell was standing in. Remove yadm
from the rule; the yadm filter now routes yadm to the yadm binary as
'rtk yadm <subcommand>', matching the already-correct 'yadm list' path.

run_add also injected '.' when git add had no pathspec, turning real
git's deliberate no-op into a whole-worktree stage. A bare 'rtk git add'
now passes no pathspec, so nothing gets staged implicitly.

Closes rtk-ai#3408
The uninstall dispatcher routed Hermes, Droid, Cursor and Pi explicitly
and sent everything else to the Claude uninstaller. Windsurf, Cline,
Kilocode, Antigravity and Kimi fell into that else arm with both the
cursor and pi flags false, which is exactly the Claude path: the
uninstall deleted ~/.claude/RTK.md, rewrote ~/.claude/CLAUDE.md and
stripped the hook from ~/.claude/settings.json while removing nothing
for the named agent (issue rtk-ai#3404).

Replace the if/else chain with an explicit match on AgentTarget. The
five unwired agents now return 'uninstall is not supported for
--agent <name>' instead of silently uninstalling a different agent, and
the compiler flags the next variant someone adds to the enum.

Tests cover Hermes, Cursor, Pi routing, the Claude default, and
fail-closed errors for all five unwired agents without touching the
standard uninstaller.

Closes rtk-ai#3404
@CLAassistant

CLAassistant commented Aug 4, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@RawNuke

RawNuke commented Aug 4, 2026

Copy link
Copy Markdown
Author

The pull request is complete. The work was done as a free contribution.
If you found it useful, a tip is appreciated:

  • EVM (ETH, USDC, USDT, Base): 0x9C7d9BfC606D3D5B5fB22C199495cF7207C5Cd16
  • Bitcoin: bc1qswtgp6a0dp4qpsstf0jsrnzgquq80nzy2g5nmm
  • Solana: EW4SCPWMiATUC53Apkaxw9EDKLRQtm8oTGAzk4XhDcP9
  • Tron: TBEJYtPeK1owFA6P67dKtBntSU6u29PwsH
  • Base: 0x9C7d9BfC606D3D5B5fB22C199495cF7207C5Cd16

No tip is expected. The contribution stands on its own.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants