Repository navigation
Windows v0.8.1: stale graph + Permission denied on delete_project after orphan cbm process (reconfirm #277) #914
Description
Summary
Just confirming that the symptoms from #277 ("New files not indexed on Windows") are still present in v0.8.1 on Windows 11. The same workaround from that issue (kill orphan codebase-memory-mcp.exe processes, delete the .db* files, reindex) is still the only thing that reliably gets the graph back in sync. New files added after the first index simply don't show up until a full reset.
Related: #520 ("watcher misses file creation") is also still open.
Environment
- Version:
0.8.1 - OS: Windows 11 (10.0.22631), x86_64
- Install: official
install.ps1 --ui, single static binary at%LOCALAPPDATA%\Programs\codebase-memory-mcp\ - Agents: Claude Code (
~/.claude/.mcp.json,~/.claude.json) and opencode (~/.config/opencode/opencode.jsonc), both with--ui=true --port=9749 - Config:
auto_index=true,auto_watch=trueto start with (I ended up turningauto_watchoff, see below) - Cache:
~/.cache/codebase-memory-mcp/
What happens
I indexed a Rust project, then added some new files (a new module plus a few fixture files) on disk. When I tried to reindex:
index_repositorycomes back withincremental.noop reason=no_changesand the exact same node/edge counts as before (626/1298), even though the new files are right there on disk and git-tracked (git ls-files --error-unmatchfinds them).delete_projectreturnsstatus:"delete_failed", error:"Permission denied"because the SQLite.dbis still held open by a leftover cbm process.search_graphfor the new symbols (DomainSubdomains,run_scan, etc.) returnstotal: 0.- After killing all cbm processes and wiping the DB, a fresh
index_repositoryreportedpipeline.discover files=54while the actual directory tree (excluding.git,.vscode,target,node_modules,dist,src-tauri/gen) had 97 files. The reindex did pick them up in the end (+206 nodes / +735 edges), so the parser is fine; it's the incremental path that keeps seeing "no changes" when there clearly are changes.
So on Windows this seems to have two faces:
- Stale hash table + orphan lock (per New files not indexed — WAL-checkpoint blocked on successfully-indexed project (Windows, v0.6.0) #277): the incremental reindex thinks nothing changed because it can't checkpoint new writes into the main
.db. - Discovery undercount: even from a clean cache,
pipeline.discover files=Nunderstates the on-disk file count. It still parses and indexes everything, but the log line is misleading when you're trying to diagnose a stale index.
Repro
# 1. Index a Rust repo via opencode (stdio MCP)
cd <your-rust-repo>
# (opencode spawns codebase-memory-mcp.exe as MCP server; let it index)
codebase-memory-mcp cli index_repository '{\"repo_path\":\"<absolute/path/to/repo>\"}'
# -> nodes: 626, edges: 1298 (baseline)
# 2. Add a new .rs module file plus a fixture file on disk
# (real edit in your editor; git-tracked, not gitignored)
# 3. Attempt explicit reindex
codebase-memory-mcp cli index_repository '{\"repo_path\":\"<absolute/path/to/repo>\"}'
# -> incremental.noop reason=no_changes
# -> nodes: 626, edges: 1298 (UNCHANGED; files on disk are newer)
# 4. Attempt delete
codebase-memory-mcp cli delete_project '{\"project\":\"<derived-project-name>\"}'
# -> status: delete_failed, error: Permission denied
# 5. Confirm orphan cbm processes exist
Get-Process -Name 'codebase-memory-mcp*' | Select Id, StartTime
# -> one process dating from before the new files were added (e.g. uptime 70 min)
# 6. Workaround (validates #277's root cause)
Get-Process -Name 'codebase-memory-mcp*' | Stop-Process -Force
Remove-Item \"$env:USERPROFILE\.cache\codebase-memory-mcp\<project-name>.db*\"
codebase-memory-mcp cli index_repository '{\"repo_path\":\"<absolute/path/to/repo>\"}'
# -> nodes: 832, edges: 2034 (+206 / +735)
# search_graph for the new symbol -> total: 1 CORRECTWorkaround script
I dropped this at %LOCALAPPDATA%\Programs\codebase-memory-mcp\cbm-reset.ps1 and run it after each Stage commit. Sharing in case other Windows users hit the same wall. It kills the orphans, deletes the stale DB, and reindexes:
[CmdletBinding()]
param(
[Parameter(Position=0)] [string]$RepoPath = (Get-Location).Path,
[switch]$ListOnly
)
$projectName = (($RepoPath -replace '[\\/]+','-') -replace '^-','' -replace '-$','') -replace ':',''
$cacheDir = Join-Path $env:USERPROFILE '.cache\codebase-memory-mcp'
$dbFiles = Get-ChildItem $cacheDir -Filter \"$projectName.db*\" -ErrorAction SilentlyContinue
if ($ListOnly) {
if (-not $dbFiles) { Write-Host \"No DB for $projectName\" } else {
$dbFiles | ForEach-Object { Write-Host (\" - {0} ({1} KB, mod {2})\" -f $_.Name, [int]($_.Length/1KB), $_.LastWriteTime) }
}
$procs = Get-Process -Name 'codebase-memory-mcp*' -ErrorAction SilentlyContinue
Write-Host (\"Live cbm processes: {0}\" -f @($procs).Count)
$procs | Select Id, StartTime | Format-Table -AutoSize
return
}
if ($dbFiles) {
Write-Host \"Killing orphan codebase-memory-mcp.exe processes (releases SQLite locks)...\"
Get-Process -Name 'codebase-memory-mcp*' -ErrorAction SilentlyContinue | Stop-Process -Force -ErrorAction SilentlyContinue
Start-Sleep -Seconds 2
$dbFiles | ForEach-Object { Remove-Item -LiteralPath $_.FullName -Force }
}
Write-Host \"Reindexing $RepoPath ...\"
& codebase-memory-mcp cli index_repository ('{\"repo_path\":\"' + ($RepoPath -replace '\\','/') + '\"}')
Write-Host \"Done. Restart Claude Code / opencode so they spawn a fresh MCP server.\"What I had to give up
To stop the orphan accumulation I set auto_watch=false. The cost is losing the live-edit auto-sync; I now run cbm-reset.ps1 after each Stage commit and restart the agent. The daily workflow is fine, but the live-edit capability advertised in the README doesn't reliably work on Windows in v0.8.1.
Suggestions (reiterating #277, all still applicable)
- On
delete_project: runPRAGMA wal_checkpoint(TRUNCATE)before touching files on disk. - On stdio-close: trap stdio EOF / SIGTERM and run
PRAGMA wal_checkpoint(TRUNCATE)plus a clean exit before the OS forces an orphan. - On startup: detect a stale
.db-walpast a threshold (10 MB?) and either force-checkpoint or warn loudly. - Audit the Windows discovery path:
pipeline.discover files=Ndoesn't match the on-disk file count even from a clean cache. That might be benign (N counts parsable units, not raw files), but the mismatch is confusing when you're trying to track down a stale index. - Document the orphan-process failure mode in the README troubleshooting section.
Happy to attach a cbm-diagnostics-<pid>.ndjson from a repro session if that'd be useful, just let me know which pid (orphan vs. new spawn) you'd want and I'll capture it with CBM_DIAGNOSTICS=1.
Activity
DeusData commentedon Jul 7, 2026
Thanks for reconfirming the Windows stale-graph/delete behavior on v0.8.1. Triage: high-priority Windows stability/UX issue under #394.
This sounds related to the watcher/process-lifecycle and project-locking work, but it needs its own reproduction so we know whether the orphan process, WAL sidecars, or watcher state is the root cause. The workaround details are helpful.
github-actions commentedon Jul 8, 2026
Thanks for the report! To move this forward we need a bit more so we can reproduce it ourselves:
codebase-memory-mcp --versionyou're onOnce that's here we'll pick it straight back up. Heads-up: issues left
awaiting-reporterare automatically closed after a few weeks of silence, but a comment reopens the door anytime.DeusData commentedon Jul 8, 2026
v0.9.0 includes several Windows runtime, watcher, project lifecycle, and UI surfacing fixes that may affect this stale graph and delete failure path. Could you retest on v0.9.0 and report whether the old graph still appears or deletion still fails? Marking awaiting-reporter.
github-actions commentedon Jul 30, 2026
This issue has been waiting on more information for 21 days (a version, exact steps, or a public repro), so it's now marked
stale. It will be closed in 14 days if there's no update — just add a comment to keep it open. We're happy to pick it back up the moment we can reproduce it.DeusData commentedon Aug 14, 2026
@ibrahimqureshae — this issue is carrying both
awaiting-reporterandstale, on a report that arrived complete: baseline node/edge counts,incremental.noop reason=no_changesagainst files that are on disk and git-tracked,Permission deniedondelete_projecttraced to a leftover process holding the database, and thepipeline.discover files=54undercount against 97 real files.That was always enough to work from, and asking you to retest before we had reproduced it ourselves is what put the stale bot on your case. Please do not read those labels as us ignoring you — nothing here is your move.
Honest status: not root-caused. The open question is whether the orphan process, the WAL sidecars, or the watcher state is the cause, and the abandoned-server lifetime described in #1083 looks related. Tonight's v0.10.5 is being cut for the issues that make cbm impossible to operate, and a graph that silently stops matching the code is one of them.
fix(main): exit Windows stdio servers when the spawning client dies (D…
fix(main): exit Windows stdio servers when the spawning client dies (D…
fix(main): exit Windows stdio servers when the spawning client dies (D…
fix(main): exit Windows stdio servers when the spawning client dies (D…
fix(main): exit Windows stdio servers when the spawning client dies (D…
fix(main): exit Windows stdio servers when the spawning client dies (D…
fix(main): exit Windows stdio servers when the spawning client dies (D…
fix(main): exit Windows stdio servers when the spawning client dies (D…
Merge pull request #1874 from LazyXuan/fix/windows-parent-watchdog
DeusData commentedon Sep 7, 2026
Fixed on main by 5e5405c (PR #1874, thank you @LazyXuan): a Windows stdio server now exits when the client that spawned it dies, instead of lingering on stdin and pinning WAL read locks. Ships in v0.10.9.
fix(main): exit Windows stdio servers when the spawning client dies (D…