Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion sgr_agent_core/services/overlayfs_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def _get_run_command_config_candidates(config: GlobalConfig) -> list[RunCommandT
tool_config_dict = runcommand_def.tool_kwargs()
candidates.append(RunCommandToolConfig(**tool_config_dict))
for agent_def in config.agents.values():
_, tool_configs = AgentFactory._resolve_tools_with_configs(agent_def.tools, config)
_, tool_configs = AgentFactory._resolve_tools_with_configs(agent_def.tools)
if "runcommandtool" in tool_configs:
candidates.append(RunCommandToolConfig(**tool_configs["runcommandtool"]))
return candidates
Expand Down
10 changes: 7 additions & 3 deletions tests/test_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
- Config reading (if needed)
"""

import sys
import tempfile
from pathlib import Path
from unittest.mock import AsyncMock, MagicMock, patch
Expand Down Expand Up @@ -337,15 +338,18 @@ async def test_run_command_tool_unsafe_mode_runs_subprocess(self):

@pytest.mark.asyncio
async def test_run_command_tool_uses_workspace_path_as_cwd(self):
"""RunCommandTool with workspace_path runs command with cwd set to
workspace_path."""
"""RunCommandTool with workspace_path runs subprocess with cwd set to
workspace_path (print cwd via same Python as test runner)."""
from sgr_agent_core.models import AgentContext

tmp = Path(__file__).resolve().parent
tool = RunCommandTool(reasoning="Test", command="pwd")
command = f'"{sys.executable}" -c "import os; print(os.getcwd())"'
tool = RunCommandTool(reasoning="Test", command=command)
context = AgentContext()
config = MagicMock()
result = await tool(context, config, mode="unsafe", workspace_path=str(tmp))
print(result)
print(tmp.name)
assert tmp.name in result or str(tmp) in result

@pytest.mark.asyncio
Expand Down
Loading