fix(email): disable intermediate progress delivery
This commit is contained in:
1 parent
4e865b91ee
commit
90b889394f
2 files changed
+22
No files matched your search
@@ -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)
|
||||
|
||||
@@ -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")
|
||||
|
||||
|
||||
Reference in new issue
Block a user