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(compile): keep the compile workspace root absolute (#6376) (#6387)
TINGyu1236446545bb2a4714
diff --git a/bot/tests/test_compile_execution.py b/bot/tests/test_compile_execution.pyindex 218ed94b7..0fa66d0ae 100644--- a/bot/tests/test_compile_execution.py+++ b/bot/tests/test_compile_execution.py@@ -2,6 +2,7 @@import asynciofrom collections import Counter+from pathlib import Pathfrom types import SimpleNamespacefrom unittest.mock import AsyncMock@@ -10,8 +11,9 @@ from vikingbot.compile import reviewfrom vikingbot.compile.models import CompileLimitsfrom vikingbot.compile.pipeline_io import JsonModel, ModelCallLimitErrorfrom vikingbot.compile.plan import Contract, Node, ReviewDecision+from vikingbot.compile.sandbox import CompileSandboxManager, _CompileSandboxfrom vikingbot.compile.service import BotCompileService-from vikingbot.config.schema import Config+from vikingbot.config.schema import Config, SessionKeyfrom vikingbot.providers.base import LLMResponse, ToolCallRequest@@ -104,3 +106,30 @@ async def test_direct_reads_stop_repetition_but_allow_progress(case):await resultassert provider.chat.await_count == (len(offsets) + 1 if case == "progress" else 4)assert provider.chat.await_args.kwargs["thinking"] is False+++def test_compile_workspace_root_is_absolute_for_relative_storage(tmp_path, monkeypatch):+ """A relative storage.workspace must not reach sandbox subprocess paths (#6376)."""+ state_root = tmp_path / "state"+ state_root.mkdir()+ monkeypatch.chdir(state_root)+ config = Config(storage_workspace="data")+ config.ov_server.set_effective_auth_mode("dev")+ manager = CompileSandboxManager(+ config,+ config.bot_data_path / "compile_workspaces" / "task-1",+ config.workspace_path,+ connection={},+ )+ expected = (state_root / "data" / "bot" / "compile_workspaces" / "task-1").resolve()+ assert manager.workspace == expected++ # The credentials path is injected into sandbox shell commands, whose working+ # directory is the workspace itself; a relative path would resolve twice.+ workspace = manager.get_workspace_path(+ SessionKey(type="compile", channel_id="task-1", chat_id="task-1")+ )+ sandbox = _CompileSandbox(SimpleNamespace(sandbox_cwd=str(workspace)))+ config_path = Path(sandbox._config_path)+ assert config_path.is_absolute()+ assert config_path.is_relative_to(manager.workspace)diff --git a/bot/vikingbot/compile/sandbox.py b/bot/vikingbot/compile/sandbox.pyindex 9a933551d..597a8a6ce 100644--- a/bot/vikingbot/compile/sandbox.py+++ b/bot/vikingbot/compile/sandbox.py@@ -37,7 +37,15 @@ class CompileSandboxManager(SandboxManager):connection: Mapping[str, Any],):"""Snapshot verified connection fields; reject missing non-dev tenant/user identity."""- super().__init__(config, sandbox_parent_path, source_workspace_path)+ # storage.workspace may be configured as a relative path, which Docker+ # deployments commonly rely on by running the server from the state root.+ # Sandbox subprocesses use the workspace as their working directory, so a+ # relative root makes server-side paths built from sandbox_cwd (task+ # credentials, staged skill resources) resolve against that directory and+ # fail; keep the compile workspace root absolute.+ super().__init__(+ config, Path(sandbox_parent_path).expanduser().resolve(), source_workspace_path+ )dev = config.ov_server.effective_auth_mode == "dev"if not dev and (not connection.get("account_id") or not connection.get("user_id")):raise ValueError("Compile shell requires the authenticated account and user")