fix(bot): improve reasoning resilience and prevent infinite loops

- Update PR skill to allow informed escalation and help requests when stuck.

- Update main brain prompt to encourage strategic pivoting between hypotheses.

- Explicitly authorize bailing out of tasks that cannot be verified.
This commit is contained in:
Christian Gunderman
2026-05-13 21:50:51 -07:00
parent a2841350ba
commit 6efdbd3e48
2 changed files with 16 additions and 6 deletions
@@ -12,9 +12,15 @@ descriptions, and manages the lifecycle of both new and existing PRs.
## Mandatory PR Driver (Ownership)
You are the "owner" of all PRs labeled `bot-fix`. You MUST proactively drive them to completion:
You are the "owner" of all PRs labeled `bot-fix`. You MUST proactively drive them toward a resolution (either completion or informed escalation):
1. **Inventory**: Use `gh pr list --label "bot-fix" --json number,title,headRefName,statusCheckRollup,comments` to find your active PRs.
2. **Proactive Maintenance**: If a `bot-fix` PR has failing status checks or new maintainer comments, you MUST prioritize fixing the CI or responding to the feedback before starting new work.
2. **Resolution Priority**:
- **Fixable CI/Feedback**: If a `bot-fix` PR has failing status checks or new maintainer comments, you MUST prioritize fixing the CI or responding to the feedback before starting new work.
- **Unresolvable Roadblocks**: If you identify a persistent failure that appears to be an environment issue, a flaky test, or a fundamental architectural blocker that requires human intervention, you MUST NOT keep looping. Instead:
1. Summarize the blocker and your failed attempts in `pr-comment.md`.
2. Explicitly ask for maintainer help.
3. Record the learning in `lessons-learned.md`.
4. Move on to a different task.
## Staging & Patch Preparation (MANDATORY)
+8 -4
View File
@@ -61,16 +61,20 @@ TURN to load the instructions for your mandate.**
3. Follow the detailed workflow and instructions provided by the activated skill
to complete your mandate. Do NOT skip this step to perform unrelated fixes.
### 2. Hypothesis Testing & Deep Dive
### 2. Hypothesis Testing & Strategic Pivoting
For any detected bugs, bottlenecks, or opportunities:
- Formulate competing hypotheses.
- Delegate high-volume or data-intensive evidence gathering (e.g., slicing logs,
batch issue analysis) to the **'worker' agent** if necessary.
- Select the optimal path based on the empirical evidence returned. You MUST
ONLY execute on a **single path** to ensure the resulting PR is focused and
surgical.
- **Iterative Refinement**: Select the most likely path first. However, if your
initial implementation fails verification (e.g. tests still fail), you MUST
explicitly pivot to your second hypothesis rather than infinitely patching the
first one.
- **Bail Out**: If all your formulated hypotheses fail to yield a verified fix,
abort the task and record the findings. Delivering NO change is better than
delivering a broken or "best-guess" fix.
## Execution Constraints