Implement: feat: PR babysitting — automated monitoring of open PRs#1049
Implement: feat: PR babysitting — automated monitoring of open PRs#1049Koan-Bot wants to merge 2 commits into
Conversation
|
@Koan-Bot ask can you confirm that feature is not already a duplicate of what s currently handled on your side regarding open PRs? |
PR Review — Implement: feat: PR babysitting — automated monitoring of open PRsWell-structured feature with good test coverage for the core logic, but has several issues that need fixing before merge. The most critical is the branch matching logic that will match branches outside the koan prefix (e.g., 🔴 Blocking1. Branch matching logic allows false positives ( Simplify to: if not head.startswith(prefix + "/"):
continueOr if you also need the exact if not (head.startswith(prefix + "/") or head == prefix):
continue🟡 Important1. Duplicate review actions for same PR ( Consider deduplicating by action type before returning: # Deduplicate actions by type
seen_types = set()
unique_actions = []
for a in actions:
if a['type'] not in seen_types:
seen_types.add(a['type'])
unique_actions.append(a)
return unique_actions2. Mission dedup uses loose PR number matching — cross-repo false positives ( 3. Lock file handle not cleaned up on process crash ( 4. _resolve_project_for_pr may return raw repo name ( 5. Import from app.config may not exist ( 🟢 Suggestions1. Duplicate import yaml in _toggle ( 2. queue_fix_missions tracker update on 'notify' uses wrong key ( Fix: pass through the specific notify sub-type from check_pr_health. For example, add a Checklist
SummaryWell-structured feature with good test coverage for the core logic, but has several issues that need fixing before merge. The most critical is the branch matching logic that will match branches outside the koan prefix (e.g., Automated review by Kōan |
Good question. There is partial conceptual overlap but no functional duplication. The CLAUDE.md describes The existing The review comment dispatch tracker ( That said, if/when the review dispatch functions are implemented, there will be overlap in the "new review comments → queue /review mission" path. The babysit feature should be considered the canonical implementation for that, and the CLAUDE.md architecture description should be updated to reflect this. |
Rebase: Implement: feat: PR babysitting — automated monitoring of open PRsBranch Diff: 7 files changed, 1387 insertions(+) Review feedback was analyzed and applied. Changesg
Actions
CICI will be checked asynchronously. Automated by Kōan |
0541e18 to
b9ca93e
Compare
g `"notify_notify"` as `last_action` (because `f"notify_{action_type}"` where `action_type` is `"notify"`), which never matched the expected keys (`notify_ci_cap`, `notify_review_cap`, etc.), causing notifications to fire on every cycle. Added `notify_key` field to each notify action dict and used it in the tracker update.
- **Deduplicated review actions for the same PR** (`pr_babysit.py:358`) — Added a guard so check Anantys-oss#3 (new comment count) skips queuing a `review` action if check #2 (CHANGES_REQUESTED) already queued one for the same PR.
- **Removed loose PR number fallback in mission dedup** (`pr_babysit.py:428-433`) — Removed the number-only fallback matching (`pr_url.split('/')[-1] in line`) that could cause cross-repo false positives. The full URL check is sufficient.
- **Fixed duplicate imports in handler.py** (`babysit/handler.py:80-91`) — Removed duplicate `import yaml` and `from app.utils import atomic_write` statements, and removed unused `from pathlib import Path` import.
|
@Koan-Bot rr |
PR Review — Implement: feat: PR babysitting — automated monitoring of open PRsWell-architected feature with clean separation between discovery, health checking, and mission queuing. However, there are several issues that need addressing before merge: (1) a blocking type bug in handler.py that will crash 🔴 Blocking1. Type bug: str passed where Path expected (`koan/skills/core/babysit/handler.py`, L130)
Fix: pass tracker_entry = _get_tracker_entry(ctx.instance_dir, pr_url)Alternatively, make 🟡 Important1. _mission_already_queued ignores action_type parameter (`koan/app/pr_babysit.py`, L303-318)The Either use 2. Significant overlap with existing CI monitoring and review dispatchThis module duplicates functionality that already exists in the codebase:
As the PR comments from @atoomic suggest, this needs reconciliation with the existing CI monitoring pipeline. Consider whether babysit should delegate to the existing mechanisms rather than reimplementing parallel detection, or clearly document how the two systems coexist without double-queuing missions. 3. CI failure already-addressed logic has a gap (`koan/app/pr_babysit.py`, L266-278)The The tracker should reset 4. Cooldown applies globally per PR, not per action type (`koan/app/pr_babysit.py`, L357-374)
Consider tracking cooldown per action type (e.g., 🟢 Suggestions1. Lock file leaked on disk (`koan/app/pr_babysit.py`, L67-76)The lock file 2. Broad exception handling masks real errors (`koan/app/iteration_manager.py`, L181-210)
3. gh CLI timeout may be too short for large repos (`koan/app/pr_babysit.py`, L117-120)The 30-second timeout for 4. No test coverage for handler.pyThe test file covers Checklist
SummaryWell-architected feature with clean separation between discovery, health checking, and mission queuing. However, there are several issues that need addressing before merge: (1) a blocking type bug in handler.py that will crash Automated review by Kōan |
Valid concern. There is significant overlap with existing functionality:
What babysit adds that's genuinely new:
Recommendation: either (a) have babysit delegate CI and review checks to the existing mechanisms, or (b) clearly document the coexistence model and add dedup guards to prevent double-queuing from both systems. |
|
Agreed this needs a rework to integrate with recent CI monitoring changes. Specifically:
Suggested approach: refactor babysit to be a coordinator that runs the existing detection mechanisms ( |
Rebase: Implement: feat: PR babysitting — automated monitoring of open PRsBranch Diff: 7 files changed, 1387 insertions(+) Review feedback was analyzed and applied. Actions
CICI will be checked asynchronously. Automated by Kōan |
g `"notify_notify"` as `last_action` (because `f"notify_{action_type}"` where `action_type` is `"notify"`), which never matched the expected keys (`notify_ci_cap`, `notify_review_cap`, etc.), causing notifications to fire on every cycle. Added `notify_key` field to each notify action dict and used it in the tracker update.
- **Deduplicated review actions for the same PR** (`pr_babysit.py:358`) — Added a guard so check Anantys-oss#3 (new comment count) skips queuing a `review` action if check #2 (CHANGES_REQUESTED) already queued one for the same PR.
- **Removed loose PR number fallback in mission dedup** (`pr_babysit.py:428-433`) — Removed the number-only fallback matching (`pr_url.split('/')[-1] in line`) that could cause cross-repo false positives. The full URL check is sufficient.
- **Fixed duplicate imports in handler.py** (`babysit/handler.py:80-91`) — Removed duplicate `import yaml` and `from app.utils import atomic_write` statements, and removed unused `from pathlib import Path` import.
b9ca93e to
227172b
Compare
|
@sukria-koan0 rebase Then summarize that big PR : it went through many iterations. Clean and small exectuive summary: what the PR does, is it ready to merge, overlap analysis, documentation and config samples present, etc. |
Introduces pr_babysit.py, a new module that discovers all open PRs created by Kōan (matching branch_prefix), checks each for actionable state changes, and queues targeted fix missions automatically. - New koan/app/pr_babysit.py: discover PRs via gh CLI, check CI status, review decisions, comment counts, merge conflicts, and staleness. Queues /fix, /review, /rebase missions with dedup and cooldown guards. - New koan/skills/core/babysit/: /babysit skill for status, on/off toggle, and force-checking a specific PR. - iteration_manager.py: wires babysit check after recurring injection, with budget guard (skip in wait/review modes) and interval throttle. - instance.example/config.yaml: documents pr_babysit config section. - docs/user-manual.md: documents /babysit skill and config table. - 46 new tests in test_pr_babysit.py covering all core behaviors. Closes Anantys-oss#724 Co-Authored-By: Claude <noreply@anthropic.com>
g `"notify_notify"` as `last_action` (because `f"notify_{action_type}"` where `action_type` is `"notify"`), which never matched the expected keys (`notify_ci_cap`, `notify_review_cap`, etc.), causing notifications to fire on every cycle. Added `notify_key` field to each notify action dict and used it in the tracker update.
- **Deduplicated review actions for the same PR** (`pr_babysit.py:358`) — Added a guard so check Anantys-oss#3 (new comment count) skips queuing a `review` action if check #2 (CHANGES_REQUESTED) already queued one for the same PR.
- **Removed loose PR number fallback in mission dedup** (`pr_babysit.py:428-433`) — Removed the number-only fallback matching (`pr_url.split('/')[-1] in line`) that could cause cross-repo false positives. The full URL check is sufficient.
- **Fixed duplicate imports in handler.py** (`babysit/handler.py:80-91`) — Removed duplicate `import yaml` and `from app.utils import atomic_write` statements, and removed unused `from pathlib import Path` import.
Rebase: Implement: feat: PR babysitting — automated monitoring of open PRsBranch Diff: 7 files changed, 1387 insertions(+) Review feedback was analyzed and applied. Actions
CICI will be checked asynchronously. Automated by Kōan |
227172b to
a0e5bd8
Compare
Summary
Implements #724
Closes #724
Generated by Kōan /implement
Quality Report
Changes: 7 files changed, 1391 insertions(+)
Code scan: 1 issue(s) found
koan/app/pr_babysit.py:0— 639 lines addedTests: passed (10 PASSED)
Branch hygiene: clean
Generated by Kōan post-mission quality pipeline