feat(telegram): add per-chat/topic default agents (#109)

This commit is contained in:
banteg
2026-01-13 04:11:16 +04:00
committed by GitHub
parent 6ce08ee602
commit f060d3b59c
13 changed files with 660 additions and 31 deletions
+7
View File
@@ -11,18 +11,21 @@ async def test_topic_state_store_roundtrip(tmp_path) -> None:
store = TopicStateStore(path)
context = RunContext(project="proj", branch="feat/topic")
await store.set_context(1, 10, context)
await store.set_default_engine(1, 10, "claude")
await store.set_session_resume(1, 10, ResumeToken(engine="codex", value="abc123"))
snapshot = await store.get_thread(1, 10)
assert snapshot is not None
assert snapshot.context == context
assert snapshot.sessions == {"codex": "abc123"}
assert snapshot.default_engine == "claude"
store2 = TopicStateStore(path)
snapshot2 = await store2.get_thread(1, 10)
assert snapshot2 is not None
assert snapshot2.context == context
assert snapshot2.sessions == {"codex": "abc123"}
assert snapshot2.default_engine == "claude"
@pytest.mark.anyio
@@ -47,3 +50,7 @@ async def test_topic_state_store_clear_and_find(tmp_path) -> None:
snapshot = await store.get_thread(2, 20)
assert snapshot is not None
assert snapshot.context is None
await store.clear_default_engine(2, 20)
snapshot = await store.get_thread(2, 20)
assert snapshot is not None
assert snapshot.default_engine is None