fix(discord): skip backfill for auto-created threads and update test fakes
When auto-threading kicked in, the broadened backfill gate ran on the freshly-created thread — but the thread has no prior context to fetch, and the parent-channel reference passed to _fetch_channel_context would have leaked unrelated context (see #31467). Skip backfill when auto_threaded_channel is set. Also teach the _FakeTextChannel / _FakeThreadChannel test doubles to expose a no-op history() async generator so the broadened gate doesn't trip AttributeError → discord.Forbidden (MagicMock) → TypeError in the existing auto-thread tests. Add a regression test that asserts auto-threaded messages do not trigger backfill.
This commit is contained in:
@@ -4820,8 +4820,10 @@ class DiscordAdapter(BasePlatformAdapter):
|
||||
# recovery)
|
||||
# DMs skip entirely because every DM message triggers the bot,
|
||||
# so the session transcript already has everything.
|
||||
# Auto-threaded messages also skip — we just created the thread,
|
||||
# there's nothing prior to backfill.
|
||||
_has_mention_gap = require_mention and not is_free_channel and not in_bot_thread
|
||||
if _has_mention_gap or is_thread:
|
||||
if (_has_mention_gap or is_thread) and auto_threaded_channel is None:
|
||||
_backfill_text = await self._fetch_channel_context(
|
||||
message.channel, before=message,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user