fix: feat: gardener should stay alive until its PR merges — address review feedback, rebase if needed (#571)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
openhands 2026-03-22 20:48:07 +00:00
parent 31a2361e3f
commit 578a6ec81d
3 changed files with 424 additions and 13 deletions

View file

@ -419,7 +419,7 @@ needs = ["blocked-review"]
[[steps]]
id = "commit-and-pr"
title = "One commit with all file changes, push, create PR"
title = "One commit with all file changes, push, create PR, monitor to merge"
description = """
Collect all file changes from this run (AGENTS.md updates) into a single commit.
API calls (issue creation, PR comments, closures) already happened during the
@ -429,7 +429,7 @@ run — only file changes need the PR.
cd "$PROJECT_REPO_ROOT"
git status --porcelain
If there are no file changes, skip this entire step no commit, no PR.
If there are no file changes, skip to step 3 no commit, no PR needed.
2. If there are changes:
a. Create a branch:
@ -444,16 +444,26 @@ run — only file changes need the PR.
e. Push:
git push -u origin "$BRANCH"
f. Create a PR:
curl -sf -X POST \
PR_RESPONSE=$(curl -sf -X POST \
-H "Authorization: token $CODEBERG_TOKEN" \
-H "Content-Type: application/json" \
"$CODEBERG_API/pulls" \
-d '{"title":"chore: gardener housekeeping",
"head":"<branch>","base":"<primary-branch>",
"body":"Automated gardener housekeeping — AGENTS.md updates.\n\nReview-agent fast-tracks doc-only PRs."}'
g. Return to primary branch:
git checkout "$PRIMARY_BRANCH"
"head":"'"$BRANCH"'","base":"'"$PRIMARY_BRANCH"'",
"body":"Automated gardener housekeeping — AGENTS.md updates.\\n\\nReview-agent fast-tracks doc-only PRs."}')
PR_NUMBER=$(echo "$PR_RESPONSE" | jq -r '.number')
g. Save PR number for orchestrator tracking:
echo "$PR_NUMBER" > /tmp/gardener-pr-${PROJECT_NAME}.txt
h. Signal the orchestrator to monitor CI:
echo "PHASE:awaiting_ci" > "$PHASE_FILE"
i. STOP and WAIT. Do NOT return to the primary branch.
The orchestrator polls CI, injects results and review feedback.
When you receive injected CI or review feedback, follow its
instructions, then write PHASE:awaiting_ci and wait again.
3. If the PR creation fails (e.g. no changes after staging), log and continue.
3. If no file changes existed (step 1 found nothing):
echo "PHASE:done" > "$PHASE_FILE"
4. If PR creation fails, log the error and write PHASE:failed.
"""
needs = ["agents-update"]