Skip to content

Windows msvc build#78

Open
davidmacro wants to merge 3 commits into
Jakedismo:mainfrom
davidmacro:windows-msvc-build
Open

Windows msvc build#78
davidmacro wants to merge 3 commits into
Jakedismo:mainfrom
davidmacro:windows-msvc-build

Conversation

@davidmacro
Copy link
Copy Markdown

Pull Request

Description

Add windows compilation support; prompted by me, engineered by Claude, reviewed and tested by myself.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Performance improvement
  • Code refactoring
  • CI/CD changes

Testing

  • [ x] Tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • [ x] New and existing unit tests pass locally with my changes
  • I have added integration tests if applicable

Performance Impact

  • No performance impact expected
  • Performance improvement (include benchmarks if applicable)
  • Potential performance regression (explain and provide mitigation)

Security Considerations

  • No security implications
  • Security review completed
  • Dependency security audit passed

Documentation

  • Code is self-documenting with clear variable names and logic
  • [] Comments added for complex logic
  • [] README updated if applicable
  • API documentation updated if applicable

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • [] I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

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.

davidmacro and others added 3 commits May 25, 2026 00:57
…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>
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread start-surrealdb.bat
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"
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

Comment on lines +310 to +313
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);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant