chore(agent-runner): remove split-out incidental fixes

This commit is contained in:
huanghuoguoguo
2026-06-14 21:20:31 +08:00
parent 9037d7f592
commit 0a71747eec
9 changed files with 14 additions and 167 deletions
@@ -11,7 +11,6 @@ from __future__ import annotations
import pytest
from alembic.script import ScriptDirectory
from sqlalchemy import inspect, text
from sqlalchemy.ext.asyncio import create_async_engine
from langbot.pkg.entity.persistence.base import Base
@@ -148,42 +147,6 @@ class TestSQLiteMigrationUpgrade:
rev2 = await get_alembic_current(sqlite_engine)
assert rev2 == rev1, f"Expected {rev1}, got {rev2}"
@pytest.mark.asyncio
async def test_upgrade_repairs_head_stamped_mcp_readme_column(self, sqlite_engine):
"""
A database may already be stamped at the previous head while missing a
column added by an earlier guarded migration. Upgrade should still
repair mcp_servers.readme so startup ORM queries do not fail.
"""
async with sqlite_engine.begin() as conn:
await conn.execute(
text(
"""
CREATE TABLE mcp_servers (
uuid VARCHAR(255) NOT NULL PRIMARY KEY,
name VARCHAR(255) NOT NULL,
enable BOOLEAN NOT NULL,
mode VARCHAR(255) NOT NULL,
extra_args JSON NOT NULL,
created_at DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL,
updated_at DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL
)
"""
)
)
await run_alembic_stamp(sqlite_engine, '7b2c1d9e4f30')
await run_alembic_upgrade(sqlite_engine, 'head')
async with sqlite_engine.connect() as conn:
columns = await conn.run_sync(
lambda sync_conn: {column['name'] for column in inspect(sync_conn).get_columns('mcp_servers')}
)
assert 'readme' in columns
assert await get_alembic_current(sqlite_engine) == alembic_head_revision()
class TestSQLiteMigrationFreshDatabase:
"""Tests for fresh database workflow."""
@@ -49,30 +49,6 @@ class TestExtractDepsMetadata:
assert 'flask' in task_context.metadata['deps_list']
assert 'numpy' in task_context.metadata['deps_list']
def test_extract_plugin_identity_includes_version(self):
"""Extract plugin identity and version from manifest.yaml."""
connector = self._create_connector()
zip_buffer = io.BytesIO()
with zipfile.ZipFile(zip_buffer, 'w') as zf:
zf.writestr(
'manifest.yaml',
'\n'.join(
[
'metadata:',
' author: langbot-team',
' name: LangRAG',
' version: 0.1.8',
]
),
)
assert connector._inspect_plugin_package(zip_buffer.getvalue(), None) == (
'langbot-team',
'LangRAG',
'0.1.8',
)
def test_extract_deps_empty_requirements(self):
"""Handle empty requirements.txt."""
connector = self._create_connector()
@@ -1,6 +1,5 @@
from __future__ import annotations
import asyncio
from types import SimpleNamespace
from unittest.mock import AsyncMock, Mock
@@ -115,28 +114,6 @@ def test_token_manager_next_token_ignores_empty_token_list():
assert token_mgr.using_token_index == 0
@pytest.mark.asyncio
async def test_model_manager_initialize_skips_space_sync_after_timeout():
ap = SimpleNamespace()
ap.discover = SimpleNamespace(get_components_by_kind=Mock(return_value=[]))
ap.instance_config = SimpleNamespace(data={'space': {'models_sync_timeout': 0.01}})
ap.logger = Mock()
mgr = ModelManager(ap)
mgr.load_models_from_db = AsyncMock()
async def slow_sync():
await asyncio.sleep(1)
mgr.sync_new_models_from_space = AsyncMock(side_effect=slow_sync)
await mgr.initialize()
mgr.load_models_from_db.assert_awaited_once()
mgr.sync_new_models_from_space.assert_awaited_once()
ap.logger.warning.assert_any_call('LangBot Space model sync timed out after 0.01s, skipping startup sync.')
@pytest.mark.asyncio
async def test_updated_llm_model_is_immediately_usable_by_local_agent_pipeline():
from langbot.pkg.api.http.service.model import LLMModelsService