fix(sandbox): preserve PermissionError messages and allow /mnt/user-data root in resolve_local_tool_path

Co-authored-by: WillemJiang <219644+WillemJiang@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-03-06 02:18:35 +00:00
parent cfad26b684
commit 036035dae0
2 changed files with 35 additions and 8 deletions

View File

@@ -36,6 +36,28 @@ def test_mask_local_paths_in_output_hides_host_paths() -> None:
assert "/mnt/user-data/workspace/result.txt" in masked
def test_resolve_local_tool_path_resolves_valid_virtual_path() -> None:
thread_data = {
"workspace_path": "/tmp/deer-flow/threads/t1/user-data/workspace",
"uploads_path": "/tmp/deer-flow/threads/t1/user-data/uploads",
"outputs_path": "/tmp/deer-flow/threads/t1/user-data/outputs",
}
result = resolve_local_tool_path("/mnt/user-data/workspace/report.txt", thread_data)
assert result == "/tmp/deer-flow/threads/t1/user-data/workspace/report.txt"
def test_resolve_local_tool_path_allows_virtual_root() -> None:
thread_data = {
"workspace_path": "/tmp/deer-flow/threads/t1/user-data/workspace",
"uploads_path": "/tmp/deer-flow/threads/t1/user-data/uploads",
"outputs_path": "/tmp/deer-flow/threads/t1/user-data/outputs",
}
result = resolve_local_tool_path("/mnt/user-data", thread_data)
assert result == "/tmp/deer-flow/threads/t1/user-data"
def test_resolve_local_tool_path_rejects_non_virtual_path() -> None:
thread_data = {
"workspace_path": "/tmp/deer-flow/threads/t1/user-data/workspace",