Skip to content

Commit 11920b5

Browse files
committed
fix(tests): update tests for unified skill exec path and renamed create_app
- test_box_mcp_integration: import create_app instead of create_ws_relay_app - test_box_integration: add query.variables for template session_id - test_skill_tools: mock box_service.execute_tool instead of execute_spec_payload since skill exec now goes through the unified execute_tool path
1 parent dc1ba9a commit 11920b5

3 files changed

Lines changed: 29 additions & 19 deletions

File tree

tests/integration_tests/box/test_box_integration.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,13 @@ async def test_full_service_to_remote_runtime(tmp_path):
308308
service = BoxService(mock_ap, client=client)
309309
await service.initialize()
310310

311-
query = pipeline_query.Query.model_construct(query_id=42)
311+
query = pipeline_query.Query.model_construct(
312+
query_id=42,
313+
variables={
314+
'launcher_type': 'person',
315+
'launcher_id': 'test_user',
316+
},
317+
)
312318
result = await service.execute_tool(
313319
{'command': 'echo service-path'},
314320
query,
@@ -317,7 +323,7 @@ async def test_full_service_to_remote_runtime(tmp_path):
317323
assert result['ok'] is True
318324
assert result['status'] == 'completed'
319325
assert 'service-path' in result['stdout']
320-
assert result['session_id'] == '42'
326+
assert result['session_id'] == 'person_test_user'
321327
finally:
322328
server_task.cancel()
323329
client_task.cancel()

tests/integration_tests/box/test_box_mcp_integration.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
from langbot_plugin.box.errors import BoxSessionNotFoundError
2727
from langbot_plugin.box.models import BoxManagedProcessSpec, BoxManagedProcessStatus, BoxSpec
2828
from langbot_plugin.box.runtime import BoxRuntime
29-
from langbot_plugin.box.server import BoxServerHandler, create_ws_relay_app
29+
from langbot_plugin.box.server import BoxServerHandler, create_app
3030

3131
_logger = logging.getLogger('test.box.mcp_integration')
3232

@@ -121,7 +121,7 @@ async def box_server():
121121
await runtime.initialize()
122122

123123
# Start ws relay for managed process attach
124-
ws_app = create_ws_relay_app(runtime)
124+
ws_app = create_app(runtime)
125125
ws_server = TestServer(ws_app)
126126
await ws_server.start_server()
127127

tests/unit_tests/provider/test_skill_tools.py

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,7 @@ def test_detect_skill_activations_returns_unique_ordered_skills(self):
9292
'beta': _make_skill_data(name='beta'),
9393
}
9494

95-
response = (
96-
'[ACTIVATE_SKILL: alpha]\n'
97-
'[ACTIVATE_SKILL: beta]\n'
98-
'[ACTIVATE_SKILL: alpha]\n'
99-
'Let me handle this.'
100-
)
95+
response = '[ACTIVATE_SKILL: alpha]\n[ACTIVATE_SKILL: beta]\n[ACTIVATE_SKILL: alpha]\nLet me handle this.'
10196

10297
assert mgr.detect_skill_activations(response) == ['alpha', 'beta']
10398
assert mgr.detect_skill_activation(response) == 'alpha'
@@ -240,7 +235,9 @@ async def test_create_skill_creates_managed_prompt_only_skill(self):
240235

241236
ap = _make_ap()
242237
ap.skill_service = SimpleNamespace(
243-
create_skill=AsyncMock(return_value=_make_skill_data(name='prompt-skill', package_root='/data/skills/prompt-skill')),
238+
create_skill=AsyncMock(
239+
return_value=_make_skill_data(name='prompt-skill', package_root='/data/skills/prompt-skill')
240+
),
244241
reload_skills=AsyncMock(),
245242
list_skills=AsyncMock(return_value=[]),
246243
)
@@ -329,7 +326,9 @@ async def test_update_skill_updates_managed_prompt_only_skill(self):
329326
ap = _make_ap()
330327
ap.skill_service = SimpleNamespace(
331328
create_skill=AsyncMock(),
332-
update_skill=AsyncMock(return_value=_make_skill_data(name='time-now', package_root='/data/skills/time-now')),
329+
update_skill=AsyncMock(
330+
return_value=_make_skill_data(name='time-now', package_root='/data/skills/time-now')
331+
),
333332
reload_skills=AsyncMock(),
334333
list_skills=AsyncMock(return_value=[]),
335334
)
@@ -523,12 +522,18 @@ async def test_exec_in_activated_skill_mount_rewrites_command_and_refreshes(self
523522
ap.box_service = SimpleNamespace(
524523
available=True,
525524
default_host_workspace=tmpdir,
526-
execute_spec_payload=AsyncMock(return_value={'ok': True}),
525+
execute_tool=AsyncMock(return_value={'ok': True}),
527526
)
528527
ap.skill_mgr = SimpleNamespace(refresh_skill_from_disk=Mock())
529528
loader = NativeToolLoader(ap)
530529

531-
query = SimpleNamespace(query_id='q1', launcher_type='person', launcher_id='123', variables={})
530+
query = SimpleNamespace(
531+
query_id='q1',
532+
launcher_type='person',
533+
launcher_id='123',
534+
variables={},
535+
pipeline_config=None,
536+
)
532537
register_activated_skill(query, _make_skill_data(name='demo', package_root=tmpdir))
533538

534539
result = await loader.invoke_tool(
@@ -541,11 +546,10 @@ async def test_exec_in_activated_skill_mount_rewrites_command_and_refreshes(self
541546
)
542547

543548
assert result == {'ok': True}
544-
spec_payload = ap.box_service.execute_spec_payload.await_args.args[0]
545-
assert spec_payload['cmd'] == 'python /workspace/scripts/run.py'
546-
assert spec_payload['workdir'] == '/workspace'
547-
assert spec_payload['host_path'] == tmpdir
548-
assert spec_payload['session_id'] == 'skill-person_123-demo'
549+
call_params = ap.box_service.execute_tool.await_args.args[0]
550+
# The command is passed through to execute_tool (no rewriting in the unified model)
551+
assert 'python' in call_params['command']
552+
assert '/workspace/.skills/demo' in call_params['command']
549553
ap.skill_mgr.refresh_skill_from_disk.assert_called_once_with('demo')
550554

551555
@pytest.mark.asyncio

0 commit comments

Comments
 (0)