mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-10-22 16:35:20 +08:00
fix(skill): reconcile rebase with runner contracts
This commit is contained in:
@@ -411,7 +411,39 @@ async def test_cloud_core_skills_mount_generically_and_do_not_require_box_entitl
|
||||
)
|
||||
assert [skill['name'] for skill in await repository.list_skills(ineligible)] == ['docs-only']
|
||||
with pytest.raises(EntitlementUnavailableError):
|
||||
await service.execute_tool({'command': 'true'}, _query(ineligible, 92))
|
||||
await RunnerBoxService(service).acquire(ineligible, {'reuse_key': 'global'}, _query(ineligible, 92))
|
||||
finally:
|
||||
server_task.cancel()
|
||||
client_task.cancel()
|
||||
await runtime.shutdown()
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_activated_skill_mount_changes_recreate_shared_box_session(tmp_path):
|
||||
service, runtime, backend, entitlements, server_task, client_task = await _stack(tmp_path)
|
||||
context = _context('workspace-a')
|
||||
entitlements.snapshots[context.workspace_uuid] = _snapshot(context.workspace_uuid)
|
||||
try:
|
||||
first_query = await _bound_query(service, context, 101)
|
||||
await service.execute_tool({'command': 'echo before activation'}, first_query)
|
||||
assert len(backend.started_specs) == 1
|
||||
|
||||
skill = await service.ap.skill_repository.create_skill(
|
||||
context, {'name': 'demo', 'instructions': 'Run a script'}
|
||||
)
|
||||
second_query = await _bound_query(service, context, 102)
|
||||
skill_loader.register_activated_skill(second_query, skill)
|
||||
await service.execute_tool(
|
||||
{'command': 'echo with skill'},
|
||||
second_query,
|
||||
read_only_mounts=skill_loader.build_execution_mounts(service.ap, second_query),
|
||||
)
|
||||
assert len(backend.started_specs) == 2
|
||||
assert backend.stopped_sessions == [backend.started_specs[0].session_id]
|
||||
|
||||
await service.execute_tool({'command': 'echo first query again'}, first_query)
|
||||
assert len(backend.started_specs) == 3
|
||||
assert backend.stopped_sessions == [backend.started_specs[0].session_id] * 2
|
||||
finally:
|
||||
server_task.cancel()
|
||||
client_task.cancel()
|
||||
|
||||
Reference in New Issue
Block a user