fix: investigate: PreToolUse guard blocks do_merge() in dev-agent — every disinto PR escalates on merge (#568)

Root cause: two code paths injected merge curl commands into Claude's
session (review-poll.sh APPROVE injection and dev-agent.sh prompt
instructions). The PreToolUse guard correctly blocked these, causing
Claude to write PHASE:escalate instead of merging.

The bash phase handler already handles merging via do_merge() — which
runs outside Claude tool use and is not subject to the guard. Remove
the merge/close curl instructions from both Claude-facing prompts so
the bash orchestrator handles merges as intended.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
openhands 2026-03-23 07:24:04 +00:00
parent a2549f62e7
commit 06cddb456d
2 changed files with 4 additions and 38 deletions

View file

@ -139,24 +139,9 @@ inject_review_into_dev_session() {
local inject_msg=""
if [ "${verdict}" = "APPROVE" ]; then
inject_msg="Approved! PR #${pr_num} has been approved by the reviewer.
Merge the PR and close the issue, then signal done:
curl -sf -X POST \\
-H \"Authorization: token \$CODEBERG_TOKEN\" \\
-H 'Content-Type: application/json' \\
\"${API_BASE}/pulls/${pr_num}/merge\" \\
-d '{\"Do\":\"merge\",\"delete_branch_after_merge\":true}'
curl -sf -X PATCH \\
-H \"Authorization: token \$CODEBERG_TOKEN\" \\
-H 'Content-Type: application/json' \\
\"${API_BASE}/issues/${issue_num}\" \\
-d '{\"state\":\"closed\"}'
echo \"PHASE:done\" > \"${phase_file}\"
If merge fails due to conflicts, rebase first then retry.
If merge repeatedly fails, write PHASE:escalate with a reason."
The orchestrator will handle merging and closing the issue automatically.
You do not need to take any action — stop and wait."
elif [ "${verdict}" = "REQUEST_CHANGES" ] || [ "${verdict}" = "DISCUSS" ]; then
inject_msg="Review: ${verdict} on PR #${pr_num}: