Skip to content

fix(cli): honour --dir when uninstall checks agent entry ownership - #3019

Open
ravenpride wants to merge 1 commit into
DeusData:mainfrom
ravenpride:fix/uninstall-dir-ownership
Open

ravenpride wants to merge 1 commit into
DeusData:mainfrom
ravenpride:fix/uninstall-dir-ownership

Conversation

@ravenpride

Copy link
Copy Markdown

What does this PR do?

Problem: uninstall --dir=<dir> only removes the Claude Code entry. Every other agent path reconstructs the binary path as ~/.local/bin/codebase-memory-mcp, so the ownership check fails for entries that install --dir=<dir> wrote (e.g. via install.ps1, whose default is %LOCALAPPDATA%\Programs\codebase-memory-mcp). Entries are left behind; for some clients "removed" is printed although nothing was removed. Related: #2856 (point 2).

Fix: Drop the guessing helper cbm_agent_installed_binary_path() and pass activation->bin_path through all uninstall paths, as uninstall_claude_code() already does.

Tests: New cli_uninstall_dir_removes_agent_entries_written_for_that_dir (installs into a custom dir, uninstalls with --dir, asserts owned entries are removed and foreign ones kept). Fails without the fix, passes with it. scripts/test.sh --suites cli on Windows (MSYS2 CLANG64, clang 23): 372 passed, 11 skipped.

AI disclosure: Written with the help of GitHub Copilot (Opus 5.5); reviewed and tested by me.

Checklist

  • Every commit is signed off (git commit -s) — required, CI rejects
    unsigned commits (DCO, see CONTRIBUTING.md)
  • Tests pass locally (make -f Makefile.cbm test)
  • Lint passes (make -f Makefile.cbm lint-ci)
  • New behavior is covered by a test (reproduce-first for bug fixes)

Local verification (Windows 11, MSYS2 CLANG64, clang 23):

  • make -f Makefile.cbm test: no new failures. The set of failing assertions is identical with and without this change, except that this PR adds a passing test. The cli suite is fully green (372 passed). The remaining failures (grammar probes, git fixtures) are pre-existing in this local Windows environment.
  • lint-ci with the CI tool versions: lint-format (clang-format 20.1.8), lint-no-suppress, lint-memory-core and lint-vendored-scanners pass. lint-cppcheck (2.20.0) on Windows reports 15 findings in files this PR does not touch, identical on unpatched main; relying on the Linux CI job.

Signed-off-by: Sascha Falk <sascha@falk-online.eu>
@ravenpride
ravenpride requested a review from DeusData as a code owner November 17, 2026 13:22
Copilot AI balanced review requested due to automatic review settings November 17, 2026 13:22
@github-actions

Copy link
Copy Markdown

Thanks for opening this — it has been seen, and it is queued.

This note is automated, but it is not a brush-off: it exists so you know where your PR stands instead of having to guess from silence.

Current review status: working through a backlog. 0.9.1-rc.1 is out, so the release freeze that held reviews is over — but it left a large queue of open pull requests behind it, and we are reading through them oldest-first. The background is in discussion #1144.

What that means for this PR, concretely:

  • It will not be closed for inactivity. No stale bot touches pull requests here.
  • It may still sit a while before a human reads it. That is on us, not on you.
  • Older PRs are read first, so a recent one is not being skipped — it is behind a queue.

Things that will genuinely speed it up whenever review does happen:

  • Keep it rebased on main — the tree is moving quickly right now, and a conflicting branch cannot be reviewed as the diff you intended.
  • Get CI green, or say which failures you believe are pre-existing.
  • Keep the change to one claim. Bundled features and refactors get split before they get merged, which costs you a round trip.
  • Every commit needs a sign-off (git commit -s) — CI enforces DCO.

If this fixes a bug, a reproduction we can run is worth more than a description of the symptom.

Thanks for contributing, and sorry in advance for the wait.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues remain for the custom-directory uninstall changes.

No open issues 🎉

What changed in this PR

Makes uninstall --dir=<dir> use the selected binary path when checking agent-entry ownership, addressing the custom-directory portion of issue #2856’s uninstall symmetry problem.

Changes:

  • Removes the helper that assumed binaries were installed under ~/.local/bin.
  • Passes the activation binary path through agent configuration, hook, and profile cleanup.
  • Adds a cross-platform regression test for custom-directory uninstall, checking binary and owned-entry removal while preserving unrelated configuration.
File Description
tests/​test_cli.c Adds and registers the custom-directory uninstall regression test.
src/​cli/​cli.c Uses the selected binary path throughout agent uninstall ownership checks.

Review effort: Balanced

This branch has not been deployed

No deployments
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.

2 participants