feat(config): add actionable startup diagnostics and WebUI recovery (#5110)

This commit is contained in:
chengyongru
2026-07-28 18:52:05 +08:00
committed by GitHub
parent 76ab04ac48
commit 0c6c0438d4
19 changed files with 1425 additions and 64 deletions
+20
View File
@@ -74,6 +74,26 @@ def test_from_config_missing_file():
Nanobot.from_config("/nonexistent/config.json")
def test_from_config_missing_env_reports_explicit_config_path(
tmp_path,
monkeypatch,
) -> None:
from nanobot.config.errors import ConfigLoadError
name = "NANOBOT_TEST_SDK_MISSING_KEY"
monkeypatch.delenv(name, raising=False)
config_path = tmp_path / "custom.json"
config_path.write_text(
json.dumps({"providers": {"openrouter": {"apiKey": f"${{{name}}}"}}}),
encoding="utf-8",
)
with pytest.raises(ConfigLoadError) as exc_info:
Nanobot.from_config(config_path)
assert exc_info.value.path == config_path.resolve()
def test_from_config_creates_instance(tmp_path):
config_path = _write_config(tmp_path)
bot = Nanobot.from_config(config_path, workspace=tmp_path)