Skip to content

Local code intelligence for developers and AI agents. Connect code, docs and infrastructure in a persistent graph, with CBM Lens, MCP tools, agent integrations and change-aware test selection.

Merge branch 'main' into fix/1954-uninstall-symlinked-config

Martin Vogel33534653f10c
diff --cc src/cli/cli.c
index 8c4216839,7bc1474a0..49d433358
--- a/src/cli/cli.c
+++ b/src/cli/cli.c
@@@ -12181,15 -12405,52 +12514,52 @@@ static int cli_uninstall_activate(void
uninstall_editor_agents(&activation->agents, activation->home, activation->dry_run);
uninstall_additional_agents(&activation->agents, activation->home, activation->dry_run);
uninstall_agent_client_registry(activation->home, activation->dry_run);
+ cbm_config_edit_path_follow_clear();
- if (g_agent_uninstall_errors != 0) {
- cli_activation_transaction_abort_or_fail_stop(&activation->binary_transaction,
- "uninstall_transaction_config_cleanup_abort");
- (void)fprintf(stderr, "error: one or more agent cleanup operations failed; executable "
- "and index removal were not started\n");
- return CLI_ACTIVATION_PARTIAL;
- }
+ /* Agent-config failures are collected, never a gate: an entry the editors
+ * refuse to touch (a symlinked config, a foreign file, a malformed
+ * document) is the user's to fix by hand, and leaving a 300 MB executable
+ * plus every index behind because of it is the data-loss shape of #1954.
+ * The indexes and the executable go now; the failures are listed at the
+ * end and decide the exit code. */
+ #ifdef _WIN32
+ /* #2117: install registers the install directory in the persistent
+ * current-user PATH; uninstall must take it back out, or every cycle leaves
+ * a stale entry and the PATH grows without bound. Remove only our segment.
+ * A registry hiccup here is a warning, never a hard failure: the user is
+ * removing the tool and must not be blocked from finishing over a cosmetic
+ * PATH edit. Suppress the mutation under the test-ops seam exactly as
+ * install does, so the CLI suite never touches the developer's real PATH. */
+ if (activation->bin_path && activation->bin_path[0]) {
+ const char *slash = strrchr(activation->bin_path, '/');
+ const char *backslash = strrchr(activation->bin_path, '\\');
+ if (backslash && (!slash || backslash > slash)) {
+ slash = backslash;
+ }
+ if (slash && slash != activation->bin_path) {
+ size_t dir_len = (size_t)(slash - activation->bin_path);
+ char bin_dir[CLI_BUF_1K];
+ if (dir_len < sizeof(bin_dir)) {
+ memcpy(bin_dir, activation->bin_path, dir_len);
+ bin_dir[dir_len] = '\0';
+ int path_rc = cli_remove_windows_user_path(
+ bin_dir, activation->dry_run || g_cli_activation_test_ops_set);
+ if (path_rc == CLI_OK) {
+ printf(activation->dry_run ? "\nWould remove %s from the current-user PATH\n"
+ : "\nRemoved %s from the current-user PATH\n",
+ bin_dir);
+ } else if (path_rc == CLI_ERR) {
+ (void)fprintf(stderr,
+ "warning: could not update the current-user PATH; %s may "
+ "remain on it\n",
+ bin_dir);
+ }
+ }
+ }
+ }
+ #endif
+
if (activation->delete_indexes && !activation->dry_run) {
int expected = count_db_indexes(activation->home);
int idx_removed = cbm_remove_indexes(activation->home);