Skip to content

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

Merged
chanakyav merged 1 commit intomainfrom
strengthen-ccr-handling-pr-desc-loop-detection
Mar 24, 2026
Merged

Strengthen CCR handling, auto-update PR descriptions, detect circular review loops#70
chanakyav merged 1 commit intomainfrom
strengthen-ccr-handling-pr-desc-loop-detection

Conversation

@chanakyav
Copy link
Copy Markdown
Owner

Summary

Three improvements to the review-fix loop:

  1. PR descriptions auto-updated after every fix iteration via a dedicated UPDATE_DESCRIPTION orchestrator state (no longer left to agent discretion)
  2. 3-tier CCR verification model — agent must verify claims before acting: fix (Tier 1), dismiss with evidence (Tier 2), or escalate as uncertain (Tier 3)
  3. Circular loop detection — comments that bounce back 2+ times after being "fixed" are flagged and escalated to human review

Changes

Phase 1: PR Description Auto-Update

  • github_api.py: Added get_pr_description() and update_pr_description()
  • prompts.py: Added update_description_prompt() for agent-driven PR body rewrite
  • orchestrator.py: New UPDATE_DESCRIPTION state between RESOLVE_COMMENTS and REQUEST_REVIEW. Non-fatal — failure doesn't block the loop
  • Removed old step 8 from fix_prompt() (was unreliably agent-discretionary)

Phase 2: 3-Tier CCR Verification

  • prompts.py: Rewrote fix_prompt() with mandatory verification steps and 3-tier decision model
  • orchestrator.py: _do_resolve_comments() now handles 4 statuses:
    • fixed → reply + resolve (unchanged)
    • skipped → reply + resolve (unchanged)
    • dismissed → reply with evidence + resolve (NEW)
    • uncertain → reply + do NOT resolve (NEW — left for human)
  • Fix summary JSON gains evidence field for dismissed/uncertain

Phase 3: Circular Loop Detection

  • orchestrator.py: Added _detect_bouncing_comments() — compares current unresolved comments against previous fix summaries by file path + body text similarity
  • After 2 bounces, injects warning into fix_prompt telling agent to mark as uncertain
  • prompts.py: fix_prompt() accepts bouncing_comments parameter

Tests

  • 19 new tests across test_github_api.py and test_orchestrator.py
  • 262 total tests, all passing
  • Lint clean (ruff check)

Closes #69


🤖 autopilot-loop

… review loops

Phase 1 - PR Description Auto-Update:
- Add get_pr_description() and update_pr_description() to github_api.py
- Add update_description_prompt() to prompts.py for agent-driven rewrite
- Add UPDATE_DESCRIPTION orchestrator state between RESOLVE_COMMENTS and
  REQUEST_REVIEW, guaranteeing PR body stays in sync after every fix
- Remove old step 8 from fix_prompt (no longer agent discretion)

Phase 2 - 3-Tier CCR Verification Model:
- Rewrite fix_prompt() with mandatory verification steps: read context,
  check tests, verify claims against actual codebase usage
- Add 3-tier decision model: fixed (Tier 1), dismissed with evidence
  (Tier 2, resolves thread), uncertain with evidence (Tier 3, leaves
  thread unresolved for human review)
- Update _do_resolve_comments() to handle dismissed and uncertain statuses
- Require evidence field in fix summary JSON for dismissed/uncertain

Phase 3 - Circular Loop Detection:
- Add _detect_bouncing_comments() to detect comments that bounce back
  after being fixed 2+ times (matching by file path + body similarity)
- Inject warning into fix_prompt when circular loops are detected,
  instructing agent to mark as uncertain instead of re-fixing
- Add bouncing_comments parameter to fix_prompt()

Tests: 19 new tests covering all three phases (262 total, all passing).

Closes #69
@chanakyav chanakyav merged commit 298e6b6 into main Mar 24, 2026
3 checks passed
@chanakyav chanakyav deleted the strengthen-ccr-handling-pr-desc-loop-detection branch March 24, 2026 19:59
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