You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: packages/agent/src/server/agent-server.ts
+11-2Lines changed: 11 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -1643,9 +1643,14 @@ After completing the requested changes:
1643
1643
1. Check out the existing PR branch with \`gh pr checkout ${prUrl}\`
1644
1644
2. Stage and commit all changes with a clear commit message
1645
1645
3. Push to the existing PR branch
1646
+
4. For every PR review comment or review thread you addressed, treat the thread as done only after BOTH of these:
1647
+
- Reply on the thread with a short note describing what changed (reference the commit SHA when useful) using \`gh api -X POST /repos/{owner}/{repo}/pulls/{n}/comments/{id}/replies -f body='...'\`.
1648
+
- Resolve the thread via the \`resolveReviewThread\` GraphQL mutation: \`gh api graphql -f query='mutation($id:ID!){resolveReviewThread(input:{threadId:$id}){thread{isResolved}}}' -f id="<thread-node-id>"\`.
1649
+
List unresolved threads first with \`gh api graphql -f query='{repository(owner:"<owner>",name:"<repo>"){pullRequest(number:<n>){reviewThreads(first:100){nodes{id isResolved comments(first:1){nodes{body}}}}}}}'\` so you can resolve each one you fixed.
1646
1650
1647
1651
Important:
1648
1652
- Do NOT create a new branch or a new pull request.
1653
+
- Do NOT push fixes for review comments without replying to and resolving each related thread.
1649
1654
${attributionInstructions}
1650
1655
`;
1651
1656
}
@@ -1661,7 +1666,7 @@ When the user asks for code changes:
1661
1666
When the user explicitly asks to clone or work in a GitHub repository:
1662
1667
- Clone the repository into /tmp/workspace/repos/<owner>/<repo> using \`gh repo clone <owner>/<repo> /tmp/workspace/repos/<owner>/<repo>\`
1663
1668
- Work from inside that cloned repository for follow-up code changes
1664
-
- If the user explicitly asks you to open or update a pull request, create a branch, commit the requested changes, push it, and open a draft pull request from inside the clone
1669
+
- If the user explicitly asks you to open or update a pull request, create a branch, commit the requested changes, push it, and open a draft pull request from inside the clone. Before opening the PR, check the cloned repo for a PR template at \`.github/pull_request_template.md\` (or variants; fall back to the org's \`.github\` repo via \`gh api\`) and use it as the body structure, and search for matching open issues with \`gh issue list --search\` to include \`Closes #<n>\` / \`Refs #<n>\` links.
1665
1670
- Do NOT create branches, commits, push changes, or open pull requests unless the user explicitly asks for that`;
1666
1671
1667
1672
return`
@@ -1704,7 +1709,11 @@ After completing the requested changes:
1704
1709
1. Create a new branch prefixed with \`posthog-code/\` (e.g. \`posthog-code/fix-login-redirect\`) based on the work done
1705
1710
2. Stage and commit all changes with a clear commit message
1706
1711
3. Push the branch to origin
1707
-
4. Create a draft pull request using \`gh pr create --draft${this.config.baseBranch ? ` --base ${this.config.baseBranch}` : ""}\` with a descriptive title and body. Add the following footer at the end of the PR description:
1712
+
4. Before opening the PR, prepare the body:
1713
+
- Check the repo for a PR template at \`.github/pull_request_template.md\` (also try \`.github/PULL_REQUEST_TEMPLATE.md\`, \`docs/pull_request_template.md\`, and root variants). If one exists, use its exact section headings as the PR body — do NOT fall back to a generic Summary/Test plan format.
1714
+
- If no repo-level template exists, check the org's \`.github\` repo via \`gh api /repos/<owner>/.github/contents/.github/pull_request_template.md\` (and other common paths) and use that as a fallback.
1715
+
- Search for matching open issues with \`gh issue list --state open --search '<keywords>'\` (derive keywords from the branch name, commits, and changed files; \`gh issue view <n>\` to confirm relevance). For every issue this PR would resolve, include a \`Closes #<n>\` line in the body so GitHub auto-links and auto-closes it on merge. For issues that are related but not fully resolved, use \`Refs #<n>\` instead.
1716
+
5. Create a draft pull request using \`gh pr create --draft${this.config.baseBranch ? ` --base ${this.config.baseBranch}` : ""}\` with a descriptive title and the body prepared above. Add the following footer at the end of the PR description:
1708
1717
\`\`\`
1709
1718
---
1710
1719
*Created with [PostHog Code](https://posthog.com/code?ref=pr)*
0 commit comments