Windows msvc build#78
Conversation
…d candle - codegraph-core: move tikv-jemallocator to cfg(not(target_env = "msvc")) and gate #[global_allocator] the same way; jemalloc-sys cannot build with MSVC so Windows silently falls back to the system allocator. - mmap.rs: update Windows prefetch to the windows-sys 0.61 API (WIN32_MEMORY_RANGE_ENTRY without the leading underscore; pass GetCurrentProcess() to PrefetchVirtualMemory). Add Win32_System_Threading to the windows-sys feature list. - codegraph-mcp-core, codegraph-mcp-server: gate nix to cfg(unix) and add windows-sys impls of is_process_running/graceful_shutdown/force_kill via OpenProcess + GetExitCodeProcess + TerminateProcess. Daemon graceful shutdown collapses to TerminateProcess on Windows. - codegraph-vector: split candle-* deps per target. macOS keeps the metal backend; Windows/Linux build CPU-only candle so embeddings-local still links without pulling in Apple-only objc2. - workspace + codegraph-mcp: pin autoagents/autoagents-derive to git rev 57ebeaa4. The published tarballs are incomplete and earlier revs contain a file whose name is invalid on NTFS, breaking cargo install on Windows. Adapt the local ChatProvider adapter to autoagents 0.3.7: rename chat -> chat_with_tools, drop the tools param from chat_stream, and change TierAwareReActAgent's description/name return types to &str. - Cargo.lock: refreshed so the newer proc-macro2/syn pulled in by autoagents 0.3.7 resolves cleanly. - Add install-codegraph.bat and start-surrealdb.bat at repo root to drive the Windows-safe install (intentionally avoids --all-features because it pulls in macOS-only crates). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
memmap2 0.9's Advice type and Mmap/MmapMut::advise() methods are cfg(unix) only, so referencing them unconditionally breaks `cargo check --workspace` on Windows. The advise() methods on MmapReader/MmapWriter are only called internally and only as kernel hints, so dropping them on Windows is safe. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Applies rustfmt to the four files this branch already modified: codegraph-core/src/lib.rs, codegraph-mcp-core/src/process.rs, codegraph-mcp-server/src/bin/codegraph.rs, and codegraph-vector/src/simd_ops.rs (the test-bug fix). Pre-existing formatting drift in unrelated files is intentionally not touched on this branch to keep the diff scoped to the Windows port. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a95a99d4d8
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| REM ABOUTME: Defaults match install-codegraph.bat; override via SURREAL_* env vars. | ||
| setlocal EnableExtensions | ||
|
|
||
| if not defined SURREAL_BIN set "SURREAL_BIN=%USERPROFILE%\.codegraph\bin\surreal.exe" |
There was a problem hiding this comment.
Fall back to PATH for SurrealDB executable
start-surrealdb.bat hard-codes SURREAL_BIN to %USERPROFILE%\.codegraph\bin\surreal.exe, but install-codegraph.bat installs SurrealDB via winget (or expects it on PATH) and then recommends running start-surrealdb.bat. In that common flow, the batch launcher exits with “binary not found” even though surreal is installed, so first-time Windows setup fails unless users manually copy the exe or set SURREAL_BIN.
Useful? React with 👍 / 👎.
| if handle.is_null() { | ||
| // OpenProcess fails if the process does not exist (or we lack rights). | ||
| // Treat as "not running" — the caller uses this to clean up stale PID files. | ||
| return Ok(false); |
There was a problem hiding this comment.
Distinguish access-denied from process-not-running
Treating any OpenProcess failure as Ok(false) conflates “process is gone” with “process is running but inaccessible” (for example, daemon started elevated and status checked from a non-elevated shell). In that case, status/cleanup paths will incorrectly report the daemon as stopped and can trigger stale-PID behavior; ERROR_ACCESS_DENIED should be surfaced (or handled separately) instead of being mapped to “not running”.
Useful? React with 👍 / 👎.
Pull Request
Description
Add windows compilation support; prompted by me, engineered by Claude, reviewed and tested by myself.
Type of Change
Testing
Performance Impact
Security Considerations
Documentation
Checklist
Related Issues
Fixes #(issue number)
Related to #(issue number)
Screenshots (if applicable)
Add screenshots to help explain the changes.
Additional Notes
Any additional information that would be helpful for reviewers.