diff --git a/gateway/platforms/base.py b/gateway/platforms/base.py index 98588648db0..516545469f0 100644 --- a/gateway/platforms/base.py +++ b/gateway/platforms/base.py @@ -5859,17 +5859,15 @@ class BasePlatformAdapter(ABC): media_files, response = self.extract_media(response) media_files = self.filter_media_delivery_paths(media_files) - # Deduplicate against media already delivered in prior turns. - # The model may echo a previous MEDIA: tag or bare file path in - # a later response; without this guard the same file is sent - # repeatedly. + # Do NOT deduplicate MEDIA tags against prior turns here. + # The auto-append path in GatewayRunner._run_agent_inner already + # deduplicates auto-appended tags via _collect_auto_append_media_tags + # with history_media_paths, so this filter would only catch explicit + # MEDIA tags the model deliberately included in its response — which + # must be preserved (user asked to resend an image, the model echoed + # a path intentionally, etc.). Bare-file-path dedup still applies + # to local_files below via the same _history_media_paths set. _history_media_paths = self._history_media_paths_for_session(session_key) - if _history_media_paths: - media_files = [ - (path, is_voice) - for path, is_voice in media_files - if path not in _history_media_paths - ] # Extract image URLs and send them as native platform attachments images, text_content = self.extract_images(response)