Your lightweight open-source personal agent.
Python agent-frameworkai-agentai-agentschatbotchatopsdiscord-botllm-agentsllmslocal-llmmcpmodel-context-protocolmulti-agentopenai-compatibleopenclawpersonal-ai-assistantpythonself-hostedtelegram-bot-ai-assistantwebuiworkflow-automation
test: remove obsolete nonexistence checks
chengyongru349528128277
diff --git a/nanobot/channels/email/tests/test_validation.py b/nanobot/channels/email/tests/test_validation.pyindex 914bb0d88..01e3da8be 100644--- a/nanobot/channels/email/tests/test_validation.py+++ b/nanobot/channels/email/tests/test_validation.py@@ -4,7 +4,7 @@ import pytestfrom nanobot.channels.email import validation as email_validationfrom nanobot.channels.validation import validate_channel_config-from nanobot.config.loader import load_config, save_config+from nanobot.config.loader import save_configfrom nanobot.config.schema import Config@@ -14,6 +14,7 @@ def test_validate_email_presets_are_checked_without_saving() -> None:config_path = tmp_path / "config.json"save_config(Config(), config_path)+ original_config = config_path.read_bytes()monkeypatch.setattr("nanobot.config.loader._current_config_path", config_path)monkeypatch.setattr(email_validation, "probe_tcp", lambda *_args, **_kwargs: None)@@ -32,7 +33,7 @@ def test_validate_email_presets_are_checked_without_saving(assert result["status"] == "connected"assert result["can_enable"] is True- assert not hasattr(load_config(config_path).channels, "email")+ assert config_path.read_bytes() == original_configdef test_validate_email_blocks_private_targets_when_local_access_is_disabled(diff --git a/nanobot/channels/websocket/tests/test_websocket_http_routes.py b/nanobot/channels/websocket/tests/test_websocket_http_routes.pyindex 5a9842e5b..72ea672ed 100644--- a/nanobot/channels/websocket/tests/test_websocket_http_routes.py+++ b/nanobot/channels/websocket/tests/test_websocket_http_routes.py@@ -341,26 +341,6 @@ async def test_sessions_list_and_thread_restore_transcript_without_canonical_filawait server_task-async def test_legacy_session_messages_route_is_not_exposed(- bus: MagicMock, tmp_path: Path-) -> None:- sm = _seed_session(tmp_path, key="websocket:legacy")- channel = _ch(bus, session_manager=sm, port=29919)- server_task = asyncio.create_task(channel.start())- try:- token = channel.gateway.tokens.issue_api_token(300)- response = await _http_get(- "http://127.0.0.1:29919/api/sessions/websocket:legacy/messages",- headers={"Authorization": f"Bearer {token}"},- )-- assert response.status_code == 404- finally:- await channel.stop()- await server_task--@pytest.mark.asyncioasync def test_session_automations_route_filters_by_webui_session(bus: MagicMock, tmp_path: Pathdiff --git a/nanobot/channels/whatsapp/tests/test_whatsapp_channel.py b/nanobot/channels/whatsapp/tests/test_whatsapp_channel.pyindex ce489e980..e3b80fa7a 100644--- a/nanobot/channels/whatsapp/tests/test_whatsapp_channel.py+++ b/nanobot/channels/whatsapp/tests/test_whatsapp_channel.py@@ -157,11 +157,9 @@ class _FailingConnectLoginClient(_FakeLoginClient):return asyncio.create_task(fail())-def test_default_config_has_no_bridge_fields() -> None:+def test_default_config_uses_native_database_path() -> None:config = WhatsAppChannel.default_config()- assert "bridgeUrl" not in config- assert "bridgeToken" not in configassert config["databasePath"] == ""diff --git a/tests/agent/test_builtin_weather_skill.py b/tests/agent/test_builtin_weather_skill.pyindex d94104ca5..ba01bfa7a 100644--- a/tests/agent/test_builtin_weather_skill.py+++ b/tests/agent/test_builtin_weather_skill.py@@ -9,7 +9,6 @@ def test_weather_skill_uses_windows_safe_single_today_request() -> None:assert "bare `curl` may resolve to `Invoke-WebRequest`" in normalizedassert "https://wttr.in/London?1&m" in contentassert 'curl.exe -s "https://wttr.in/Berlin.png" -o weather.png' in content- assert "/tmp/weather.png" not in contentassert ("Do not fetch current conditions separately when a today or forecast ""request already includes them."diff --git a/tests/agent/test_context_builder.py b/tests/agent/test_context_builder.pyindex b9114f968..ebc455693 100644--- a/tests/agent/test_context_builder.py+++ b/tests/agent/test_context_builder.py@@ -218,17 +218,14 @@ class TestBundledToolContract:assert "Do not use `exec` as a universal workaround" in contentassert "## File and Coding Workflows" in contentassert "`grep` returns matches with five context lines by default" in content- assert 'defaults to `output_mode="files_with_matches"`' not in contentassert "apply_patch" in contentassert "acceptance criteria into concrete checks" in contentassert "visual evidence reaches the model" in contentassert "clear user request as authorization" in contentassert "Never invent missing records or measurements" in content- assert "scientific fitting" not in contentassert "## Web and External Information" in contentassert "## Messaging and Media" in contentassert "## Scheduling and Background Work" in content- assert "pure coding" not in content.lower()def test_tool_contract_is_injected_without_workspace_file(self, tmp_path):builder = _builder(tmp_path)diff --git a/tests/agent/test_context_prompt_cache.py b/tests/agent/test_context_prompt_cache.pyindex b852e0f26..d94edfb1d 100644--- a/tests/agent/test_context_prompt_cache.py+++ b/tests/agent/test_context_prompt_cache.py@@ -80,8 +80,6 @@ def test_system_prompt_reflects_current_dream_memory_contract(tmp_path) -> None:assert "memory/history.jsonl" in promptassert "automatically managed by Dream" in promptassert "do not edit directly" in prompt- assert "memory/HISTORY.md" not in prompt- assert "write important facts here" not in promptdef test_provider_context_appended_after_user_content(tmp_path) -> None:@@ -137,28 +135,6 @@ def test_execution_rules_reach_existing_workspace_soul(tmp_path) -> None:assert soul_path.read_text(encoding="utf-8") == legacy_soul-def test_identity_has_no_behavioral_instructions(tmp_path) -> None:- """Identity template should not contain behavioral rules or hardcoded name."""- workspace = _make_workspace(tmp_path)- builder = ContextBuilder(workspace)-- identity = builder._get_identity(channel=None)- assert "You are nanobot" not in identity- assert "Act, don't narrate" not in identity- assert "Execution Rules" not in identity---def test_system_prompt_does_not_warn_about_message_time_markers(tmp_path) -> None:- """Parroting is prevented by not annotating assistant turns in history;- no prompt-level warning about ``[Message Time: ...]`` is needed."""- workspace = _make_workspace(tmp_path)- builder = ContextBuilder(workspace)-- prompt = builder.build_system_prompt()-- assert "Message Time" not in prompt--def test_default_soul_template_keeps_execution_policy_in_tool_contract() -> None:"""SOUL owns personality while the always-injected contract owns execution policy."""soul = (pkg_files("nanobot") / "templates" / "SOUL.md").read_text(encoding="utf-8")@@ -256,7 +232,6 @@ def test_fresh_workspace_omits_default_prompt_scaffolding(tmp_path) -> None:assert "## USER.md" not in promptassert "8281248569" not in promptassert "(your name)" not in prompt- assert "apt/brew" not in promptassert prompt.count("Do not use the 'message' tool for normal replies") == 1diff --git a/tests/agent/test_model_runtime_resolver.py b/tests/agent/test_model_runtime_resolver.pyindex b66d3c6c4..0fa97420f 100644--- a/tests/agent/test_model_runtime_resolver.py+++ b/tests/agent/test_model_runtime_resolver.py@@ -264,7 +264,6 @@ def test_refresh_clears_preset_when_new_default_has_same_snapshot_signature() ->assert refreshed is not Noneassert resolver.model_preset is Noneassert resolver.runtime.model_preset is None- assert "_active_preset" not in resolver.__dict__def test_resolver_refreshes_provider_generation_for_next_default_turn() -> None:diff --git a/tests/agent/test_runtime_refresh.py b/tests/agent/test_runtime_refresh.pyindex 0174d3873..7af7ee31f 100644--- a/tests/agent/test_runtime_refresh.py+++ b/tests/agent/test_runtime_refresh.py@@ -29,7 +29,7 @@ def _provider(default_model: str, max_tokens: int = 123) -> MagicMock:return provider-def test_provider_refresh_updates_only_runtime_resolver(tmp_path: Path) -> None:+def test_provider_refresh_updates_runtime_resolver(tmp_path: Path) -> None:old_provider = _provider("old-model")new_provider = _provider("new-model", max_tokens=456)loop = AgentLoop(@@ -53,36 +53,6 @@ def test_provider_refresh_updates_only_runtime_resolver(tmp_path: Path) -> None:assert loop.provider is new_providerassert loop.model == "new-model"assert loop.context_window_tokens == 2000- assert not hasattr(loop.runner, "provider")- assert not hasattr(loop.subagents, "provider")- assert not hasattr(loop.subagents, "model")- assert not hasattr(loop.subagents.runner, "provider")- assert not hasattr(loop.consolidator, "provider")- assert not hasattr(loop.consolidator, "model")- assert not hasattr(loop.consolidator, "context_window_tokens")- assert not hasattr(loop.consolidator, "max_completion_tokens")---def test_loop_has_no_mutable_runtime_mirrors_or_legacy_snapshot_api(tmp_path: Path) -> None:- loop = AgentLoop(- bus=MessageBus(),- provider=_provider("test-model"),- workspace=tmp_path,- model="test-model",- context_window_tokens=1000,- )-- assert {- "provider",- "model",- "context_window_tokens",- "model_presets",- "_active_preset",- "_provider_signature",- "_max_messages",- }.isdisjoint(loop.__dict__)- assert not hasattr(loop, "_apply_provider_snapshot")- assert not hasattr(loop, "_build_model_preset_snapshot")def test_llm_runtime_refreshes_provider_snapshot(tmp_path: Path) -> None:@@ -108,7 +78,6 @@ def test_llm_runtime_refreshes_provider_snapshot(tmp_path: Path) -> None:assert runtime.provider is new_providerassert runtime.model == "new-model"assert loop.provider is new_provider- assert not hasattr(loop.runner, "provider")def test_llm_runtime_surfaces_invalidated_config_errors(tmp_path: Path) -> None:diff --git a/tests/agent/test_self_model_preset.py b/tests/agent/test_self_model_preset.pyindex ed24fcf6d..0b38dfd83 100644--- a/tests/agent/test_self_model_preset.py+++ b/tests/agent/test_self_model_preset.py@@ -69,12 +69,8 @@ def test_model_preset_setter_updates_state(tmp_path) -> None:assert runtime.generation.temperature == 0.5assert runtime.generation.max_tokens == 4096assert runtime.generation.reasoning_effort == "low"- assert not hasattr(loop.subagents, "model")- assert not hasattr(loop.consolidator, "model")- assert not hasattr(loop.consolidator, "context_window_tokens")assert loop.llm_runtime().model == "openai/gpt-4.1"assert loop.llm_runtime().context_window_tokens == 32_768- assert not hasattr(loop.consolidator, "max_completion_tokens")assert loop.llm_runtime().generation.max_tokens == 4096@@ -122,13 +118,8 @@ def test_model_preset_setter_replaces_provider_from_snapshot(tmp_path) -> None:loop.set_model_preset("deep")assert loop.provider is new_provider- assert not hasattr(loop.runner, "provider")- assert not hasattr(loop.subagents, "provider")- assert not hasattr(loop.subagents.runner, "provider")- assert not hasattr(loop.consolidator, "provider")assert loop.model == "anthropic/claude-opus-4-5"assert loop.context_window_tokens == 200_000- assert not hasattr(loop.consolidator, "max_completion_tokens")assert loop.llm_runtime().generation.max_tokens == 2048@@ -151,10 +142,7 @@ def test_model_preset_setter_failure_leaves_old_state(tmp_path) -> None:assert loop.model_preset is Noneassert loop.model == "base-model"- assert not hasattr(loop.subagents, "model")- assert not hasattr(loop.consolidator, "model")assert loop.context_window_tokens == 1000- assert not hasattr(loop.consolidator, "max_completion_tokens")assert loop.llm_runtime().generation.max_tokens == 123diff --git a/tests/agent/test_subagent_lifecycle.py b/tests/agent/test_subagent_lifecycle.pyindex a082b427d..d230aa6b1 100644--- a/tests/agent/test_subagent_lifecycle.py+++ b/tests/agent/test_subagent_lifecycle.py@@ -102,20 +102,6 @@ class TestSubagentStatus:assert s.error is None-# ----------------------------------------------------------------------------# Runtime ownership-# ------------------------------------------------------------------------------class TestRuntimeOwnership:- def test_manager_has_no_provider_model_mirrors(self, tmp_path):- sm = _manager(tmp_path)- assert not hasattr(sm, "provider")- assert not hasattr(sm, "model")- assert not hasattr(sm, "context_window_tokens")- assert not hasattr(sm.runner, "provider")--class TestLegacyCompatibility:def test_accepts_exported_legacy_constructor_positionally(self, tmp_path):provider = MagicMock(spec=LLMProvider)@@ -132,8 +118,6 @@ class TestLegacyCompatibility:assert sm.workspace == tmp_pathassert sm.max_tool_result_chars == 16_000- assert not hasattr(sm, "provider")- assert not hasattr(sm, "model")@pytest.mark.asyncioasync def test_legacy_spawn_captures_runtime_at_admission(self, tmp_path):diff --git a/tests/agent/tools/test_runtime_control.py b/tests/agent/tools/test_runtime_control.pyindex 28dafec11..41cc124e9 100644--- a/tests/agent/tools/test_runtime_control.py+++ b/tests/agent/tools/test_runtime_control.py@@ -45,7 +45,6 @@ def test_agent_loop_assembles_my_tool_with_runtime_control(tmp_path: Path) -> Noassert isinstance(tool._runtime_control, RuntimeControl)assert isinstance(tool._runtime_control, AgentRuntimeControl)assert tool._runtime_control is not loop- assert not hasattr(tool, "_runtime_state")def test_runtime_snapshot_has_exact_allowlist_and_redacts_secrets(tmp_path: Path) -> None:diff --git a/tests/channels/test_channel_contracts.py b/tests/channels/test_channel_contracts.pyindex 884cb8187..a726c0e1d 100644--- a/tests/channels/test_channel_contracts.py+++ b/tests/channels/test_channel_contracts.py@@ -83,19 +83,6 @@ _SINGLE_PLUGIN = ChannelPlugin()-def test_management_contract_is_not_declared_on_runtime_base_class() -> None:- management_hooks = {- "feature_instances",- "instance_specs",- "runtime_name",- "supports_multiple_instances",- "update_instance_config",- }-- assert management_hooks.isdisjoint(BaseChannel.__dict__.keys())- assert "refresh_feature_metadata" in BaseChannel.__dict__--def test_multi_instance_support_is_declared_by_management_spec() -> None:assert _SINGLE_PLUGIN.management.multi_instance is Falseassert load_channel_plugin("feishu").management.multi_instance is Truediff --git a/tests/channels/test_channel_plugins.py b/tests/channels/test_channel_plugins.pyindex 6e5ac47c9..bdf989f5f 100644--- a/tests/channels/test_channel_plugins.py+++ b/tests/channels/test_channel_plugins.py@@ -265,10 +265,8 @@ def test_channels_config_getattr_returns_extra():assert section["enabled"] is True-def test_channels_config_has_no_per_channel_fields():- """After decoupling, ChannelsConfig has no explicit channel fields."""+def test_channels_config_keeps_shared_delivery_defaults():cfg = ChannelsConfig()- assert not hasattr(cfg, "telegram")assert cfg.send_progress is Trueassert cfg.send_tool_hints is Trueassert cfg.extract_document_text is Truediff --git a/tests/channels/test_channel_setup.py b/tests/channels/test_channel_setup.pyindex 5d2e58ae9..39c89d5fb 100644--- a/tests/channels/test_channel_setup.py+++ b/tests/channels/test_channel_setup.py@@ -98,7 +98,6 @@ def test_every_channel_is_a_self_contained_package() -> None:channel_dir = Path(channel_setup_module.__file__).parentpackage_names = {path.parent.name for path in channel_dir.glob("*/manifest.py")}- assert not hasattr(channel_setup_module, "CHANNEL_SETUP_SPECS")assert package_names == EXPECTED_CHANNELSassert set(discover_plugins()) == EXPECTED_CHANNELSfor name in EXPECTED_CHANNELS:@@ -106,7 +105,6 @@ def test_every_channel_is_a_self_contained_package() -> None:assert (package_dir / "__init__.py").is_file()assert (package_dir / "manifest.py").is_file()assert (package_dir / "runtime.py").is_file()- assert not (channel_dir / f"{name}.py").exists()plugin = load_channel_package(name)assert plugin is not None@@ -165,27 +163,6 @@ def test_channel_manifests_only_import_contract_modules() -> None:assert not unexpected, f"{name} imports runtime dependencies: {unexpected}"-def test_runtime_classes_do_not_declare_persisted_management_hooks() -> None:- channel_dir = Path(channel_setup_module.__file__).parent- management_hooks = {- "feature_instances",- "instance_specs",- "runtime_name",- "supports_multiple_instances",- "update_instance_config",- }- for name in EXPECTED_CHANNELS:- tree = ast.parse((channel_dir / name / "runtime.py").read_text(encoding="utf-8"))- declared = {- item.name- for node in tree.body- if isinstance(node, ast.ClassDef)- for item in node.body- if isinstance(item, (ast.FunctionDef, ast.AsyncFunctionDef))- }- assert declared.isdisjoint(management_hooks), f"{name} runtime owns {declared & management_hooks}"--def test_feishu_package_manifest_owns_runtime_and_webui_metadata() -> None:plugin = load_channel_package("feishu")diff --git a/tests/config/test_config_migration.py b/tests/config/test_config_migration.pyindex ae72b0032..6bc8010a0 100644--- a/tests/config/test_config_migration.py+++ b/tests/config/test_config_migration.py@@ -17,142 +17,6 @@ def _fake_resolve(host: str, results: list[str]):return _resolver-def test_load_config_keeps_max_tokens_and_ignores_legacy_memory_window(tmp_path) -> None:- config_path = tmp_path / "config.json"- config_path.write_text(- json.dumps(- {- "agents": {- "defaults": {- "maxTokens": 1234,- "memoryWindow": 42,- }- }- }- ),- encoding="utf-8",- )-- config = load_config(config_path)-- assert config.agents.defaults.max_tokens == 1234- assert config.agents.defaults.context_window_tokens == 200_000- assert not hasattr(config.agents.defaults, "memory_window")---def test_save_config_writes_context_window_tokens_but_not_memory_window(tmp_path) -> None:- config_path = tmp_path / "config.json"- config_path.write_text(- json.dumps(- {- "agents": {- "defaults": {- "maxTokens": 2222,- "memoryWindow": 30,- }- }- }- ),- encoding="utf-8",- )-- config = load_config(config_path)- save_config(config, config_path)- saved = json.loads(config_path.read_text(encoding="utf-8"))- defaults = saved["agents"]["defaults"]-- assert defaults["maxTokens"] == 2222- assert defaults["contextWindowTokens"] == 200_000- assert "memoryWindow" not in defaults---def test_onboard_does_not_crash_with_legacy_memory_window(tmp_path, monkeypatch) -> None:- config_path = tmp_path / "config.json"- workspace = tmp_path / "workspace"- config_path.write_text(- json.dumps(- {- "agents": {- "defaults": {- "maxTokens": 3333,- "memoryWindow": 50,- }- }- }- ),- encoding="utf-8",- )-- monkeypatch.setattr("nanobot.config.loader.get_config_path", lambda: config_path)- monkeypatch.setattr("nanobot.cli.commands.get_workspace_path", lambda _workspace=None: workspace)-- from typer.testing import CliRunner-- from nanobot.cli.commands import app- runner = CliRunner()- result = runner.invoke(app, ["onboard"], input="n\n")-- assert result.exit_code == 0--[email protected]("field_name", ["maxMessages", "max_messages"])-def test_load_config_ignores_legacy_max_messages(tmp_path, field_name) -> None:- config_path = tmp_path / "config.json"- config_path.write_text(- json.dumps({"agents": {"defaults": {field_name: 25, "maxTokens": 1234}}}),- encoding="utf-8",- )-- config = load_config(config_path)-- assert config.agents.defaults.max_tokens == 1234- assert not hasattr(config.agents.defaults, "max_messages")---def test_save_config_drops_legacy_max_messages(tmp_path) -> None:- config_path = tmp_path / "config.json"- config_path.write_text(- json.dumps({"agents": {"defaults": {"maxMessages": 25}}}),- encoding="utf-8",- )-- config = load_config(config_path)- save_config(config, config_path)- saved = json.loads(config_path.read_text(encoding="utf-8"))-- assert "maxMessages" not in saved["agents"]["defaults"]- assert "max_messages" not in saved["agents"]["defaults"]--[email protected]("field_name", ["failOnToolError", "fail_on_tool_error"])-def test_load_config_ignores_removed_fail_on_tool_error(tmp_path, field_name) -> None:- config_path = tmp_path / "config.json"- config_path.write_text(- json.dumps({"agents": {"defaults": {field_name: True, "maxTokens": 1234}}}),- encoding="utf-8",- )-- config = load_config(config_path)-- assert config.agents.defaults.max_tokens == 1234- assert not hasattr(config.agents.defaults, "fail_on_tool_error")---def test_save_config_drops_removed_fail_on_tool_error(tmp_path) -> None:- config_path = tmp_path / "config.json"- config_path.write_text(- json.dumps({"agents": {"defaults": {"failOnToolError": True}}}),- encoding="utf-8",- )-- config = load_config(config_path)- save_config(config, config_path)- saved = json.loads(config_path.read_text(encoding="utf-8"))-- assert "failOnToolError" not in saved["agents"]["defaults"]- assert "fail_on_tool_error" not in saved["agents"]["defaults"]--def test_onboard_refresh_backfills_missing_channel_fields(tmp_path, monkeypatch) -> None:from nanobot.channels.plugin import load_channel_packagediff --git a/tests/config/test_dream_config.py b/tests/config/test_dream_config.pyindex a40eb1cca..feff587a0 100644--- a/tests/config/test_dream_config.py+++ b/tests/config/test_dream_config.py@@ -52,22 +52,3 @@ def test_dream_config_uses_model_override_name_and_accepts_legacy_model() -> Nonassert cfg.model_override == "openrouter/sonnet"assert dumped["modelOverride"] == "openrouter/sonnet"assert "model" not in dumped---def test_dream_config_ignores_retired_noop_fields() -> None:- cfg = DreamConfig.model_validate(- {- "maxBatchSize": 99,- "maxIterations": 99,- "annotateLineAges": False,- }- )-- dumped = cfg.model_dump(by_alias=True)-- assert not hasattr(cfg, "max_batch_size")- assert not hasattr(cfg, "max_iterations")- assert not hasattr(cfg, "annotate_line_ages")- assert "maxBatchSize" not in dumped- assert "maxIterations" not in dumped- assert "annotateLineAges" not in dumpeddiff --git a/tests/config/test_gateway_config.py b/tests/config/test_gateway_config.pyindex e8323a32d..c48602079 100644--- a/tests/config/test_gateway_config.py+++ b/tests/config/test_gateway_config.py@@ -13,12 +13,3 @@ def test_gateway_restart_mode_accepts_camel_alias():def test_gateway_restart_mode_rejects_unknown_value():with pytest.raises(ValueError):GatewayConfig(restart_mode="service")---def test_heartbeat_ignores_removed_retention_limit():- config = Config.model_validate(- {"gateway": {"heartbeat": {"keepRecentMessages": 8}}}- )-- heartbeat = config.model_dump(by_alias=True)["gateway"]["heartbeat"]- assert "keepRecentMessages" not in heartbeatdiff --git a/tests/config/test_model_presets.py b/tests/config/test_model_presets.pyindex 470eb05ca..d01903a5f 100644--- a/tests/config/test_model_presets.py+++ b/tests/config/test_model_presets.py@@ -275,20 +275,6 @@ def test_model_presets_accepts_camel_case_root_key() -> None:assert config.model_presets["fast"].provider == "openai"-def test_legacy_model_preset_label_is_ignored() -> None:- config = Config.model_validate({- "modelPresets": {- "gpt-5-6-sol": {- "label": "Codex",- "model": "openai-codex/gpt-5.6-luna",- }- }- })-- assert set(config.model_presets) == {"gpt-5-6-sol"}- assert "label" not in config.model_presets["gpt-5-6-sol"].model_dump()--@pytest.mark.parametrize("model_presets",[diff --git a/tests/session/test_session_store.py b/tests/session/test_session_store.pyindex 58777848e..ce715f3a6 100644--- a/tests/session/test_session_store.py+++ b/tests/session/test_session_store.py@@ -1,18 +1,12 @@import jsonfrom unittest.mock import MagicMock-import nanobot.session as session_apifrom nanobot.providers.base import ProviderConversationStatefrom nanobot.session import Session, SessionManagerfrom nanobot.session.manager import SessionStorefrom nanobot.session.model_selection import SESSION_MODEL_PRESET_METADATA_KEY-def test_store_types_are_not_public_session_api() -> None:- assert not hasattr(session_api, "SessionStore")- assert not hasattr(session_api, "JsonlSessionStore")--def test_manager_delegates_persistence_to_store(tmp_path) -> None:stored = Session(key="cli:test")stored.add_message("user", "hello")diff --git a/tests/test_nanobot_facade.py b/tests/test_nanobot_facade.pyindex efb3c8dba..e9b3afb2f 100644--- a/tests/test_nanobot_facade.py+++ b/tests/test_nanobot_facade.py@@ -472,13 +472,6 @@ async def test_ephemeral_run_does_not_invoke_persisted_turn_callback(tmp_path):assert seen == []-def test_runtime_client_does_not_expose_generic_event_subscription():- from nanobot.sdk.clients import RuntimeClient-- assert hasattr(RuntimeClient, "on_session_turn_persisted")- assert not hasattr(RuntimeClient, "subscribe")--def test_import_from_top_level():import nanobot@@ -742,7 +735,6 @@ async def test_run_model_overrides_can_overlap_without_default_mutation(tmp_pathconfig_path = _write_config(tmp_path)bot = Nanobot.from_config(config_path, workspace=tmp_path)- assert not hasattr(bot, "_runtime_overrides")original_runtime = bot._loop.runtime_resolver.runtimeactive_runs: list[tuple[str, str]] = []first_entered = asyncio.Event()@@ -824,7 +816,6 @@ async def test_run_model_override_is_per_run_without_default_mutation(tmp_path):async def fake_process_direct(message, *, session_key, hooks, runtime):assert runtime is override_runtime- assert not hasattr(bot._loop.runner, "provider")assert runtime.model == "openai/gpt-4.1-mini"assert runtime.context_window_tokens == 4096assert bot._loop.runtime_resolver.runtime is original_runtime@@ -840,7 +831,6 @@ async def test_run_model_override_is_per_run_without_default_mutation(tmp_path):model_preset=None,config=bot._config,)- assert not hasattr(bot._loop.runner, "provider")assert bot._loop.runtime_resolver.runtime is original_runtimediff --git a/tests/test_truncate_text_shadowing.py b/tests/test_truncate_text_shadowing.pyindex 11132b511..1415b9a42 100644--- a/tests/test_truncate_text_shadowing.py+++ b/tests/test_truncate_text_shadowing.py@@ -1,25 +1,9 @@-import inspectfrom types import SimpleNamespace-def test_sanitize_persisted_blocks_truncate_text_shadowing_regression() -> None:- """Regression: avoid bool param shadowing imported truncate_text.-- Buggy behavior (historical):- - loop.py imports `truncate_text` from helpers- - `_sanitize_persisted_blocks(..., truncate_text: bool=...)` uses same name- - when called with `truncate_text=True`, function body executes `truncate_text(text, ...)`- which resolves to bool and raises `TypeError: 'bool' object is not callable`.-- This test asserts the fixed API exists and truncation works without raising.- """-+def test_sanitize_persisted_blocks_truncates_text() -> None:from nanobot.agent.loop import AgentLoop- sig = inspect.signature(AgentLoop._sanitize_persisted_blocks)- assert "should_truncate_text" in sig.parameters- assert "truncate_text" not in sig.parameters-dummy = SimpleNamespace(max_tool_result_chars=5)content = [{"type": "text", "text": "0123456789"}]diff --git a/tests/tools/test_read_enhancements.py b/tests/tools/test_read_enhancements.pyindex ef72fd8b3..0a4ab0768 100644--- a/tests/tools/test_read_enhancements.py+++ b/tests/tools/test_read_enhancements.py@@ -40,10 +40,6 @@ class TestReadDescriptionFix:tool = ReadFileTool()assert "image" in tool.description.lower()- def test_description_no_longer_says_cannot_read_images(self):- tool = ReadFileTool()- assert "cannot read binary files or images" not in tool.description.lower()-# ---------------------------------------------------------------------------# Read deduplication@@ -542,7 +538,3 @@ class TestReadDescriptionUpdate:tool = ReadFileTool()desc = tool.description.lower()assert "document" in desc or "docx" in desc or "xlsx" in desc or "pptx" in desc-- def test_description_no_longer_says_cannot_read(self):- tool = ReadFileTool()- assert "cannot read" not in tool.description.lower()diff --git a/tests/tools/test_search_tools.py b/tests/tools/test_search_tools.pyindex 61dd8302b..b39f0c4f0 100644--- a/tests/tools/test_search_tools.py+++ b/tests/tools/test_search_tools.py@@ -702,13 +702,11 @@ async def test_grep_uses_a_larger_bounded_limit_for_an_explicit_file(assert "skipped 1 large files" in capped_result-def test_grep_schema_is_concise_and_keeps_legacy_aliases_hidden(tmp_path: Path) -> None:+def test_grep_schema_is_concise_and_hides_internal_limits(tmp_path: Path) -> None:tool = GrepTool(workspace=tmp_path, allowed_dir=tmp_path)properties = tool.parameters["properties"]assert len(tool.description) < 150- assert "2 MB" not in tool.description- assert "100 MB" not in tool.descriptionassert "head_limit" in propertiesassert "max_matches" not in propertiesassert "max_results" not in propertiesdiff --git a/tests/utils/test_webui_workspaces.py b/tests/utils/test_webui_workspaces.pyindex 4e3d70e20..04d340421 100644--- a/tests/utils/test_webui_workspaces.py+++ b/tests/utils/test_webui_workspaces.py@@ -1,4 +1,3 @@-import jsonfrom unittest.mock import MagicMockimport pytest@@ -28,35 +27,6 @@ def test_workspace_state_defaults_when_file_missing(tmp_path, monkeypatch) -> Noassert webui_workspace_state_path() == tmp_path / "webui" / "workspace-state.json"-def test_workspace_state_ignores_legacy_project_history(tmp_path, monkeypatch) -> None:- monkeypatch.setattr("nanobot.webui.workspaces.get_webui_dir", lambda: tmp_path / "webui")- project = tmp_path / "project"- project.mkdir()- path = webui_workspace_state_path()- path.parent.mkdir(parents=True, exist_ok=True)- path.write_text(- json.dumps(- {- "recent_projects": [- {"project_path": str(project)},- {"project_path": str(tmp_path / "missing")},- ],- "last_scope": {- "project_path": str(project),- "access_mode": "full",- },- }- ),- encoding="utf-8",- )-- state = read_webui_workspace_state()-- assert "recent_projects" not in state- assert "last_scope" not in state- assert state["default_access_mode"] == "default"--def test_workspace_payload_is_config_data_dir_scoped(tmp_path, monkeypatch) -> None:monkeypatch.setattr("nanobot.webui.workspaces.get_webui_dir", lambda: tmp_path / "webui")default = tmp_path / "default"