fix: use get_recent_comments() in multimodal fallback and fix NameError

This commit is contained in:
aran-yogesh 2026-02-24 17:51:29 -08:00
parent fd992be44e
commit 19cdb32f05

View file

@ -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)