Self-evolving Context Database for AI Agents. Unify Agent Memory, Knowledge RAG and Skills.
Python agent-contextagent-memoryagent-pluginsagentic-ragcontext-databasedsh-pluginknowledge-basememorymemory-managementself-evolvingvector-database
fix(windows): handle stale PID locks and TUI console input (#790)
Andrew Barnes9884497df520
diff --git a/openviking/utils/process_lock.py b/openviking/utils/process_lock.pyindex 854f624f7..5b233ce3c 100644--- a/openviking/utils/process_lock.py+++ b/openviking/utils/process_lock.py@@ -42,6 +42,12 @@ def _is_pid_alive(pid: int) -> bool:except PermissionError:# Process exists but we can't signal it.return True+ except OSError:+ # On Windows, os.kill(pid, 0) raises OSError (WinError 87 "The+ # parameter is incorrect") for stale or invalid PIDs instead of+ # ProcessLookupError. Treat this as "not alive" so stale lock+ # files are correctly reclaimed.+ return Falsedef acquire_data_dir_lock(data_dir: str) -> str:diff --git a/openviking_cli/rust_cli.py b/openviking_cli/rust_cli.pyindex 084c25524..7242b454c 100644--- a/openviking_cli/rust_cli.py+++ b/openviking_cli/rust_cli.py@@ -18,11 +18,27 @@ Rust CLI 独立发布能力完全保留,用户可通过以下方式获取:"""import os+import subprocessimport sysfrom pathlib import Pathfrom shutil import which+def _exec_binary(binary: str, argv: list[str]) -> None:+ """Execute a binary, replacing the current process on Unix.++ On Windows, ``os.execv`` does not truly replace the process — CPython's+ MSVC implementation spawns a child process instead. This breaks console+ handle inheritance and prevents the Rust TUI from receiving keyboard+ input (see #587). We use ``subprocess.call`` on Windows to work around+ this.+ """+ if sys.platform == "win32":+ sys.exit(subprocess.call([binary] + argv))+ else:+ os.execv(binary, [binary] + argv)++def main():"""极简入口点:查找 ov 二进制并执行@@ -37,9 +53,7 @@ def main():# __file__ is openviking_cli/rust_cli.py, so parent is openviking_cli directorydev_binary = Path(__file__).parent.parent / "target" / "release" / "ov"if dev_binary.exists() and os.access(dev_binary, os.X_OK):- # 找到后立即 execv,不返回- args = [str(dev_binary)] + sys.argv[1:]- os.execv(str(dev_binary), args)+ _exec_binary(str(dev_binary), sys.argv[1:])except Exception:pass@@ -51,9 +65,7 @@ def main():for binary_name in ["ov", "ov.exe"]:binary = package_bin / binary_nameif binary.exists() and os.access(binary, os.X_OK):- # 找到后立即 execv,不返回- args = [str(binary)] + sys.argv[1:]- os.execv(str(binary), args)+ _exec_binary(str(binary), sys.argv[1:])except Exception:pass@@ -67,8 +79,7 @@ def main():first_bytes = f.read(2)# Skip if it starts with #! (shebang, likely Python script)if first_bytes != b"#!":- args = [path_binary] + sys.argv[1:]- os.execv(path_binary, args)+ _exec_binary(path_binary, sys.argv[1:])except Exception:pass