feat(backends,jobs,telegram,conversations): mcp calls carry the conversation origin, quiet branches close asleep, fresh topics get named
This commit is contained in:
1 parent
7d812c7962
commit
944b68e275
9 files changed
+276
-15
No files matched your search
+33
-2
@@ -519,10 +519,10 @@ async def test_commands_status_merge_and_new(stack: Stack) -> None:
|
||||
frontend="telegram", external_id=f"{USER}/11"
|
||||
)
|
||||
assert branch.status == "merged"
|
||||
assert stack.bot.topics == ["🦫 General", "edit:11:✅ work"]
|
||||
assert stack.bot.topics == ["🦫 General", "edit:11:work", "edit:11:✅ work"]
|
||||
stack.bot.message("/new отчёт")
|
||||
await stack.until(lambda: stack.sent_with("in a new topic"), what="new topic")
|
||||
assert stack.bot.topics == ["🦫 General", "edit:11:✅ work", "отчёт"]
|
||||
assert stack.bot.topics[-1] == "отчёт"
|
||||
child = await stack.world.conversations.find_bound(
|
||||
frontend="telegram", external_id=f"{USER}/902"
|
||||
)
|
||||
@@ -1298,3 +1298,34 @@ def test_a_tool_call_between_progress_updates_starts_a_new_paragraph() -> None:
|
||||
)
|
||||
feed(_thinking_delta("now writing it back"))
|
||||
assert draft.text == "reading the note\n\nnow writing it back"
|
||||
|
||||
|
||||
async def test_a_closed_topic_is_marked_asleep_and_wakes_with_a_new_branch(
|
||||
stack: Stack,
|
||||
) -> None:
|
||||
stack.bot.message("кухня на неделю\nи ещё строка", thread=12)
|
||||
await stack.until(lambda: stack.sent_with("кухня на неделю"), what="reply")
|
||||
assert stack.bot.topics[-1] == "edit:12:кухня на неделю"
|
||||
branch = await stack.world.conversations.find_bound(
|
||||
frontend="telegram", external_id=f"{USER}/12"
|
||||
)
|
||||
closed = await stack.world.conversations.close(branch)
|
||||
assert await stack.world.conversations.mark_closed(closed)
|
||||
assert stack.bot.topics[-1] == "edit:12:💤 кухня на неделю"
|
||||
stack.tg._topic_names.clear() # noqa: SLF001
|
||||
stack.bot.message("а в четверг?", thread=12)
|
||||
await stack.until(lambda: stack.sent_with("а в четверг?"), what="new branch")
|
||||
assert stack.bot.topics[-1] == "edit:12:кухня на неделю"
|
||||
fresh = await stack.world.conversations.find_bound(
|
||||
frontend="telegram", external_id=f"{USER}/12"
|
||||
)
|
||||
assert fresh.id != branch.id
|
||||
assert fresh.status == "open"
|
||||
assert fresh.title == "кухня на неделю"
|
||||
|
||||
|
||||
async def test_a_named_topic_keeps_its_name(stack: Stack) -> None:
|
||||
stack.bot.topic_created("план", 13)
|
||||
stack.bot.message("hello", thread=13)
|
||||
await stack.until(lambda: stack.sent_with("hello"), what="reply")
|
||||
assert not any(t.startswith("edit:13:") for t in stack.bot.topics)
|
||||
Reference in new issue
Block a user