Skip to content

Lower circular loop detection threshold from 2 bounces to 1#72

Merged
chanakyav merged 1 commit intomainfrom
lower-bounce-threshold
Mar 25, 2026
Merged

Lower circular loop detection threshold from 2 bounces to 1#72
chanakyav merged 1 commit intomainfrom
lower-bounce-threshold

Conversation

@chanakyav
Copy link
Copy Markdown
Owner

Summary

Lower the circular loop detection threshold from 2 bounces to 1. A comment that was "fixed" in a previous iteration and reappears is already a circular review loop — no need to waste a second iteration confirming it.

What changed

  • _detect_bouncing_comments() now flags a comment after 1 fix-then-reappear cycle (was 2)
  • Entry check lowered from iteration < 3 to iteration < 2
  • Tests updated to match the new threshold

How comment resolution works (reference)

When the agent classifies each review comment, the orchestrator posts a reply and decides whether to resolve the thread:

Status Reply posted Thread resolved?
fixed 🤖 autopilot-loop: Addressed in abc1234 — Added null check ✅ Yes
skipped 🤖 autopilot-loop: Skipped — determined not worth addressing ✅ Yes
dismissed 🤖 autopilot-loop: Dismissed — Field is required

Evidence: API contract at src/schema.py:42 requires this field
✅ Yes
uncertain 🤖 autopilot-loop: ❓ Needs human review — Not sure about this

What was checked: Checked tests but inconclusive
❌ No

Circular loop example

When a comment bounces (fixed once → reappeared), the agent is instructed to mark it uncertain instead of re-fixing. The reply would look like:

🤖 autopilot-loop: ❓ Needs human review — Circular review loop detected: this comment was previously addressed but CCR raised the same concern again.

What was checked: Fixed in iteration 1 by making the field optional, but CCR now says it should be required. These suggestions contradict each other.

The thread stays unresolved so a human can make the final call.

Why lower the threshold?

Previously, autopilot would:

  1. Fix the comment in iteration 1
  2. CCR re-raises the same concern in iteration 2
  3. Fix it again in iteration 2 (potentially reverting the first fix)
  4. CCR re-raises again in iteration 3
  5. Only now detect the loop

With the new threshold:

  1. Fix the comment in iteration 1
  2. CCR re-raises the same concern in iteration 2
  3. Immediately flag as circular loop — skip the fix, leave for human review

This saves 1-2 wasted iterations per bouncing comment.

Closes #69 (remaining item)


🤖 autopilot-loop

A comment that was fixed once and reappeared is already a circular loop.
Previously required 2 fix-then-reappear cycles before flagging, which
wasted iterations on contradictory CCR suggestions.
@chanakyav chanakyav merged commit 1ea22ef into main Mar 25, 2026
3 checks passed
@chanakyav chanakyav deleted the lower-bounce-threshold branch March 25, 2026 00:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Strengthen CCR handling, auto-update PR descriptions, detect circular review loops

1 participant