fix(mcp): stabilize shared box managed processes

This commit is contained in:
Junyan Qin
2026-05-19 00:45:35 +08:00
parent 747ea069aa
commit 257d9d3a65
7 changed files with 187 additions and 27 deletions

View File

@@ -23,7 +23,7 @@ import pytest
from aiohttp.test_utils import TestServer
from langbot_plugin.box.client import ActionRPCBoxClient
from langbot_plugin.box.errors import BoxSessionNotFoundError
from langbot_plugin.box.errors import BoxManagedProcessNotFoundError, BoxSessionNotFoundError
from langbot_plugin.box.models import BoxManagedProcessSpec, BoxManagedProcessStatus, BoxSpec
from langbot_plugin.box.runtime import BoxRuntime
from langbot_plugin.box.server import BoxServerHandler, create_ws_relay_app
@@ -169,6 +169,13 @@ async def test_managed_process_start_and_query(box_server):
assert info2.status == BoxManagedProcessStatus.RUNNING
assert info2.command == 'sh'
# Stop only the managed process while keeping the session available
await client.stop_managed_process('mcp-int-lifecycle')
with pytest.raises(BoxManagedProcessNotFoundError):
await client.get_managed_process('mcp-int-lifecycle')
session_info = await client.get_session('mcp-int-lifecycle')
assert session_info['session_id'] == 'mcp-int-lifecycle'
# Cleanup
await client.delete_session('mcp-int-lifecycle')