Skip to content

Commit 0baddf7

Browse files
committed
daemon: permanent lifecycle, daemon-backed CLI/hooks, real-Windows hardening, long-path launcher transactions
Daemon lifecycle and Windows correctness, verified on a real Windows 11 ARM64 VM through the maintained test-infrastructure/vm drivers, plus the macOS and Linux arm64 suites and the container lint gate. Daemon lifecycle: - daemon start/stop/status subcommands. `daemon start` launches a PERMANENT daemon (spawn shape is byte-exact argv; survives idle periods and session ends) and reports an already-active daemon instead of failing. Permanence is honored at every stop latch: last-committed-client disconnect, host initial-client window, coordinator release, and application final-session close — a permanent daemon also keeps admitting new sessions after its last one closes. - daemon stop refuses while sessions are active and lists the blocking peers (pid/role) that must finish first; an idle daemon drains through the activation-shutdown machinery with the ACK ordered after connection interrupts. A second stop is idempotent. The wire ops are no-cohort first-frame requests with peer fingerprint authentication, so stop/status never conflict with an exact-build admission gate. - One-shot CLI commands now execute through the daemon (index workers keep their local supervised path). A cold CLI run that had to spawn a temporary daemon prints a hint that `daemon start` removes the per-command startup tax; a warm daemon is recycled silently. - Hooks are connect-only fail-open: with no daemon present the hook emits a visible, rate-limited notice (Claude-dialect systemMessage plus stderr for other dialects) and always exits 0 — augmentation is never allowed to block the caller's tool use. - Version skew: a newer-build client automatically drains an older-build permanent daemon (strict semantic-version triples only; dev builds never auto-drain) and the build-conflict message names `cbm daemon stop` as the manual escape hatch. Windows IPC/runtime (real-VM verified): - ipc(win): persistent pending overlapped ConnectNamedPipe. The accept path used to destroy its listening pipe instance on every 20 ms poll timeout; a client attaching in the teardown window was severed or left on an orphaned pipe object whose HELLO no server handle could ever read, absorbing the connect until the client's own timeout expired. The pending connect now survives poll timeouts and nothing is destroyed while a client could be attaching. - ipc(win): drain-before-close for final responses. Closing a named-pipe server handle can discard a just-sent response before the peer reads it (POSIX stream sockets never lose buffered data on close). A bounded cbm_daemon_ipc_connection_drain (read-until-peer-EOF; no-op on POSIX, immediate on interrupted connections) now precedes close in runtime_worker_finish and runtime_reject_inline, so hello-conflict, capacity and disconnect acknowledgements reliably reach the peer. - runtime: CLOSE_INTENT wire frame. A Windows named-pipe client has no transport half-close, so close_begin now announces departure with an explicit frame (ordered after APPLICATION_CANCEL, before the local interrupt); the server releases the client's admission on receipt instead of waiting for the handle to close. Admission-drop timing is now identical to POSIX shutdown() semantics on every platform. - runtime(win): client close cancellation. close_begin serializes with request publication under the send lock, best-effort sends the active token's APPLICATION_CANCEL frame, then interrupts local I/O; the server cancels MCP/subprocess work promptly. Contract tests accept both correct outcomes (interrupted transport or decoded CANCELLED). - runtime: activation acknowledgement ordering. The activation ACK is the requester's license to act on "snapshotted and draining", so every connection interrupt is now initiated before the ACK is sent; a session could previously get one more request serviced after the requester observed the ACK. - service(win): deadline-bounded private-file prepare. The conflict-log prepare retry loop (100 x Sleep(2), which rounds up to the ~16 ms timer granularity) burned ~1.6 s against permanently obstructed paths, stalling hello rejections past the client's timeout. The retry budget is now a 250 ms deadline; transient share collisions still retry. - subprocess(win): cmd.exe /C payload encoder quotes metacharacters correctly (root cause of the git-on-Windows failure cluster). - watcher: SHA-256 buffer sizing (CBM_SZ_64 -> CBM_SZ_128) and a native Windows stop/unwatch cancellation test with exact-image verification. - httpd: send_all writes in bounded 64 KiB slices. A single giant nonblocking send() on Windows is absorbed wholesale into AFD kernel buffering regardless of SO_SNDBUF, so send deadlines and interrupts could never engage against a slow peer (and the full payload was pinned in nonpaged pool). Slicing restores a deterministic backpressure point; a test hook pins SO_SNDBUF for the deadline and interrupt tests. - ui/http: shutdown lifecycle — interrupt checks, response-wide send deadline, explicit connection states, refusal to free a server while a listener-owned connection is active. Windows long-path support: - Central path-aware wide conversion (canonicalize via GetFullPathNameW and prepend the extended-length prefix for absolute paths >=240) at the compat chokepoints (cbm_fopen/compat_fs/mkstemp/mkdtemp), sqlite store opens, and the daemon build-fingerprint/log paths. Deep managed installs (a 64-hex generation directory routinely exceeds MAX_PATH) now index, stage and activate correctly. - activation transaction: its own file APIs and the component-walking ancestry validators now operate in the extended-length namespace; the launcher path is canonicalized (and prefixed when deep) once at entry so every downstream exact-string comparison stays form-consistent. - Executable self-resolution uses the wide APIs (GetModuleFileNameW, GetFileAttributesW) so non-ASCII install paths survive argv[0] resolution. Windows launcher install/uninstall transaction: - FileRenameInfoEx names are NUL-terminated in an over-allocated buffer. FileNameLength governs per the contract, but filter drivers read FileName as NUL-terminated and appended adjacent heap bytes to created names — a flaky, garbage-suffixed rename target. Both the CLI and the launcher rename helpers are fixed. - Uninstall retires state via rename-aside (.cbm -> .cbm-retired-v1-<tag>-<pid>) with the retired tag shortened to 16 hex chars so the bare rename target stays under the FileRenameInfoEx NT-conversion ceiling at guard depths; 64 bits still uniquely identify the generation. - When the running launcher's mapped generation backings pin .cbm against rename, the backings are relocated to activation-<pid>-N .retired tombstones beside the install (a mapped image may be renamed, never deleted; the launcher's liveness-guarded sweep reclaims stale tombstones). Every relocation is recorded, and a FAILED uninstall reverses the moves after restoring .cbm — via MoveFileExW with extended-length paths on both arguments, since the deep generation target is beyond the handle-based rename's bare-path reach — so a restored install keeps its generation backings and stays runnable. - After a committed uninstall the retired tree's backings are relocated out so the tree is shallow enough for the detached cleanup's rd, and the cleanup's working directory strips the extended-length prefix (CreateProcessW lpCurrentDirectory silently ignores prefixed paths). - Files created under Administrators-default-owner directories (CopyFileW destinations, CREATE_NEW tombstones, probe directories) are explicitly owner-stamped so the exact-owner validators hold on runner images; guard fixtures stamp hand-built trees the same way. Diagnostics, tests and infra: - diagnostics: discovery is now an always-delivered JSON control record (new cbm_log_control) that survives CBM_LOG_LEVEL suppression and paths containing spaces; placement honors $TMPDIR with /tmp fallback via a diagnostics-local helper; the soak parser reads the JSON record; documented in docs/CONFIGURATION.md. Red-first coverage for suppressed log levels, TMPDIR-with-spaces, and native Windows output-contract assertions. - tests(win): daemon_ipc/daemon_frontend fixtures now build endpoint parents with production-shaped ancestry (LocalAppData on Windows, via th_secure_runtime_parent_new) — the runtime ancestry validation correctly refuses temp roots whose ancestors grant mutation rights to Authenticated Users (C:/msys64/tmp, GitHub-runner work dirs) — and drive the documented startup-owner publication flow before reading generation-bound endpoint addresses. This turns the 26 Windows failures previously visible in CI's full-test job green without weakening any validation. - tests(win): the launcher guard covers the full permanent-launcher contract including failed-uninstall restore and immediate reinstall after uninstall; new daemon lifecycle and reworked hook-augment guards run the start/recycle/stop flow end to end. - tests: CBM_SKIP_PERF is now actually consumed by the test runner (it was set by CI but never read, so perf suites ran everywhere); four throughput/bench suites are classified as perf, the heavy store_arch suite moved to the slow-timeout tier, and two wall-clock-sensitive assertions were rewritten as invariant checks with coarse hang-detector backstops. - build/test infra: build-dir safety contract, UI dev-proxy security contract, soak daemon-recovery contract, path-safety helper, the Windows VM worktree-sync contract wired into scripts/test.sh, and vm/win.sh guards building its clean embedded-UI product in an isolated BUILD_DIR so it cannot clobber the incremental test build. provision-windows.sh now installs Node.js for the guards UI build. Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
1 parent d826374 commit 0baddf7

85 files changed

Lines changed: 10317 additions & 1301 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/workflows/_test.yml‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -285,8 +285,8 @@ jobs:
285285

286286
- name: Windows regression guards (#636/#357, #618, #548, #423/#20)
287287
shell: pwsh
288-
# -GuardsOnly runs the four green guards and gates on them. The runner sets
289-
# CBM_INDEX_SUPERVISOR=0 for determinism, but the non-ASCII CLI guard drops that
290-
# override so it exercises the real supervisor->worker spawn (where #423/#20's
291-
# second half lives); the other guards test path/hook/drive fixes in-process.
288+
# -GuardsOnly runs the four green guards and gates on them. All guards run
289+
# against the real supervisor->worker spawn path: under the mandatory
290+
# coordination daemon, CBM_INDEX_SUPERVISOR=0 is a fail-closed refusal, so
291+
# the driver no longer sets it anywhere.
292292
run: ./scripts/test-windows.ps1 -GuardsOnly -Binary build/c/codebase-memory-mcp.exe

‎Makefile.cbm‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ CXXFLAGS_PROD = $(CXXFLAGS_COMMON) -O2
6565
SANITIZE = -fsanitize=address,undefined -fno-omit-frame-pointer
6666
EDITOR_TEST_DEFINES = -DCBM_JSON_LIKE_ENABLE_TEST_API=1 \
6767
-DCBM_TOML_EDIT_ENABLE_TEST_API=1 -DCBM_YAML_ENABLE_TEST_API=1 \
68-
-DCBM_TEXT_EDIT_ENABLE_TEST_API=1 -DCBM_CLI_ENABLE_TEST_API=1
68+
-DCBM_TEXT_EDIT_ENABLE_TEST_API=1 -DCBM_CLI_ENABLE_TEST_API=1 \
69+
-DCBM_DIAGNOSTICS_ENABLE_TEST_API=1
6970
CFLAGS_TEST = $(CFLAGS_COMMON) $(EDITOR_TEST_DEFINES) -g -O1 $(SANITIZE)
7071
CXXFLAGS_TEST = $(CXXFLAGS_COMMON) -g -O1 $(SANITIZE)
7172

@@ -348,6 +349,7 @@ TEST_FOUNDATION_SRCS = \
348349
tests/test_log.c \
349350
tests/test_str_util.c \
350351
tests/test_platform.c \
352+
tests/test_diagnostics.c \
351353
tests/test_dump_verify.c \
352354
tests/test_subprocess.c \
353355
tests/test_private_file_lock.c \
@@ -826,8 +828,9 @@ cbm-with-ui: embed $(OBJS_VENDORED_PROD) $(WINDOWS_LAUNCHER_TARGET)
826828
$(LDFLAGS)
827829
@echo "Built with UI: $(BUILD_DIR)/codebase-memory-mcp"
828830

831+
clean-c: export BUILD_DIR := $(BUILD_DIR)
829832
clean-c:
830-
rm -rf $(BUILD_DIR)
833+
@bash -c 'source scripts/path-safety.sh && cbm_remove_build_dir "$$PWD" "$$BUILD_DIR"'
831834

832835
# ── Linting ─────────────────────────────────────────────────────
833836

‎README.md‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -274,14 +274,14 @@ codebase-memory-mcp runs **100% locally and collects no telemetry** — your cod
274274

275275
### Capture a diagnostics log
276276

277-
Set `CBM_DIAGNOSTICS=1` before the first daemon-backed MCP session starts, then reproduce the problem (let it run as long as it takes — a slow leak needs time to show in the trend). The shared daemon captures this setting from the session that starts it. If it is already running, close all daemon-backed sessions so it exits before changing the setting. The daemon writes two files to your system temp directory (`$TMPDIR` or `/tmp` on macOS/Linux, `%TEMP%` on Windows):
277+
Set `CBM_DIAGNOSTICS=1` before the first daemon-backed MCP session starts, then reproduce the problem (let it run as long as it takes — a slow leak needs time to show in the trend). The shared daemon captures this setting from the session that starts it. If it is already running, close all daemon-backed sessions so it exits before changing the setting. The daemon creates a fresh owner-private `cbm-diagnostics-<pid>-<random>` directory below the system temp directory (`$TMPDIR` or `/tmp` on macOS/Linux, `%TEMP%` on Windows). The exact paths are recorded by the `diagnostics.start` event in `${CBM_CACHE_DIR}/logs/cbm-daemon.log`:
278278

279279
| File | What it is |
280280
|------|------------|
281-
| `cbm-diagnostics-<pid>.ndjson` | **The memory trajectory** — one JSON line every 5 s with `rss`, `committed` (Windows commit charge), `peak_*`, `page_faults`, `fd`, and `queries`. **This is the file we need for memory/leak reports** — the *trend over time* is what pinpoints a leak. It is **kept on disk after the server exits** (so you can grab it post-mortem) and rotates to `.ndjson.1` past ~8 MB. |
282-
| `cbm-diagnostics-<pid>.json` | The latest snapshot only — handy for a quick live check. Removed on clean exit. |
281+
| `trajectory.ndjson` | **The memory trajectory** — one JSON line every 5 s with `rss`, `committed` (Windows commit charge), `peak_*`, `page_faults`, `fd`, and `queries`. **This is the file we need for memory/leak reports** — the *trend over time* is what pinpoints a leak. It is **kept on disk after the server exits** (so you can grab it post-mortem) and rotates to `trajectory.ndjson.1` past ~8 MB. |
282+
| `snapshot.json` | The latest snapshot only — handy for a quick live check. Removed on clean exit. |
283283

284-
The `<pid>` component is the shared daemon's process ID, also recorded by the `daemon.start` event in `${CBM_CACHE_DIR}/logs/cbm-daemon.log`. Set the variable consistently in the `env` block of each agent's MCP server config, or export it before launching the first session.
284+
The private randomized directory prevents another local account from pre-placing a link or special file at a predictable diagnostics path. Its `<pid>` component is the shared daemon's process ID, also recorded by the `daemon.start` event. Set the variable consistently in the `env` block of each agent's MCP server config, or export it before launching the first session.
285285

286286
### What to share
287287

@@ -635,7 +635,7 @@ codebase-memory-mcp config reset auto_index # reset to default
635635
|----------|---------|-------------|
636636
| `CBM_ALLOWED_ROOT` | *(unset)* | Restrict `index_repository` to paths within this directory. When set, a `repo_path` that resolves (after symlink / `..` resolution) outside this root is refused; unset imposes no restriction. Useful when the server may be driven by an untrusted caller, e.g. agentic or multi-tenant deployments. |
637637
| `CBM_CACHE_DIR` | `~/.cache/codebase-memory-mcp` | Override the database storage directory. All project indexes and config are stored here. One account can use only one canonical cache root at a time; close active CBM sessions/commands before switching it. |
638-
| `CBM_DIAGNOSTICS` | `false` | Set to `1` or `true` to enable the shared daemon's periodic snapshot and trajectory files in the system temp directory (`cbm-diagnostics-<pid>.json` and `cbm-diagnostics-<pid>.ndjson`). |
638+
| `CBM_DIAGNOSTICS` | `false` | Set to `1` or `true` to enable the shared daemon's periodic `snapshot.json` and retained `trajectory.ndjson` below a fresh owner-private directory in the system temp directory. Exact paths are logged by `diagnostics.start`. |
639639
| `CBM_DOWNLOAD_URL` | *(GitHub releases)* | Override the download URL for updates. Used for testing or self-hosted deployments. |
640640
| `CBM_LOG_LEVEL` | `info` | Set the minimum log level. Accepted values (case-insensitive): `debug`, `info`, `warn`, `error`, `none` — or their numeric equivalents `0`–`4` matching the internal enum. Thin-frontend messages go to that session's stderr; detached daemon events go to `${CBM_CACHE_DIR}/logs/cbm-daemon.log`. Stdout is reserved for MCP JSON-RPC. |
641641
| `CBM_WORKERS` | *(detected)* | Override the parallel-indexing worker count returned by `cbm_default_worker_count`. Useful inside containers where `sysconf(_SC_NPROCESSORS_ONLN)` reports host CPUs rather than the cgroup's effective quota. Range 1–256; invalid values are ignored with a warning. |

‎docs/CONFIGURATION.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ These environment variables affect runtime behavior:
118118
|---|---|---|
119119
| `CBM_ALLOWED_ROOT` | *(unset)* | Restrict `index_repository` to paths within this directory. When set, a `repo_path` that resolves (after symlink / `..` resolution) outside this root is refused; unset imposes no restriction. Useful when the server may be driven by an untrusted caller (agentic or multi-tenant deployments). |
120120
| `CBM_CACHE_DIR` | `~/.cache/codebase-memory-mcp` | Override the cache directory used for indexes, `_config.db`, and UI `config.json`. |
121-
| `CBM_DIAGNOSTICS` | `false` | Enable the shared daemon's periodic snapshot and trajectory files in the system temp directory (`cbm-diagnostics-<pid>.json` and `cbm-diagnostics-<pid>.ndjson`). |
121+
| `CBM_DIAGNOSTICS` | `false` | Enable periodic `snapshot.json` and retained `trajectory.ndjson` below a fresh owner-private directory in the system temp directory. The daemon records the randomized paths in the `diagnostics.start` discovery record (a single JSON line) in `${CBM_CACHE_DIR}/logs/cbm-daemon.log`; that one record is emitted even when `CBM_LOG_LEVEL` suppresses ordinary logging, so the paths always remain discoverable. |
122122
| `CBM_DOWNLOAD_URL` | GitHub releases | Override the update download URL. |
123123
| `CBM_LOG_LEVEL` | `info` | Set the log level to `debug`, `info`, `warn`, `error`, or `none` (or `0`-`4`). Thin-frontend messages use that session's stderr; detached daemon events use `${CBM_CACHE_DIR}/logs/cbm-daemon.log`. |
124124
| `CBM_WORKERS` | auto-detected | Override the indexing worker count. |

‎graph-ui/vite.config.ts‎

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,30 @@
11
/// <reference types="vitest" />
2-
import { defineConfig } from "vite";
2+
import { defineConfig, type ProxyOptions } from "vite";
33
import react from "@vitejs/plugin-react";
44
import tailwindcss from "@tailwindcss/vite";
55
import path from "path";
66

7+
const uiBackendOrigin = "http://127.0.0.1:9749";
8+
const uiDevOrigins = new Set([
9+
"http://127.0.0.1:5173",
10+
"http://localhost:5173",
11+
]);
12+
const uiBackendProxy = (): ProxyOptions => ({
13+
target: uiBackendOrigin,
14+
changeOrigin: true,
15+
// The backend deliberately accepts only its own exact loopback authority.
16+
// Reject foreign browser origins before normalizing the trusted Vite origin.
17+
headers: { Origin: uiBackendOrigin },
18+
bypass(req, res) {
19+
const origin = req.headers.origin;
20+
if (origin !== undefined && !uiDevOrigins.has(origin)) {
21+
res.writeHead(403, { "Content-Type": "application/json" });
22+
res.end('{"error":"forbidden origin"}');
23+
return false;
24+
}
25+
},
26+
});
27+
728
export default defineConfig({
829
plugins: [react(), tailwindcss()],
930
resolve: {
@@ -27,9 +48,10 @@ export default defineConfig({
2748
},
2849
server: {
2950
port: 5173,
51+
strictPort: true,
3052
proxy: {
31-
"/rpc": "http://127.0.0.1:9749",
32-
"/api": "http://127.0.0.1:9749",
53+
"/rpc": uiBackendProxy(),
54+
"/api": uiBackendProxy(),
3355
},
3456
},
3557
});

‎scripts/build.sh‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ done
3232

3333
# shellcheck source=env.sh
3434
source "$ROOT/scripts/env.sh"
35+
# shellcheck source=path-safety.sh
36+
source "$ROOT/scripts/path-safety.sh"
3537

3638
# Parse remaining arguments. BUILD_DIR is tracked for the clean step below so
3739
# containerized legs can build in their own directory instead of deleting and
@@ -92,7 +94,7 @@ echo " ui=$WITH_UI version=${VERSION:-dev}"
9294
verify_compiler "$CC"
9395

9496
# Step 1: Clean C build artifacts only (not node_modules — npm ci handles that)
95-
rm -rf "${ROOT:?}/${BUILD_DIR}"
97+
cbm_remove_build_dir "$ROOT" "$BUILD_DIR"
9698

9799
# Step 2: Build (Makefile applies $ARCHFLAGS for the target arch on macOS)
98100
if $WITH_UI; then

‎scripts/clean.sh‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,17 @@ set -euo pipefail
1111

1212
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
1313

14+
# shellcheck source=path-safety.sh
15+
source "$ROOT/scripts/path-safety.sh"
16+
1417
# Containerized legs build in their own directory (BUILD_DIR env) so a
1518
# container clean never deletes the host's native build/c mid-build.
1619
BUILD_DIR="${BUILD_DIR:-build/c}"
1720

1821
echo "=== Cleaning build artifacts ($BUILD_DIR) ==="
1922

2023
# C build artifacts
21-
rm -rf "${ROOT:?}/${BUILD_DIR}"
24+
cbm_remove_build_dir "$ROOT" "$BUILD_DIR"
2225

2326
# Frontend build artifacts
2427
rm -rf "$ROOT/graph-ui/dist"

‎scripts/path-safety.sh‎

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#!/usr/bin/env bash
2+
# Shared destructive-path validation for build/test/clean entrypoints.
3+
4+
cbm_require_safe_build_dir() {
5+
local build_dir="${1-}"
6+
local root="${2:-$PWD}"
7+
local leaf
8+
local physical_root
9+
local physical_build
10+
11+
# Keep cleanup targets to one ordinary repository-owned directory directly
12+
# beneath build/. Besides rejecting absolute and parent-relative paths,
13+
# the single-component rule prevents an intermediate symlink from routing
14+
# rm into a directory outside the repository.
15+
if [[ ! "$build_dir" =~ ^build/[A-Za-z0-9._-]+$ ]]; then
16+
echo "ERROR: BUILD_DIR must be one direct child of build/ (got '$build_dir')" >&2
17+
return 1
18+
fi
19+
leaf="${build_dir#build/}"
20+
if [[ "$leaf" == "." || "$leaf" == ".." ]]; then
21+
echo "ERROR: BUILD_DIR must name an ordinary build/ child (got '$build_dir')" >&2
22+
return 1
23+
fi
24+
if ! physical_root="$(cd "$root" 2>/dev/null && pwd -P)"; then
25+
echo "ERROR: repository root is missing or inaccessible" >&2
26+
return 1
27+
fi
28+
if [ -L "$physical_root/build" ] ||
29+
{ [ -e "$physical_root/build" ] && [ ! -d "$physical_root/build" ]; }; then
30+
echo "ERROR: repository build/ ancestor must be absent or a real directory" >&2
31+
return 1
32+
fi
33+
if [ -d "$physical_root/build" ]; then
34+
if ! physical_build="$(cd "$physical_root/build" 2>/dev/null && pwd -P)" ||
35+
[ "$physical_build" != "$physical_root/build" ]; then
36+
echo "ERROR: repository build/ ancestor resolves outside the repository" >&2
37+
return 1
38+
fi
39+
fi
40+
}
41+
42+
cbm_remove_build_dir() {
43+
local root="${1-}"
44+
local build_dir="${2-}"
45+
local physical_root
46+
local leaf
47+
48+
cbm_require_safe_build_dir "$build_dir" "$root" || return 1
49+
physical_root="$(cd "$root" 2>/dev/null && pwd -P)" || return 1
50+
leaf="${build_dir#build/}"
51+
rm -rf -- "$physical_root/build/$leaf"
52+
}

‎scripts/run-tests-parallel.sh‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ run_one() {
100100
# Uses `timeout` where available (always in the Linux container / CI); on a
101101
# host without it the suite runs uncapped (no regression vs before).
102102
case "$s" in
103-
incremental) st="${CBM_SUITE_TIMEOUT_SLOW:-3600}" ;;
103+
incremental | store_arch) st="${CBM_SUITE_TIMEOUT_SLOW:-3600}" ;;
104104
*) st="${CBM_SUITE_TIMEOUT:-900}" ;;
105105
esac
106106
if command -v timeout >/dev/null 2>&1; then

‎scripts/smoke-test.sh‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1027,9 +1027,11 @@ ROVO_AGENT="$FAKE_HOME/.rovodev/subagents/codebase-memory.md"
10271027
AMAZON_Q_MCP="$FAKE_HOME/.aws/amazonq/default.json"
10281028
mkdir -p "$GITLAB_DIR" "$(dirname "$GITLAB_HOOKS")" "$DEVIN_DIR"
10291029
mkdir -p "$FAKE_HOME/.local/bin"
1030-
# Copy binary with correct name for platform
1030+
# A Windows portable pair is the installer source, not a valid managed target.
1031+
# Leave the canonical destination absent so install can publish the authenticated
1032+
# generation backing + canonical hard-link pair. A one-link copy at that path is
1033+
# deliberately rejected as an unknown/conflicting installation.
10311034
if [[ "$BINARY" == *.exe ]]; then
1032-
copy_smoke_binary "$FAKE_HOME/.local/bin/codebase-memory-mcp.exe"
10331035
SELF_PATH="$FAKE_HOME/.local/bin/codebase-memory-mcp.exe"
10341036
else
10351037
cp "$BINARY" "$FAKE_HOME/.local/bin/codebase-memory-mcp"
@@ -2748,8 +2750,9 @@ if [ -n "${SMOKE_DOWNLOAD_URL:-}" ]; then
27482750
UPDATE_HOME=$(smoke_mktemp_dir)
27492751
mkdir -p "$UPDATE_HOME/.claude" "$UPDATE_HOME/.local/bin"
27502752
if [[ "$BINARY" == *.exe ]]; then
2751-
copy_smoke_binary "$UPDATE_HOME/.local/bin/codebase-memory-mcp.exe"
2752-
chmod 755 "$UPDATE_HOME/.local/bin/codebase-memory-mcp.exe"
2753+
# Keep the managed canonical absent until WINDOWS_PAYLOAD installs the
2754+
# authenticated two-link launcher layout below.
2755+
:
27532756
else
27542757
cp "$BINARY" "$UPDATE_HOME/.local/bin/codebase-memory-mcp"
27552758
chmod 755 "$UPDATE_HOME/.local/bin/codebase-memory-mcp"

0 commit comments

Comments
 (0)