Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/coding_review_agent_loop/protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
HTML_COMMENT_RE = re.compile(r"^\s*<!--.*-->\s*$")
SIGNATURE_RE = re.compile(r"^\s*--\s+\S")
BULLET_RE = re.compile(r"^\s*(?:[-*+]\s+|\d+[.)]\s+)(?P<text>.+?)\s*$")
EMPTY_FOLLOWUP_RE = re.compile(
r"^(?:none|n/a|no follow[- ]?ups?|no same[- ]pr follow[- ]?ups?|no future follow[- ]?ups?)\.?$",
re.I,
)


@dataclass(frozen=True)
Expand Down Expand Up @@ -64,7 +68,7 @@ def parse_approved_followups(text: str, *, reviewer: str) -> ApprovedFollowups:
def flush_current() -> None:
if active is not None and current:
item = " ".join(part.strip() for part in current if part.strip()).strip()
if item:
if item and not EMPTY_FOLLOWUP_RE.match(item):
active.append(ApprovedFollowup(reviewer=reviewer, text=item))
current.clear()

Expand Down
31 changes: 31 additions & 0 deletions tests/test_agent_loop.py
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,37 @@ def test_parse_approved_followups_extracts_same_pr_and_future_independently():
]


@pytest.mark.parametrize(
"placeholder",
[
"None",
"none.",
"N/A",
"No follow-ups",
"No same-PR follow-ups.",
"No future follow-ups",
],
)
def test_parse_approved_followups_ignores_empty_placeholders(placeholder):
review = f"""
LGTM.

### Same-PR follow-ups
- {placeholder}

### Future follow-ups
- {placeholder}

<!-- AGENT_STATE: approved -->
-- Google Gemini
"""

followups = parse_approved_followups(review, reviewer="Gemini")

assert followups.same_pr == ()
assert followups.future == ()


@pytest.mark.parametrize("terminator", ["<!-- AGENT_STATE: approved -->", "-- OpenAI Codex"])
def test_parse_non_blocking_followups_stops_at_final_markers(terminator):
review = f"""
Expand Down
Loading