Fix posting invalid response to a comment (#26266)

This commit is contained in:
Christian Gunderman
2026-04-30 18:22:59 +00:00
committed by GitHub
parent 90895efb29
commit 0af13141b2
3 changed files with 33 additions and 15 deletions
+16 -2
View File
@@ -86,8 +86,15 @@ jobs:
if [ -n "$LAST_RUN_ID" ]; then if [ -n "$LAST_RUN_ID" ]; then
echo "Found previous successful run: $LAST_RUN_ID" echo "Found previous successful run: $LAST_RUN_ID"
# Download brain memory (all state in one artifact) # Download brain memory to a temp dir so we can selectively restore only persistent state
gh run download "$LAST_RUN_ID" -n brain-data -D . || echo "brain-data not found" mkdir -p .temp_brain_data
gh run download "$LAST_RUN_ID" -n brain-data -D .temp_brain_data || echo "brain-data not found"
# Restore only persistent memory files
cp .temp_brain_data/tools/gemini-cli-bot/lessons-learned.md tools/gemini-cli-bot/lessons-learned.md 2>/dev/null || true
mkdir -p tools/gemini-cli-bot/history/
cp .temp_brain_data/tools/gemini-cli-bot/history/*.csv tools/gemini-cli-bot/history/ 2>/dev/null || true
rm -rf .temp_brain_data
else else
echo "No previous successful run found." echo "No previous successful run found."
fi fi
@@ -133,6 +140,13 @@ jobs:
node bundle/gemini.js --policy tools/gemini-cli-bot/ci-policy.toml -p "$(cat combined_prompt.md)" node bundle/gemini.js --policy tools/gemini-cli-bot/ci-policy.toml -p "$(cat combined_prompt.md)"
if [ -n "$TRIGGER_ISSUE_NUMBER" ] && [ ! -s "issue-comment.md" ] && [ ! -s "pr-comment.md" ]; then
echo "Agent failed to respond. Generating fallback error message."
echo "⚠️ **Gemini CLI Bot failed to generate a response.**" > "issue-comment.md"
echo "" >> "issue-comment.md"
echo "I encountered an error or failed to generate a complete response to your request. You can check the [GitHub Actions Run Log](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) for more details on what went wrong." >> "issue-comment.md"
fi
- name: 'Run Critique Phase' - name: 'Run Critique Phase'
if: "${{ github.event.inputs.enable_prs == 'true' || github.event_name == 'issue_comment' || github.event_name == 'pull_request_review_comment' || github.event.inputs.run_interactive == 'true' }}" if: "${{ github.event.inputs.enable_prs == 'true' || github.event_name == 'issue_comment' || github.event_name == 'pull_request_review_comment' || github.event.inputs.run_interactive == 'true' }}"
env: env:
+8 -8
View File
@@ -93,15 +93,15 @@ advanced triage, or semantic labeling).
If the `ENABLE_PRS` environment variable is `true` and you are proposing script If the `ENABLE_PRS` environment variable is `true` and you are proposing script
or configuration changes: or configuration changes:
1. **Generate `pr-description.md`**: Create this file in the root directory. 1. **Generate `pr-description.md`**: Use the `write_file` tool to create this
Include: file in the root directory. Include:
- What the change is. - What the change is.
- Why it is recommended. - Why it is recommended.
- Expected impact on metrics or productivity. - Expected impact on metrics or productivity.
2. **Surgical Changes**: Only propose a **single improvement or fix per PR**. 2. **Surgical Changes**: Only propose a **single improvement or fix per PR**.
Prioritize highest impact, lowest risk. Prioritize highest impact, lowest risk.
3. **Acknowledgment**: If invoked by a comment, write a brief acknowledgement 3. **Acknowledgment**: If invoked by a comment, use the `write_file` tool to
to `issue-comment.md`. save a brief acknowledgement to `issue-comment.md`.
4. **Stage Files**: Use `git add <file>` to stage files for the PR. **DO NOT** 4. **Stage Files**: Use `git add <file>` to stage files for the PR. **DO NOT**
stage internal bot files like `pr-description.md`, `lessons-learned.md`, stage internal bot files like `pr-description.md`, `lessons-learned.md`,
branch-name.txt, pr-comment.md, pr-number.txt, issue-comment.md, or anything branch-name.txt, pr-comment.md, pr-number.txt, issue-comment.md, or anything
@@ -112,10 +112,10 @@ or configuration changes:
If you are continuing work on an existing Task (e.g., status is `SUBMITTED`, If you are continuing work on an existing Task (e.g., status is `SUBMITTED`,
`FAILED`, or `STUCK`): `FAILED`, or `STUCK`):
1. **Update Existing PR**: Generate `branch-name.txt` with the branch name 1. **Update Existing PR**: Use `write_file` to generate `branch-name.txt` with
(format: `bot/task-{ID}`). the branch name (format: `bot/task-{ID}`).
2. **Respond to Maintainers**: Generate `pr-comment.md` (content) and 2. **Respond to Maintainers**: Use `write_file` to generate `pr-comment.md`
`pr-number.txt` (ID). (content) and `pr-number.txt` (ID).
3. **Handle CI Failures**: Diagnose failing checks using `gh run view` and 3. **Handle CI Failures**: Diagnose failing checks using `gh run view` and
priority must be generating a new patch to fix the failure. priority must be generating a new patch to fix the failure.
+9 -5
View File
@@ -30,7 +30,8 @@ Before beginning your analysis, you MUST perform the following research:
Your ONLY goal is to address the user's specific comment. Your ONLY goal is to address the user's specific comment.
3. **Verify Request Context**: Use the GitHub CLI to verify the current state 3. **Verify Request Context**: Use the GitHub CLI to verify the current state
of the issue/PR you were mentioned in. If the user's request is already of the issue/PR you were mentioned in. If the user's request is already
addressed or obsolete, inform them via `issue-comment.md`. addressed or obsolete, inform them by using the `write_file` tool to save a
message to `issue-comment.md`.
### 1. Root-Cause Analysis & Hypothesis Testing ### 1. Root-Cause Analysis & Hypothesis Testing
@@ -54,9 +55,9 @@ If your investigation confirms that a code or configuration change is required:
user's specific request. You are STRICTLY FORBIDDEN from including any user's specific request. You are STRICTLY FORBIDDEN from including any
unrelated updates (such as metrics updates, backlog triage changes, or unrelated updates (such as metrics updates, backlog triage changes, or
background housekeeping) when operating in interactive mode. background housekeeping) when operating in interactive mode.
- **Acknowledgment**: Write a brief acknowledgement to `issue-comment.md` (e.g., - **Acknowledgment**: Use the `write_file` tool to write a brief acknowledgement
"I've investigated the request and implemented a fix. A PR will be created to `issue-comment.md` (e.g., "I've investigated the request and implemented a
shortly."). fix. A PR will be created shortly.").
- **Follow Protocol**: Use the Memory Preservation and PR Preparation protocols - **Follow Protocol**: Use the Memory Preservation and PR Preparation protocols
provided in the common rules. provided in the common rules.
@@ -66,4 +67,7 @@ If the user's request is purely informational:
- **Evidence-Based Answers**: Use your research tools to verify facts before - **Evidence-Based Answers**: Use your research tools to verify facts before
answering. answering.
- **Output**: Write your response to `issue-comment.md`. - **Output**: You MUST use the `write_file` tool to save your response to
`issue-comment.md`. DO NOT simply output your response to the console. The
workflow relies on `issue-comment.md` being created in the workspace to post
the comment.