From 90b889394fb7f71510b0a63ed6124eed5c77f628 Mon Sep 17 00:00:00 2001 From: chengyongru Date: Fri, 11 Sep 2026 16:39:28 +0800 Subject: [PATCH] fix(email): disable intermediate progress delivery --- nanobot/channels/email/runtime.py | 6 ++++++ .../channels/email/tests/test_email_channel.py | 16 ++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/nanobot/channels/email/runtime.py b/nanobot/channels/email/runtime.py index f36cda50b..7e09a4eac 100644 --- a/nanobot/channels/email/runtime.py +++ b/nanobot/channels/email/runtime.py @@ -94,6 +94,8 @@ class EmailChannel(BaseChannel): name = "email" display_name = "Email" + send_progress = False + send_tool_hints = False _IMAP_MONTHS = ( "Jan", "Feb", @@ -128,6 +130,10 @@ class EmailChannel(BaseChannel): def default_config(cls) -> dict[str, Any]: return EmailConfig().model_dump(by_alias=True) + def progress_transport_defaults(self) -> tuple[bool, bool]: + """Email delivers one final reply instead of intermediate trace messages.""" + return False, False + def __init__(self, config: Any, bus: MessageBus): if isinstance(config, dict): config = EmailConfig.model_validate(config) diff --git a/nanobot/channels/email/tests/test_email_channel.py b/nanobot/channels/email/tests/test_email_channel.py index c26e53da9..60863b6ba 100644 --- a/nanobot/channels/email/tests/test_email_channel.py +++ b/nanobot/channels/email/tests/test_email_channel.py @@ -8,7 +8,10 @@ import pytest from nanobot.bus.events import OutboundMessage from nanobot.bus.outbound_events import ProgressEvent from nanobot.bus.queue import MessageBus +from nanobot.channels.base import BaseChannel from nanobot.channels.email.runtime import EmailChannel, EmailConfig +from nanobot.channels.manager import ChannelManager +from nanobot.config.schema import Config def _make_config(**overrides) -> EmailConfig: @@ -50,6 +53,19 @@ def _make_raw_email( return msg.as_bytes() +def test_email_only_enables_final_reply_delivery() -> None: + manager = ChannelManager.__new__(ChannelManager) + manager.config = Config.model_validate({"channels": {"email": {"enabled": True}}}) + manager.bus = MessageBus() + + channel = manager._build_channel("email", EmailChannel, {"enabled": True}) + + assert channel.send_progress is False + assert channel.send_tool_hints is False + assert channel.supports_streaming is False + assert type(channel).send_reasoning_delta is BaseChannel.send_reasoning_delta + + def test_fetch_new_messages_parses_unseen_and_marks_seen(monkeypatch) -> None: raw = _make_raw_email(subject="Invoice", body="Please pay")