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
feat(cloud): instruct agent to create signed commits via GraphQL API
Cloud agent commits land unsigned because the sandbox runs `git commit` with
no signing key. Switch the cloud system prompt to instruct the agent to use
GitHub's `createCommitOnBranch` mutation instead, which signs commits with the
API token identity automatically.
- Every commit you create through this flow will be marked "Verified" on GitHub
1661
+
and authored by the GitHub App associated with the token. Do not attempt to
1662
+
override the author identity.
1663
+
- Do NOT add \`Co-Authored-By\` trailers or \`Generated with [Claude Code]\` lines.
1664
+
Use only the \`Generated-By: PostHog Code\` and \`Task-Id: ${taskId}\` trailers
1665
+
shown above.`;
1610
1666
1611
1667
if(prUrl){
1612
1668
if(!shouldAutoCreatePr){
@@ -1620,7 +1676,7 @@ Do the requested work, but stop with local changes ready for review.
1620
1676
Important:
1621
1677
- Do NOT create new commits, push to the branch, or update the pull request unless the user explicitly asks.
1622
1678
- Do NOT create a new branch or a new pull request.
1623
-
${attributionInstructions}
1679
+
${signedCommitInstructions}
1624
1680
`;
1625
1681
}
1626
1682
@@ -1631,12 +1687,16 @@ This task already has an open pull request: ${prUrl}
1631
1687
1632
1688
After completing the requested changes:
1633
1689
1. Check out the existing PR branch with \`gh pr checkout ${prUrl}\`
1634
-
2. Stage and commit all changes with a clear commit message
1635
-
3. Push to the existing PR branch
1690
+
2. Stage your changes with \`git add\` (do NOT run \`git commit\`)
1691
+
3. Create signed commits on the existing PR branch using the GitHub GraphQL
1692
+
flow described below. The branch already exists, so skip the "create branch"
1693
+
step — use the current PR branch tip as the first \`oid\`.
1636
1694
1637
1695
Important:
1638
1696
- Do NOT create a new branch or a new pull request.
1639
-
${attributionInstructions}
1697
+
- Do NOT use \`git commit\` or \`git push\`; commits must be created via
1698
+
\`createCommitOnBranch\` so they are signed.
1699
+
${signedCommitInstructions}
1640
1700
`;
1641
1701
}
1642
1702
@@ -1651,8 +1711,12 @@ When the user asks for code changes:
1651
1711
When the user explicitly asks to clone or work in a GitHub repository:
1652
1712
- Clone the repository into /tmp/workspace/repos/<owner>/<repo> using \`gh repo clone <owner>/<repo> /tmp/workspace/repos/<owner>/<repo>\`
1653
1713
- Work from inside that cloned repository for follow-up code changes
1654
-
- 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
1655
-
- Do NOT create branches, commits, push changes, or open pull requests unless the user explicitly asks for that`;
1714
+
- If the user explicitly asks you to open or update a pull request, create a
1715
+
branch (by pushing an empty ref), then create signed commits on it via
1716
+
\`createCommitOnBranch\` (see below), and open a draft pull request
1717
+
- Do NOT create branches, commits, push changes, or open pull requests unless the user explicitly asks for that
1718
+
- Do NOT use \`git commit\` or \`git push\` for commit creation; commits must be
1719
+
created via the GitHub GraphQL API so they are signed`;
1656
1720
1657
1721
return`
1658
1722
# Cloud Task Execution — No Repository Mode
@@ -1671,7 +1735,7 @@ ${publishInstructions}
1671
1735
1672
1736
Important:
1673
1737
- Prefer using MCP tools to answer questions with real data over giving generic advice.
1674
-
${attributionInstructions}
1738
+
${signedCommitInstructions}
1675
1739
`;
1676
1740
}
1677
1741
@@ -1683,26 +1747,35 @@ Do the requested work, but stop with local changes ready for review.
1683
1747
1684
1748
Important:
1685
1749
- Do NOT create a branch, commit, push, or open a pull request unless the user explicitly asks.
1686
-
${attributionInstructions}
1750
+
${signedCommitInstructions}
1687
1751
`;
1688
1752
}
1689
1753
1690
1754
return`
1691
1755
# Cloud Task Execution
1692
1756
1693
1757
After completing the requested changes:
1694
-
1. Create a new branch prefixed with \`posthog-code/\` (e.g. \`posthog-code/fix-login-redirect\`) based on the work done
1695
-
2. Stage and commit all changes with a clear commit message
1696
-
3. Push the branch to origin
1697
-
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:
1758
+
1. Pick a branch name prefixed with \`posthog-code/\` (e.g. \`posthog-code/fix-login-redirect\`)
1759
+
2. Create the branch on the remote by pushing an empty ref:
3. Stage your changes with \`git add\` (do NOT run \`git commit\`)
1765
+
4. Create signed commits on the new branch using the GitHub GraphQL flow
1766
+
described below. Use \`$BASE_SHA\` as the first commit's \`oid\`.
1767
+
5. 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:
1698
1768
\`\`\`
1699
1769
---
1700
1770
*Created with [PostHog Code](https://posthog.com/code?ref=pr)*
1701
1771
\`\`\`
1702
1772
1703
1773
Important:
1704
1774
- Always create the PR as a draft. Do not ask for confirmation.
1705
-
${attributionInstructions}
1775
+
- Do NOT use \`git commit\` or \`git push <branch>\` for commit creation; commits
1776
+
must be created via \`createCommitOnBranch\` so they are signed. The only
1777
+
\`git push\` allowed is the empty-ref push in step 2 to create the branch.
0 commit comments