From fda43b3812cb9e0d2be3c7f553e4e5c879bd38e4 Mon Sep 17 00:00:00 2001 From: QueryPlanner Date: Sun, 24 May 2026 08:38:48 +0530 Subject: [PATCH 1/2] fix: use default SQLite path in tool registry - Update build_tool_config_from_env to use default SQLite path when SQLITE_PATH env var is not set - Match behavior of server.py lifespan which already uses default - Update test to expect default path instead of None --- src/blacki/registry.py | 7 ++++++- tests/test_registry.py | 5 +++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/blacki/registry.py b/src/blacki/registry.py index 1c9a4d0..35cd4ca 100644 --- a/src/blacki/registry.py +++ b/src/blacki/registry.py @@ -232,10 +232,15 @@ def build_tool_config_from_env() -> ToolConfig: import os skills_dir = Path(__file__).parent / "skills" + agent_dir = os.getenv("AGENT_DIR", str(Path(__file__).resolve().parent.parent)) + default_sqlite_path = str(Path(agent_dir) / ".adk" / "tools.db") + + sqlite_path_env = os.getenv("SQLITE_PATH", "").strip() or None + sqlite_path = sqlite_path_env or default_sqlite_path return ToolConfig( brave_search_api_key=os.getenv("BRAVE_SEARCH_API_KEY", "").strip() or None, - sqlite_path=os.getenv("SQLITE_PATH", "").strip() or None, + sqlite_path=sqlite_path, sandbox_enabled=os.getenv("SANDBOX_ENABLED", "false").strip().lower() in ("true", "1", "yes"), skills_dir=skills_dir, diff --git a/tests/test_registry.py b/tests/test_registry.py index b2fe365..3e5b0c5 100644 --- a/tests/test_registry.py +++ b/tests/test_registry.py @@ -105,12 +105,13 @@ class TestBuildToolConfigFromEnv: """Tests for build_tool_config_from_env function.""" def test_empty_env(self) -> None: - """Should return default config with empty env.""" + """Should return default config with default sqlite path.""" with patch.dict("os.environ", {}, clear=True): config = build_tool_config_from_env() assert config.brave_search_api_key is None - assert config.sqlite_path is None + assert config.sqlite_path is not None + assert config.sqlite_path.endswith(".adk/tools.db") assert config.sandbox_enabled is False assert config.skills_dir is not None From f872fedacb672151efc1946779a826f628a7c9bf Mon Sep 17 00:00:00 2001 From: QueryPlanner Date: Sun, 24 May 2026 08:56:11 +0530 Subject: [PATCH 2/2] refactor: simplify sqlite_path logic and add clarifying comment - Collapse sqlite_path assignment to single line - Add comment explaining path calculation matches server.py --- src/blacki/registry.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/blacki/registry.py b/src/blacki/registry.py index 35cd4ca..b4307fb 100644 --- a/src/blacki/registry.py +++ b/src/blacki/registry.py @@ -232,11 +232,11 @@ def build_tool_config_from_env() -> ToolConfig: import os skills_dir = Path(__file__).parent / "skills" + # Match server.py AGENT_DIR calculation (points to src/, not project root) agent_dir = os.getenv("AGENT_DIR", str(Path(__file__).resolve().parent.parent)) default_sqlite_path = str(Path(agent_dir) / ".adk" / "tools.db") - sqlite_path_env = os.getenv("SQLITE_PATH", "").strip() or None - sqlite_path = sqlite_path_env or default_sqlite_path + sqlite_path = os.getenv("SQLITE_PATH", "").strip() or default_sqlite_path return ToolConfig( brave_search_api_key=os.getenv("BRAVE_SEARCH_API_KEY", "").strip() or None,