-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Problem
The current route() function uses a rigid checklist of label + state queries to find actionable work. When a PR doesn't exactly match one of the expected states, the script silently reports "No actionable work found" and sleeps — even when the fix is trivial (e.g., a closed PR that should be open, a missing comment, a stale label).
Example: PR #17 on conversation_with_ai
A bot-authored draft PR had bot:plan-proposed label and a complete implementation plan in the body, but the script couldn't find it because:
- The PR had been closed (so
gh pr listskipped it) - Even after reopening, it had 0 comments — and
check_plan_feedbackrequirescomment_count > 0
This required manual debugging to figure out. The script should have been able to diagnose and resolve this itself.
Other failure modes this would catch
- PR has the wrong label for its actual state
- PR is closed but shouldn't be
- Issue is assigned but the assignee's PR was abandoned
bot:in-progresslabel is stale (process crashed without cleanup)- PR has plan but no
bot:plan-proposedlabel
Proposed Solution
Add a fallback step in the routing loop: when the rigid checks find nothing, pass all open bot PRs + unassigned issues to Claude Code for triage. Claude can inspect the actual state of each item and decide what action to take (reopen a PR, add a comment, fix a label, skip, etc.) rather than silently giving up.
This brings back Claude Code's judgment into the routing decision, so the system self-heals instead of getting stuck on small state mismatches.
Success Criteria
- Script never silently skips work that a human would recognize as actionable
- Triage step only fires when rigid routing finds nothing (no added cost in the happy path)
- Actions taken by triage are logged clearly