fix(telegram): brief-seeded branches reply and stream in their topic

This commit is contained in:
hh
2026-08-28 19:21:03 +02:00
parent c88726db9e
commit e469e7e174
2 changed files with 22 additions and 5 deletions
@@ -648,9 +648,7 @@ class TelegramFrontend(Frontend):
return
match kind:
case "turn.start":
if event.get("origin") == "user" and not str(
event.get("item_origin") or ""
).startswith("сид"):
if event.get("origin") == "user":
await self._open_draft(key, event, target)
case "stream":
self._feed_draft(key, event)
@@ -672,8 +670,6 @@ class TelegramFrontend(Frontend):
key=f"{event.get('turn_id')}:error",
)
case "reply":
if str(event.get("item_origin") or "").startswith("сид"):
return
await self._on_reply(conv, event)
case "say":
await self._deliver(
+21
View File
@@ -474,6 +474,27 @@ async def test_commands_status_merge_and_new(stack: Stack) -> None:
assert stack.bot.topics[-1] == "edit:902:✅ отчёт"
async def test_brief_branch_from_the_tool_replies_in_its_topic(stack: Stack) -> None:
stack.bot.message("hi")
await stack.until(lambda: stack.sent_with("hi"), what="reply")
master = await stack.world.conversations.find_bound(
frontend="telegram", external_id=GENERAL
)
child = await stack.world.conversations.spawn(
kind="branch",
seed="brief",
text="найди X",
title="X",
parent=master,
origin="mcp",
)
reply = await stack.until(lambda: stack.sent_with("найди X"), what="brief reply")
assert reply["thread"] == 902
assert not any(m["text"].startswith("📝") for m in stack.bot.sent)
assert any(d["message_thread_id"] == 902 for d in stack.bot.drafts)
assert (await stack.world.conversations.get(child.external_id)).flags == {}
async def test_master_topic_survives_rotation(stack: Stack) -> None:
stack.bot.message("hi")
await stack.until(lambda: stack.sent_with("hi"), what="reply")