From 6efdbd3e48d79dcf319b476541e444dde8d1b59d Mon Sep 17 00:00:00 2001 From: Christian Gunderman Date: Wed, 13 May 2026 21:50:51 -0700 Subject: [PATCH] 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. --- tools/gemini-cli-bot/.gemini/skills/prs/SKILL.md | 10 ++++++++-- tools/gemini-cli-bot/brain/scheduled.md | 12 ++++++++---- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/tools/gemini-cli-bot/.gemini/skills/prs/SKILL.md b/tools/gemini-cli-bot/.gemini/skills/prs/SKILL.md index ebc4ecd2b7..60c0820923 100644 --- a/tools/gemini-cli-bot/.gemini/skills/prs/SKILL.md +++ b/tools/gemini-cli-bot/.gemini/skills/prs/SKILL.md @@ -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) diff --git a/tools/gemini-cli-bot/brain/scheduled.md b/tools/gemini-cli-bot/brain/scheduled.md index 92e0456488..aba0f46d38 100644 --- a/tools/gemini-cli-bot/brain/scheduled.md +++ b/tools/gemini-cli-bot/brain/scheduled.md @@ -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