From 19cdb32f05391d99d2d5284cc40008236b4fd978 Mon Sep 17 00:00:00 2001 From: aran-yogesh Date: Tue, 24 Feb 2026 17:51:29 -0800 Subject: [PATCH] fix: use get_recent_comments() in multimodal fallback and fix NameError --- apps/agent/agent/webapp.py | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/apps/agent/agent/webapp.py b/apps/agent/agent/webapp.py index 59f07f23..4b5d828c 100644 --- a/apps/agent/agent/webapp.py +++ b/apps/agent/agent/webapp.py @@ -603,15 +603,11 @@ async def process_linear_issue( # noqa: PLR0912, PLR0915 comment_ids: set[str] = set() comment_id_to_index: dict[str, int] = {} if comments: - last_bot_comment_idx = -1 for i, comment in enumerate(comments): comment_id = comment.get("id", "") if comment_id: comment_ids.add(comment_id) comment_id_to_index[comment_id] = i - body = comment.get("body", "") - if any(body.startswith(prefix) for prefix in bot_message_prefixes): - last_bot_comment_idx = i relevant_comments = [] trigger_index = None @@ -624,18 +620,11 @@ async def process_linear_issue( # noqa: PLR0912, PLR0915 trigger_index, ) else: - for i, comment in enumerate(comments): - if i <= last_bot_comment_idx: - continue - body = comment.get("body", "") - if "@openswe" in body.lower(): - relevant_comments.append(comment) - relevant_comments.extend(comments[i + 1 :]) - break + relevant_comments = get_recent_comments(comments, bot_message_prefixes) if relevant_comments: comments_text = "\n\n## Comments:\n" - for comment in recent_user_comments: + for comment in relevant_comments: author = comment.get("user", {}).get("name", "Unknown") body = comment.get("body", "") body_image_urls = extract_image_urls(body)