The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
test(discord): keep the mention-gate control and cover the title rename between turns
unsupportedpastels9b6fc23baf26
diff --git a/tests/gateway/test_discord_auto_thread_prompt_parity.py b/tests/gateway/test_discord_auto_thread_prompt_parity.pyindex 72a6fe39d0a..0e8648c90c3 100644--- a/tests/gateway/test_discord_auto_thread_prompt_parity.py+++ b/tests/gateway/test_discord_auto_thread_prompt_parity.py@@ -2,7 +2,8 @@The first turn's source pointed at the new thread but took its topic from the parent text channel,while the thread's next message read the thread's own topic (none outside forums). ``Channel Topic``-is part of the pinned session-context prompt, so turn 2 re-rendered it.+is part of the pinned session-context prompt, so turn 2 re-rendered it. Hermes's title rename+between the turns is included, so both inputs that change on turn 2 are covered."""from __future__ import annotations@@ -25,6 +26,10 @@ class _Thread:def __init__(self, parent: SimpleNamespace) -> None:self.id, self.name, self.parent, self.parent_id = 800, "what-broke", parent, parent.idself.guild = parent.guild+ self.archived = False++ async def edit(self, *, name: str, reason: str | None = None) -> None:+ self.name = namedef _message(channel: object, message_id: int, *, mention: bool) -> SimpleNamespace:@@ -44,7 +49,7 @@ async def test_auto_thread_first_turn_pins_the_threads_topic(monkeypatch: pytestparent = SimpleNamespace(id=700, name="ops", topic="Incident triage", guild=guild)thread = _Thread(parent)adapter = DiscordAdapter(PlatformConfig(enabled=True, token="fake"))- adapter._client = SimpleNamespace(user=_BOT)+ adapter._client = SimpleNamespace(user=_BOT, get_channel=lambda _: thread)adapter._text_batch_delay_seconds = 0adapter._discord_history_backfill = lambda: Falseadapter._auto_create_thread = AsyncMock(return_value=thread)@@ -52,11 +57,17 @@ async def test_auto_thread_first_turn_pins_the_threads_topic(monkeypatch: pytestrunner = object.__new__(gateway_run.GatewayRunner)config = GatewayConfig(platforms={Platform.DISCORD: PlatformConfig(enabled=True, token="x")})+ assert not await adapter._handle_message(_message(parent, 99, mention=False))+ adapter._auto_create_thread.assert_not_awaited()+ adapter.handle_message.assert_not_awaited()prompts = []for channel, message_id, mention in ((parent, 100, True), (thread, 101, False)):assert await adapter._handle_message(_message(channel, message_id, mention=mention))source = adapter.handle_message.await_args.args[0].sourceassert source.chat_id == "800"prompts.append(runner._pinned_session_context_prompt(build_session_context(source, config), False, "k"))+ if message_id == 100:+ assert await adapter.rename_thread("800", "Database outage", only_if_current_name="what-broke")+ await adapter._on_platform_raw_thread_update(SimpleNamespace(thread_id=800, data={"name": "Database outage"}))adapter._auto_create_thread.assert_awaited_once()assert prompts[0] == prompts[1]