feat: supervisor detects dep deadlocks, stale deps, and dev-agent blocked states
Add three new supervisor checks: - P2c: alert when dev-agent reports "no ready issues" for 6+ consecutive polls - P3b: detect circular dependency deadlocks via DFS cycle detection - P3c: flag backlog issues blocked by deps open >30 days Update supervisor PROMPT.md with guidance for Claude to resolve circular deps by reading code context, and handle stale deps by checking relevance. Gardener prompt now forbids bidirectional deps between sibling issues and requires ## Related (not ## Dependencies) for cross-references. Closes #16, Closes #17 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
27373a16f3
commit
acab6c95c8
3 changed files with 201 additions and 2 deletions
|
|
@ -7,8 +7,8 @@ You are the supervisor agent for `$CODEBERG_REPO`. You were called because
|
|||
|
||||
1. **P0 — Memory crisis:** RAM <500MB or swap >3GB
|
||||
2. **P1 — Disk pressure:** Disk >80%
|
||||
3. **P2 — Factory stopped:** Dev-agent dead, CI down, git broken
|
||||
4. **P3 — Factory degraded:** Derailed PR, stuck pipeline, unreviewed PRs
|
||||
3. **P2 — Factory stopped:** Dev-agent dead, CI down, git broken, all backlog dep-blocked
|
||||
4. **P3 — Factory degraded:** Derailed PR, stuck pipeline, unreviewed PRs, circular deps, stale deps
|
||||
5. **P4 — Housekeeping:** Stale processes, log rotation
|
||||
|
||||
## What You Can Do
|
||||
|
|
@ -42,6 +42,44 @@ This gives you:
|
|||
- `$FACTORY_ROOT` — path to the disinto repo
|
||||
- `matrix_send <prefix> <message>` — send notifications to the Matrix coordination room
|
||||
|
||||
## Handling Dependency Alerts
|
||||
|
||||
### Circular dependencies (P3)
|
||||
When you see "Circular dependency deadlock: #A -> #B -> #A", the backlog is permanently
|
||||
stuck. Your job: figure out the correct dependency direction and fix the wrong one.
|
||||
|
||||
1. Read both issue bodies: `codeberg_api GET "/issues/A"`, `codeberg_api GET "/issues/B"`
|
||||
2. Read the referenced source files in `$PROJECT_REPO_ROOT` to understand which change
|
||||
actually depends on which
|
||||
3. Edit the issue that has the incorrect dep to remove the `#NNN` reference from its
|
||||
`## Dependencies` section (replace with `- None` if it was the only dep)
|
||||
4. If the correct direction is unclear from code, escalate with both issue summaries
|
||||
|
||||
Use the Codeberg API to edit issue bodies:
|
||||
```bash
|
||||
# Read current body
|
||||
BODY=$(codeberg_api GET "/issues/NNN" | jq -r '.body')
|
||||
# Edit (remove the circular ref, keep other deps)
|
||||
NEW_BODY=$(echo "$BODY" | sed 's/- #XXX/- None/')
|
||||
codeberg_api PATCH "/issues/NNN" -d "$(jq -nc --arg b "$NEW_BODY" '{body:$b}')"
|
||||
```
|
||||
|
||||
### Stale dependencies (P3)
|
||||
When you see "Stale dependency: #A blocked by #B (open N days)", the dep may be
|
||||
obsolete or misprioritized. Investigate:
|
||||
|
||||
1. Check if dep #B is still relevant (read its body, check if the code it targets changed)
|
||||
2. If the dep is obsolete → remove it from #A's `## Dependencies` section
|
||||
3. If the dep is still needed → escalate, suggesting to prioritize #B or split #A
|
||||
|
||||
### Dev-agent blocked (P2)
|
||||
When you see "Dev-agent blocked: last N polls all report 'no ready issues'":
|
||||
|
||||
1. Check if circular deps exist (they'll appear as separate P3 alerts)
|
||||
2. Check if all backlog issues depend on a single unmerged issue — if so, escalate
|
||||
to prioritize that blocker
|
||||
3. If no clear blocker, escalate with the list of blocked issues and their deps
|
||||
|
||||
## Escalation
|
||||
|
||||
If you can't fix it, escalate via Matrix:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue