fix(backends,conversations,telegram,ui): a background subagent reports back as its own turn
This commit is contained in:
+18
-1
@@ -4,7 +4,7 @@ import contextlib
|
||||
import tempfile
|
||||
from pathlib import Path
|
||||
from types import SimpleNamespace
|
||||
from typing import Any
|
||||
from typing import Any, cast
|
||||
|
||||
import pytest
|
||||
from aiogram.exceptions import TelegramBadRequest, TelegramNetworkError
|
||||
@@ -16,6 +16,7 @@ from beaver_gateway.app import McpRegistry
|
||||
from beaver_gateway.backends.transcript import build_entries
|
||||
from beaver_gateway.frontends.base import GatewayRuntime
|
||||
from beaver_gateway.frontends.telegram import Attachments, TelegramFrontend
|
||||
from beaver_gateway.frontends.telegram.drafts import Draft
|
||||
from beaver_gateway.frontends.telegram.render import (
|
||||
LIMIT,
|
||||
chunks,
|
||||
@@ -719,6 +720,22 @@ def test_chunks_split_blockquote_and_stay_under_limit() -> None:
|
||||
assert " ".join(parts).split() == long_line.split()
|
||||
|
||||
|
||||
def test_draft_breaks_a_paragraph_after_a_tool_call() -> None:
|
||||
draft = Draft(cast("Any", None), chat_id=1, thread_id=None, turn_id="t")
|
||||
draft.append("Checking the balance.")
|
||||
draft.set_status("⏳ Bash")
|
||||
draft.set_status("✍️ writing")
|
||||
draft.append("It is 20 378.")
|
||||
assert draft.text == "Checking the balance.\n\nIt is 20 378."
|
||||
draft.set_status("⏳ Read")
|
||||
draft.append("\n\nAnd a list:")
|
||||
assert draft.text.endswith("It is 20 378.\n\nAnd a list:")
|
||||
fresh = Draft(cast("Any", None), chat_id=1, thread_id=None, turn_id="u")
|
||||
fresh.set_status("⏳ Bash")
|
||||
fresh.append("First words")
|
||||
assert fresh.text == "First words"
|
||||
|
||||
|
||||
def test_to_html_tail_inside_fence() -> None:
|
||||
full = (
|
||||
"intro\n```py\n" + "\n".join(f"code {i} <" for i in range(200)) + "\n```\nafter"
|
||||
|
||||
Reference in New Issue
Block a user