Skip to content

Self-evolving Context Database for AI Agents. Unify Agent Memory, Knowledge RAG and Skills.

fix(vectordb): handle Windows 11 platform.machine() empty string and circular import (#3019)

Dae9036d3fd60af
diff --git a/openviking/storage/vectordb/engine/__init__.py b/openviking/storage/vectordb/engine/__init__.py
index 29e71d3d3..6936855c8 100644
--- a/openviking/storage/vectordb/engine/__init__.py
+++ b/openviking/storage/vectordb/engine/__init__.py
@@ -33,11 +33,29 @@ _WINDOWS_DLL_DIR_HANDLES = []
def _is_x86_machine(machine: str | None = None) -> bool:
normalized = (machine or platform.machine() or "").strip().lower()
+ # platform.machine() returns empty string on some Windows 11 builds.
+ # Default to x86 on Windows since ARM is not yet widely deployed.
+ if not normalized:
+ return sys.platform == "win32"
return any(token in normalized for token in ("x86_64", "amd64", "x64", "i386", "i686"))
def _module_exists(module_name: str) -> bool:
- return importlib.util.find_spec(f".{module_name}", __name__) is not None
+ try:
+ return importlib.util.find_spec(f".{module_name}", __name__) is not None
+ except ModuleNotFoundError:
+ # During module initialization find_spec may fail because __path__
+ # is not yet assigned. Fall back to checking the filesystem.
+ module_path = Path(__file__).resolve().parent
+ if not module_path.is_dir():
+ return False
+ try:
+ for fn in os.listdir(str(module_path)):
+ if fn in (f"{module_name}.pyd", f"{module_name}.abi3.pyd"):
+ return True
+ except OSError:
+ return False
+ return False
def _available_variants(is_x86: bool) -> tuple[str, ...]: