feat(cloud-agent): add createSignedCommit for GitHub-signed commits#2282
Merged
Conversation
Contributor
Author
This stack of pull requests is managed by Graphite. Learn more about stacking. |
75ff8ae to
59c67ab
Compare
Contributor
Prompt To Fix All With AIFix the following 2 code review issues. Work through them one at a time, proposing concise fixes.
---
### Issue 1 of 2
packages/git/src/signed-commit.ts:140-158
**Base-branch guard bypassed when `branch` is explicitly provided**
When the caller explicitly passes `input.branch` (e.g. `branch: "main"`), `resolveBranchName` returns early on line 144 before the `baseBranch` comparison is ever reached. A call like `createSignedCommit(ctx, { message: "...", branch: "main" })` will happily commit directly to the protected base branch even when `ctx.baseBranch === "main"`. The guard only fires for the implicit "use HEAD" path.
### Issue 2 of 2
packages/git/src/signed-commit.test.ts:1-57
**Prefer parameterised tests**
The four `chunkFileChanges` cases (deletions-only, single chunk, multi-chunk split, oversized file) share the same function under test and could be expressed with `it.each`, which is the team's preferred style. The split test also doesn't assert `chunks[2].deletions`, leaving an unverified element — a gap that a table-driven test covering all chunks uniformly would naturally close.
Reviews (1): Last reviewed commit: "feat(cloud-agent): add createSignedCommi..." | Re-trigger Greptile |
ed1b37b to
c34db07
Compare
joshsny
approved these changes
May 21, 2026
Contributor
joshsny
left a comment
There was a problem hiding this comment.
this feels very annoying to maintain for the signed commits win, anything easier we can do? if not I guess we go with it
Send staged changes through GitHub's createCommitOnBranch GraphQL mutation to produce server-signed ("Verified") commits without a local signing key. Adds payload chunking, a shared mapWithConcurrency helper extracted from queries.ts, execGh stdin support, and exports buildPostHogTrailers.
createCommitOnBranch ran a single `gh api graphql` with no timeout, so a stalled connection (the same condition behind GitHub's HTTP 499) hung the signed-commit tool indefinitely. execGh now accepts a timeout, and createCommitOnBranch retries transient failures (499/5xx/timeouts/network) with exponential backoff while leaving deterministic 4xx errors alone.
c34db07 to
ecbb810
Compare
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Problem
Cloud-agent commits must be GitHub-signed ("Verified")
Changes
createSignedCommitto@posthog/git. It sends staged changes through GH'screateCommitOnBranchGraphQL mutationmapWithConcurrencyhelperexecGhstdin (input) support so the GraphQL payload is piped instead of passed via argvbuildPostHogTrailersfor theGenerated-By/Task-Idtrailers