Compare commits
7 Commits
v0.2.29
...
fix/issue-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c9bdc0dd88 | ||
|
|
663e44a82a | ||
|
|
24dd91d0e1 | ||
| c8b2ab6b12 | |||
|
|
87434d1bca | ||
| ae8f1433a7 | |||
|
|
b16a97514e |
@@ -270,40 +270,37 @@ build_dev_agent_message() {
|
|||||||
local number=$(echo "$issue_ref" | grep -oE '#[0-9]+$' | tr -d '#')
|
local number=$(echo "$issue_ref" | grep -oE '#[0-9]+$' | tr -d '#')
|
||||||
local worktree_path=$(issue_ref_to_worktree_path "$issue_ref")
|
local worktree_path=$(issue_ref_to_worktree_path "$issue_ref")
|
||||||
|
|
||||||
|
local conflict_check=""
|
||||||
|
local review_notes=""
|
||||||
|
local delegator_header=""
|
||||||
|
local delegator_footer=""
|
||||||
if [ -n "$user_message" ]; then
|
if [ -n "$user_message" ]; then
|
||||||
cat <<EOF
|
conflict_check=" - CRITICAL: Check if PR has merge conflicts before asking for review:
|
||||||
You are continuing work on $issue_ref. A PR likely already exists.
|
- Use: curl -s \"https://$instance/api/v1/repos/$owner/$repo/pulls/$number\" -H \"Authorization: Bearer \$GITEA_TOKEN\"
|
||||||
|
- If \"mergeable\": false, there ARE conflicts - you MUST resolve them FIRST
|
||||||
|
- To resolve: cd to worktree, git fetch origin, git rebase origin/main, resolve conflicts, git rebase --continue, git push --force-with-lease
|
||||||
|
- Only after resolving conflicts (mergeable: true) can you ask for review"
|
||||||
|
delegator_header="IMPORTANT: Follow the workflow below as your guideline, but prioritize the delegator's message.
|
||||||
|
|
||||||
IMPORTANT - Review workflow:
|
Workflow:"
|
||||||
1. First, check if PR exists: curl -s "https://$instance/api/v1/repos/$owner/$repo/pulls?state=open" -H "Authorization: Bearer \$GITEA_TOKEN" | grep -i "$number"
|
delegator_footer="
|
||||||
2. Get PR comments: curl -s "https://$instance/api/v1/repos/$owner/$repo/issues/$number/comments" -H "Authorization: Bearer \$GITEA_TOKEN"
|
|
||||||
3. Get PR reviews: curl -s "https://$instance/api/v1/repos/$owner/$repo/pulls/$number/reviews" -H "Authorization: Bearer \$GITEA_TOKEN"
|
|
||||||
|
|
||||||
You may need to:
|
|
||||||
- Make code changes and push to the same branch
|
|
||||||
- Reply to PR comments using: curl -X POST "https://$instance/api/v1/repos/$owner/$repo/issues/$number/comments" -H "Authorization: Bearer \$GITEA_TOKEN" -H "Content-Type: application/json" -d '{"body":"Your reply here"}'
|
|
||||||
- Or do both
|
|
||||||
|
|
||||||
MERGING: If instructed to merge, you MUST confirm approval first before merging:
|
|
||||||
- Check for PR approval via: curl -s "https://$instance/api/v1/repos/$owner/$repo/pulls/$number/reviews" -H "Authorization: Bearer \$GITEA_TOKEN"
|
|
||||||
- Check for "lgtm" or "approved" in comments: curl -s "https://$instance/api/v1/repos/$owner/$repo/issues/$number/comments" -H "Authorization: Bearer \$GITEA_TOKEN"
|
|
||||||
- Only merge if you see approval OR the instruction explicitly says to merge (e.g., "merge the PR", "please merge", "go ahead and merge")
|
|
||||||
- To merge: tea pr merge --repo $owner/$repo $number --style merge
|
|
||||||
- If no approval yet, reply asking for review/approval first
|
|
||||||
|
|
||||||
Delegator's message:
|
Delegator's message:
|
||||||
$user_message
|
$user_message"
|
||||||
|
|
||||||
Work directory: $worktree_path (already on the fix branch)
|
|
||||||
EOF
|
|
||||||
else
|
else
|
||||||
|
review_notes=" - IMPORTANT: After listing reviews, READ the review comments and incorporate feedback
|
||||||
|
- Check for review state: \"APPROVED\" means ready to merge, \"COMMENT\" means feedback to address"
|
||||||
|
delegator_header="Workflow:"
|
||||||
|
fi
|
||||||
|
|
||||||
cat <<EOF
|
cat <<EOF
|
||||||
You are assigned to work on $issue_ref.
|
You are assigned to work on $issue_ref.
|
||||||
|
|
||||||
Workflow:
|
$delegator_header
|
||||||
1. Read the issue at $instance/$owner/$repo/issues/$number AND all comments on that issue
|
1. Read the issue at $instance/$owner/$repo/issues/$number AND all comments on that issue
|
||||||
2. Check if a PR already exists for this issue
|
2. Check if a PR already exists for this issue
|
||||||
- If PR exists and is open, review it and learn from it
|
- If PR exists and is open, review it and learn from it
|
||||||
|
$conflict_check
|
||||||
- If PR makes sense to continue, work on it instead
|
- If PR makes sense to continue, work on it instead
|
||||||
- If PR is not worth continuing, create a new branch/PR but explain in PR description why you're creating a new one instead of continuing the existing PR
|
- If PR is not worth continuing, create a new branch/PR but explain in PR description why you're creating a new one instead of continuing the existing PR
|
||||||
3. Read README.md (if exists) to understand the general concept of this repository
|
3. Read README.md (if exists) to understand the general concept of this repository
|
||||||
@@ -321,13 +318,14 @@ Tools for PR interaction:
|
|||||||
- Post issue/PR comment: curl -X POST "https://$instance/api/v1/repos/$owner/$repo/issues/$number/comments" -H "Authorization: Bearer \$GITEA_TOKEN" -H "Content-Type: application/json" -d '{"body":"Your comment"}'
|
- Post issue/PR comment: curl -X POST "https://$instance/api/v1/repos/$owner/$repo/issues/$number/comments" -H "Authorization: Bearer \$GITEA_TOKEN" -H "Content-Type: application/json" -d '{"body":"Your comment"}'
|
||||||
- List PR comments: curl -s "https://$instance/api/v1/repos/$owner/$repo/issues/$number/comments" -H "Authorization: Bearer \$GITEA_TOKEN"
|
- List PR comments: curl -s "https://$instance/api/v1/repos/$owner/$repo/issues/$number/comments" -H "Authorization: Bearer \$GITEA_TOKEN"
|
||||||
- List PR reviews: curl -s "https://$instance/api/v1/repos/$owner/$repo/pulls/$number/reviews" -H "Authorization: Bearer \$GITEA_TOKEN"
|
- List PR reviews: curl -s "https://$instance/api/v1/repos/$owner/$repo/pulls/$number/reviews" -H "Authorization: Bearer \$GITEA_TOKEN"
|
||||||
|
$review_notes
|
||||||
- Merge PR (only with approval): tea pr merge --repo $owner/$repo $number --style merge
|
- Merge PR (only with approval): tea pr merge --repo $owner/$repo $number --style merge
|
||||||
- MERGING requires approval first! Check for: approval in reviews, OR "lgtm"/"approved" in comments
|
- MERGING requires approval first! Check for: approval in reviews, OR "lgtm"/"approved" in comments
|
||||||
- If no approval, ask reviewer to approve first before merging
|
- If no approval, ask reviewer to approve first before merging
|
||||||
|
$delegator_footer
|
||||||
|
|
||||||
Work directory: $worktree_path
|
Work directory: $worktree_path
|
||||||
EOF
|
EOF
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ensure_worktree() {
|
ensure_worktree() {
|
||||||
@@ -386,12 +384,6 @@ ensure_session() {
|
|||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if $worktree_exists && ! $session_exists; then
|
|
||||||
log "warn" "ensure_session" "Worktree exists but session is missing. Removing worktree to recreate both..."
|
|
||||||
remove_worktree_for_issue "$issue_ref"
|
|
||||||
worktree_exists=false
|
|
||||||
fi
|
|
||||||
|
|
||||||
if ! $worktree_exists && $session_exists; then
|
if ! $worktree_exists && $session_exists; then
|
||||||
log "warn" "ensure_session" "Session exists but worktree is missing. Removing stale session..."
|
log "warn" "ensure_session" "Session exists but worktree is missing. Removing stale session..."
|
||||||
rm -f "$session_path"
|
rm -f "$session_path"
|
||||||
@@ -481,6 +473,8 @@ cmd_continue() {
|
|||||||
|
|
||||||
if [ -z "$message" ]; then
|
if [ -z "$message" ]; then
|
||||||
message=$(build_dev_agent_message "$issue_ref" "")
|
message=$(build_dev_agent_message "$issue_ref" "")
|
||||||
|
else
|
||||||
|
message=$(build_dev_agent_message "$issue_ref" "$message")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local worktree_status=$(ensure_worktree "$issue_ref")
|
local worktree_status=$(ensure_worktree "$issue_ref")
|
||||||
|
|||||||
Reference in New Issue
Block a user