From 4ae10a0999695dfc1e6b8485c7f108344aaa334d Mon Sep 17 00:00:00 2001 From: drknowhow Date: Thu, 24 Sep 2026 07:04:25 -0400 Subject: [PATCH] fix(mcp): first tool call hung on Windows while numpy loaded (2.149.1) The c3-initial-index thread loaded numpy's native module through chromadb while the server started its other threads; on Windows that deadlocked both, and the first tool call or c3_session save never answered. The server now imports numpy on the main thread before any background thread starts. test_codex_mcp_transport.py: 0/10 passes before, 10/10 after on the affected box; full suite 4607 passed. Claude-Session: https://claude.ai/code/session_01F6QMHB2mkrDJiQWfC1g9wy --- CHANGELOG.md | 13 +++++++++++++ cli/c3.py | 2 +- cli/mcp_server.py | 8 ++++++++ pyproject.toml | 2 +- 4 files changed, 23 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d932044..ff7dbc6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,19 @@ All notable changes to Code Context Control (C3) are documented here. The format is loosely based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [2.149.1] - 2026-09-24 + +### Fixed — the first tool call could hang forever on Windows + +When a project's embedding index was being built, the `c3-initial-index` +thread loaded numpy's native module (through chromadb) while the server was +starting its other threads. On Windows that deadlocked both, and the first +tool call, or the first `c3_session save`, never answered. The server now +imports numpy on the main thread before any background thread starts (about +75 ms at startup; skipped when numpy is not installed). +`tests/test_codex_mcp_transport.py` went from 0 of 10 passes to 10 of 10 on +the machine that showed it. + ## [2.149.0] - 2026-09-24 ### Added — the hub launches YOUR agent, not a command named `claude` diff --git a/cli/c3.py b/cli/c3.py index 30889be..cb6b6f7 100644 --- a/cli/c3.py +++ b/cli/c3.py @@ -91,7 +91,7 @@ # Config CONFIG_DIR = ".c3" CONFIG_FILE = ".c3/config.json" -__version__ = "2.149.0" +__version__ = "2.149.1" # The PreToolUse matcher for native subagent calls (installer and hub migration). AGENT_MATCHER = "Agent|Task" diff --git a/cli/mcp_server.py b/cli/mcp_server.py index 4eec5d7..eda3d10 100644 --- a/cli/mcp_server.py +++ b/cli/mcp_server.py @@ -192,6 +192,14 @@ def _notify_mcp_ready(svc) -> None: async def lifespan(server): """Initialize all services, auto-start session, start file watcher.""" project = PROJECT_PATH + # numpy's native module must load before any background thread exists: on + # Windows, loading it from c3-initial-index (via chromadb) while this + # process starts other threads deadlocks both, and the first tool call + # never answers. Absent numpy, nothing here needs it. + try: + import numpy # noqa: F401, PLC0415 + except ImportError: + pass services = build_runtime(project, ide_name=_IDE_NAME) if getattr(services, "time_tracker", None) is not None: try: diff --git a/pyproject.toml b/pyproject.toml index 55848f4..1dd2f43 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "code-context-control" -version = "2.149.0" +version = "2.149.1" description = "Local MCP code-intelligence for AI coding tools: surgical search/read/edit, agent-config version history, path-level access + masking guards, and a multi-project hub." readme = "README.md" requires-python = ">=3.10"