mirror of
https://github.com/HKUDS/nanobot.git
synced 2026-09-02 17:22:06 +03:00
* refactor(agent): consolidate accepted history under pressure * fix(agent): align provider and session compaction * refactor(agent): simplify runner context compaction * refactor(agent): remove background token consolidation * fix(agent): keep injected transcript messages distinct * refactor(agent): unify native compaction summaries * fix(agent): preserve native compaction boundary * fix(agent): unify context compaction paths * fix(agent): preserve exact compaction request boundaries
25 lines
751 B
Python
25 lines
751 B
Python
import pytest
|
|
|
|
from nanobot.config.schema import Config, GatewayConfig
|
|
|
|
|
|
def test_gateway_restart_mode_accepts_camel_alias():
|
|
config = Config.model_validate({"gateway": {"restartMode": "exit"}})
|
|
|
|
assert config.gateway.restart_mode == "exit"
|
|
assert config.model_dump(by_alias=True)["gateway"]["restartMode"] == "exit"
|
|
|
|
|
|
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 heartbeat
|