Skip to content

fix(ui): enumerate codebase-memory-mcp processes on Windows#955

Open
EightDoor wants to merge 1 commit into
DeusData:mainfrom
EightDoor:fix/windows-process-enumeration
Open

fix(ui): enumerate codebase-memory-mcp processes on Windows#955
EightDoor wants to merge 1 commit into
DeusData:mainfrom
EightDoor:fix/windows-process-enumeration

Conversation

@EightDoor

Copy link
Copy Markdown

Problem

On Windows, the Control Panel's Active Processes tab always shows empty because handle_processes in src/ui/http_server.c only queries the current process via GetProcessMemoryInfo/GetProcessTimes and returns "processes":[]. The POSIX path uses popen("ps") to enumerate all codebase-memory-mcp instances.

Closes #50

Solution

Added Windows process enumeration via CreateToolhelp32Snapshot + Process32First/Process32Next to find all codebase-memory-mcp.exe instances. For each matching process:

  • Open via OpenProcess with PROCESS_QUERY_INFORMATION | PROCESS_VM_READ
  • Read CPU time via GetProcessTimes (user + system)
  • Read memory via GetProcessMemoryInfo (WorkingSetSize)
  • Calculate elapsed time from creation timestamp
  • Output in matching JSON format with is_self flag

Changes

  • src/ui/http_server.c: Added #include <tlhelp32.h> and ~70 lines of process enumeration logic

Edge Cases Handled

  • OpenProcess failure (skips process)
  • GetProcessMemoryInfo/GetProcessTimes failure (zeros fallback)
  • CreateToolhelp32Snapshot failure (returns empty array)
  • Buffer overflow protection consistent with POSIX path

Test Plan

  • CI: build-windows / build-windows-arm64 jobs compile successfully
  • Manual: Open Control Panel on Windows with multiple codebase-memory-mcp instances, verify Active Processes tab shows all instances with CPU/memory/elapsed values

Windows handle_processes previously returned an empty processes array
because it only queried the current process via GetProcessMemoryInfo/
GetProcessTimes. POSIX uses popen("ps") to enumerate all instances.

Add process enumeration via CreateToolhelp32Snapshot + Process32First/
Process32Next to find all codebase-memory-mcp.exe processes, query per-
process CPU/memory/elapsed time via OpenProcess + GetProcessTimes +
GetProcessMemoryInfo, and return them in the JSON response.

Closes DeusData#50
@EightDoor EightDoor requested a review from DeusData as a code owner July 8, 2026 10:17
@DeusData DeusData added bug Something isn't working windows Windows-specific issues ux/behavior Display bugs, docs, adoption UX priority/normal Standard review queue; useful PR with ordinary maintainer urgency. labels Jul 8, 2026
@DeusData

DeusData commented Jul 8, 2026

Copy link
Copy Markdown
Owner

Thanks for taking the Windows UI process-list gap. Triage: Windows local-UI bug for #950, normal priority. Review focus is access-denied handling, stable JSON shape, and avoiding exposure of more process detail than the UI needs.

@DeusData DeusData added this to the 0.9.1-rc milestone Jul 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working priority/normal Standard review queue; useful PR with ordinary maintainer urgency. ux/behavior Display bugs, docs, adoption UX windows Windows-specific issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Multiple instances of codebase-memory-mcp.exe running and 2 databases in the same project.

2 participants