Skip to content

feat: auto-forward PR review comments to agent with dedup#972

Open
Koan-Bot wants to merge 1 commit into
Anantys-oss:mainfrom
Koan-Bot:koan.atoomic/fix-issue-742
Open

feat: auto-forward PR review comments to agent with dedup#972
Koan-Bot wants to merge 1 commit into
Anantys-oss:mainfrom
Koan-Bot:koan.atoomic/fix-issue-742

Conversation

@Koan-Bot

Copy link
Copy Markdown
Collaborator

Summary

When a human reviewer leaves comments on a Kōan-created PR, the check loop now automatically creates a mission to address them — no explicit @mention required. Fingerprint-based deduplication (SHA-256 of sorted comment IDs) prevents re-dispatching the same comment set across multiple check runs.

Fixes #742

Changes

  • review_runner.py: Extract is_bot_user() helper (was duplicated inline at two call sites). Handles both user_type flat field and nested user.type dict.
  • pr_review_learning.py: Add fetch_unresolved_review_comments() (inline + review-body comments, bot-filtered), compute_comment_fingerprint(), get/store_comment_fingerprint() (atomic JSON tracker at .review-dispatch-tracker.json), and dispatch_review_comments_mission() (inserts mission only when fingerprint changed).
  • utils.py: Add resolve_project_name(repo, owner) combining resolve_project_path + project_name_for_path. Eliminates duplicated pattern in check_runner and makes it importable from pr_review_learning.
  • check_runner.py: Wire dispatch into _handle_pr() (skipped when rebase pending); wire learn_from_reviews() as best-effort post-check side effect; add _get_review_dispatch_include_drafts() config reader.
  • instance.example/config.yaml: Document review_dispatch.include_drafts option (default: true).
  • tests/test_pr_review_dispatch.py: 34 new tests covering all new functions and wiring.

Design decisions

  • Draft PRs included by default (per human review of the issue). Set review_dispatch.include_drafts: false in config.yaml to exclude them.
  • Dispatch skipped when rebase needed — no point queuing review address work when the branch has conflicts.
  • learn_from_reviews() wired here — runs on every PR check (not just mission completion), maximising coverage. Wrapped in try/except so learning failure never aborts the check.
  • Separate tracker file (.review-dispatch-tracker.json) — keeps comment fingerprints isolated from .check-tracker.json timestamp data.

Test plan

  • 34 new tests in koan/tests/test_pr_review_dispatch.py — all pass
  • Full test suite: 10,312 tests pass, 0 regressions

Generated by Kōan /fix

Closes Anantys-oss#742

When a human reviewer leaves comments on a Koan-created PR, the check
loop now automatically creates a mission to address them without
requiring an explicit @mention.

Changes:
- review_runner: extract is_bot_user() helper (was inline in two places)
- pr_review_learning: add fetch_unresolved_review_comments(), compute/
  get/store_comment_fingerprint(), and dispatch_review_comments_mission()
- utils: add resolve_project_name() combining resolve_project_path +
  project_name_for_path; used by dispatch and check_runner
- check_runner: wire dispatch into _handle_pr() after rebase/review
  checks; wire learn_from_reviews() as best-effort post-check side
  effect; add _get_review_dispatch_include_drafts() for config toggle
- instance.example/config.yaml: document review_dispatch.include_drafts
- tests: 34 new tests in test_pr_review_dispatch.py

Draft PRs are included by default (review_dispatch.include_drafts: true).
Bot comments are filtered. Dispatch is skipped when a rebase is pending.
Fingerprint dedup (sha256 of sorted comment IDs) prevents re-dispatching
the same comment set across multiple check runs.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

@atoomic atoomic left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM need some testing

@atoomic atoomic marked this pull request as ready for review March 21, 2026 02:12
@sukria

sukria commented Mar 25, 2026

Copy link
Copy Markdown
Collaborator

This is interesting, but probably deserve a documentation/help patch as well, to properly explain that feature.

@sukria

sukria commented Mar 27, 2026

Copy link
Copy Markdown
Collaborator

@sukria-koan0 read this PR and add a patch to the appropriate documentation file (README.md or other). Also make sure all tests pass.

sukria pushed a commit that referenced this pull request Mar 27, 2026
Add documentation for the review comment dispatch feature introduced
in PR #972. Updates user manual (/check section with config example),
README (Git & GitHub features list), and CLAUDE.md (pr_review_learning.py
architecture description).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
atoomic pushed a commit that referenced this pull request Mar 29, 2026
Add documentation for the review comment dispatch feature introduced
in PR #972. Updates user manual (/check section with config example),
README (Git & GitHub features list), and CLAUDE.md (pr_review_learning.py
architecture description).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Koan-Bot pushed a commit to Koan-Bot/koan that referenced this pull request May 23, 2026
Add documentation for the review comment dispatch feature introduced
in PR Anantys-oss#972. Updates user manual (/check section with config example),
README (Git & GitHub features list), and CLAUDE.md (pr_review_learning.py
architecture description).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@Koan-Bot

Copy link
Copy Markdown
Collaborator Author

Superseded

This PR has been superseded by PR #1541 (review_comment_dispatch.py), which implements the same feature — auto-dispatching missions when human reviewers comment on Koan's PRs — as a standalone module following the dispatch pattern established in the codebase.

Key differences:

Recommend closing this PR in favor of #1541.

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.

Auto-forward review comments to agent with dedup

3 participants