@@ -152,17 +152,31 @@ int cbm_cli_exit_status_after_maintenance(int exit_status, bool maintenance_canc
152152 return maintenance_cancelled && exit_status == EXIT_SUCCESS ? EXIT_FAILURE : exit_status;
153153}
154154
155- /* #1537: the refusal is correct, but "sessions could not be stopped" gives the
156- * reader nothing to act on — which sessions? The daemon already knows every
157- * client pid and `daemon status` prints them, so name that remedy here rather
158- * than leaving people to guess (one reporter uninstalled first and still hit
159- * this, with no way to see what was holding on). */
160- static const char CLI_ACTIVATION_REFUSED_MESSAGE[] =
155+ /* #1537. Two very different failures reached this one message: the cohort was
156+ * BUSY (real sessions are running — the reader can close them), or the
157+ * reservation failed outright (lock I/O, stale coordination state, permissions
158+ * — nothing the reader can close, because nothing is running). Reporting both
159+ * as "active sessions" sent someone hunting processes that a reboot proved did
160+ * not exist.
161+ *
162+ * The remedy line must also survive the situation it prints in: an install or
163+ * a retry after `uninstall` has no cbm on PATH, so "run codebase-memory-mcp
164+ * daemon status" was advice the reader could not follow at exactly the moment
165+ * they needed it. Each message now names its own condition and stays runnable. */
166+ static const char CLI_ACTIVATION_BUSY_MESSAGE[] =
161167 "error: active CBM sessions and operations could not be stopped safely; "
162168 "no activation was committed.\n"
163- "error: run 'codebase-memory-mcp daemon status' to list the client "
164- "processes still holding the daemon (MCP servers started by your editor or "
165- "agent are the usual holders), close them, then retry.";
169+ "error: something is still using CBM. If an editor or agent is running an "
170+ "MCP server, close it and retry; 'codebase-memory-mcp daemon status' lists "
171+ "the holders when a cbm binary is still installed.";
172+ static const char CLI_ACTIVATION_REFUSED_MESSAGE[] =
173+ "error: activation could not reserve exclusive access; no activation was "
174+ "committed.\n"
175+ "error: this is NOT a running-session problem — the reservation itself "
176+ "failed (coordination lock, leftover state, or permissions). Nothing needs "
177+ "to be closed. Check the errors above, and report this with the output of "
178+ "'ls -la \"${CBM_CACHE_DIR:-$HOME/.cache/codebase-memory-mcp}\"' if it "
179+ "persists.";
166180static const char CLI_ACTIVATION_PARTIAL_MESSAGE[] =
167181 "error: activation stopped after one or more agent configuration or "
168182 "cleanup operations failed; the published/current executable was kept, "
@@ -211,7 +225,11 @@ static void cli_activation_diagnostic(const cbm_cli_activation_ops_t *ops, const
211225 * stop/reservation failures, which record no refusal note. */
212226 char attributed[CBM_SZ_1K];
213227 const char *note = cbm_activation_transaction_refusal_note();
214- if (diagnostic == CLI_ACTIVATION_REFUSED_MESSAGE && note && note[0]) {
228+ /* A recorded refusal is more specific than EITHER generic message, so it
229+ * wins over both the busy and the reservation-failure wording. */
230+ if ((diagnostic == CLI_ACTIVATION_REFUSED_MESSAGE ||
231+ diagnostic == CLI_ACTIVATION_BUSY_MESSAGE) &&
232+ note && note[0]) {
215233 (void)snprintf(attributed, sizeof(attributed),
216234 "error: activation was refused by a filesystem safety check before any "
217235 "change was made: %s\n"
@@ -245,7 +263,12 @@ int cbm_cli_activation_guard_with_ops(const cbm_cli_activation_ops_t *ops,
245263 if (mutation_lease) {
246264 ops->mutation_lease_release(ops->context, mutation_lease);
247265 }
248- cli_activation_diagnostic(ops, CLI_ACTIVATION_REFUSED_MESSAGE);
266+ /* 0 means the cohort was BUSY: real sessions hold it and closing them
267+ * is the remedy. Anything else is the reservation itself failing, and
268+ * telling that reader to close sessions sends them after processes
269+ * that do not exist (#1537). */
270+ cli_activation_diagnostic(ops, reserve_status == 0 ? CLI_ACTIVATION_BUSY_MESSAGE
271+ : CLI_ACTIVATION_REFUSED_MESSAGE);
249272 return CLI_TRUE;
250273 }
251274
@@ -1232,12 +1255,17 @@ int cbm_replace_binary(const char *path, const unsigned char *data, int len, int
12321255static const char skill_content[] =
12331256 "---\n"
12341257 "name: codebase-memory\n"
1235- "description: Use the codebase knowledge graph for structural code queries. "
1258+ /* #1554: the value contains "Triggers on: " — a colon-space, which YAML
1259+ * reads as a nested-mapping indicator inside an unquoted scalar. Strict
1260+ * parsers (js-yaml's load, the frontmatter reader in `npx skills`) reject
1261+ * the whole file, so the skill silently fails to load rather than loading
1262+ * wrongly. Quoting the scalar is the fix; the text itself is unchanged. */
1263+ "description: \"Use the codebase knowledge graph for structural code queries. "
12361264 "Triggers on: explore the codebase, understand the architecture, what functions exist, "
12371265 "show me the structure, who calls this function, what does X call, trace the call chain, "
12381266 "find callers of, show dependencies, impact analysis, dead code, unused functions, "
12391267 "high fan-out, refactor candidates, code quality audit, graph query syntax, "
1240- "Cypher query examples, edge types, how to use search_graph.\n"
1268+ "Cypher query examples, edge types, how to use search_graph.\"\ n"
12411269 "---\n"
12421270 "\n"
12431271 "# Codebase Memory — Knowledge Graph Tools\n"
@@ -3250,8 +3278,22 @@ int cbm_upsert_codex_mcp(const char *binary_path, const char *config_path) {
32503278 return CLI_ERR;
32513279 }
32523280 char block[CLI_BUF_8K];
3281+ /* #1562: Codex sanitizes the environment of stdio MCP subprocesses, passing
3282+ * through only the names listed in env_vars. Without CBM_CACHE_DIR the
3283+ * Codex-spawned server silently falls back to the DEFAULT cache while the
3284+ * account daemon uses the configured one; the two disagree and the
3285+ * handshake closes during initialization, so Codex exposes no cbm tools at
3286+ * all.
3287+ *
3288+ * The name is listed unconditionally rather than only when the variable is
3289+ * set at install time: env_vars names variables to FORWARD IF PRESENT, so
3290+ * listing it costs nothing when unset and keeps working for someone who
3291+ * sets it after installing — which install-time detection would silently
3292+ * fail to cover. */
32533293 int written = snprintf(block, sizeof(block),
3254- CODEX_CMM_SECTION "\ncommand = \"%s\"\nargs = []\n", escaped);
3294+ CODEX_CMM_SECTION "\ncommand = \"%s\"\nargs = []\n"
3295+ "env_vars = [\"CBM_CACHE_DIR\"]\n",
3296+ escaped);
32553297 if (written < 0 || (size_t)written >= sizeof(block) ||
32563298 cbm_remove_codex_legacy_mcp(config_path) != 0) {
32573299 return CLI_ERR;
@@ -11482,17 +11524,31 @@ int cbm_cmd_update(int argc, char **argv) {
1148211524
1148311525 bool dry_run = false;
1148411526 bool force = false;
11527+ bool legacy_variant_flag = false;
1148511528 for (int i = 0; i < argc; i++) {
1148611529 if (strcmp(argv[i], "--dry-run") == 0) {
1148711530 dry_run = true;
1148811531 } else if (strcmp(argv[i], "--force") == 0) {
1148911532 force = true;
11533+ } else if (strcmp(argv[i], "--ui") == 0 || strcmp(argv[i], "--standard") == 0) {
11534+ /* v0.10.2 deleted the ui/standard chooser and, with it, these flags —
11535+ * which turned `update --ui` from a working command into a hard
11536+ * error for everyone who had it in a script, an alias, or muscle
11537+ * memory (#1544). Removing a CHOICE is fine; removing the WORDS
11538+ * people type is a break we owe them nothing for. Accept both,
11539+ * ignore them, and say once why they no longer mean anything. */
11540+ legacy_variant_flag = true;
1149011541 } else if (strcmp(argv[i], "-y") != 0 && strcmp(argv[i], "--yes") != 0 &&
1149111542 strcmp(argv[i], "-n") != 0 && strcmp(argv[i], "--no") != 0) {
1149211543 (void)fprintf(stderr, "error: unknown update option: %s\n", argv[i]);
1149311544 return CLI_TRUE;
1149411545 }
1149511546 }
11547+ if (legacy_variant_flag) {
11548+ (void)fprintf(stderr, "note: --ui/--standard are accepted but no longer do anything; since "
11549+ "v0.10.0 there is one build per platform and it always includes the "
11550+ "graph UI.\n");
11551+ }
1149611552
1149711553 /* Updates run from the install script, not from this process — on every
1149811554 * platform.
0 commit comments