mirror of
https://github.com/HKUDS/nanobot.git
synced 2026-08-17 01:26:40 +03:00
refactor: move MCP lifecycle out of AgentLoop (#5343)
This commit is contained in:
@@ -493,20 +493,6 @@ class TestModifyOpen:
|
||||
assert "Set workspace" in result
|
||||
assert tool._runtime_control.snapshot().workspace == "/new/path"
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_modify_mcp_servers_blocked(self):
|
||||
"""_mcp_servers contains API credentials — must be blocked."""
|
||||
tool = _make_tool()
|
||||
result = await tool.execute(action="set", key="_mcp_servers", value={"evil": "leaked"})
|
||||
assert "protected" in result
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_modify_mcp_stacks_blocked(self):
|
||||
"""_mcp_stacks holds connection handles — must be blocked."""
|
||||
tool = _make_tool()
|
||||
result = await tool.execute(action="set", key="_mcp_stacks", value={})
|
||||
assert "protected" in result
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_modify_pending_queues_blocked(self):
|
||||
"""_pending_queues controls message routing — must be blocked."""
|
||||
@@ -535,13 +521,6 @@ class TestModifyOpen:
|
||||
result = await tool.execute(action="set", key="_background_tasks", value=[])
|
||||
assert "protected" in result
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_inspect_mcp_servers_blocked(self):
|
||||
"""_mcp_servers contains credentials — check must be blocked too."""
|
||||
tool = _make_tool()
|
||||
result = await tool.execute(action="check", key="_mcp_servers")
|
||||
assert "not accessible" in result
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_modify_wrapped_denied(self):
|
||||
"""__wrapped__ allows decorator bypass — must be denied."""
|
||||
|
||||
Reference in New Issue
Block a user