feat(cloud): instruct agent to create signed commits via GraphQL API#2213
Open
Piccirello wants to merge 1 commit into
Open
feat(cloud): instruct agent to create signed commits via GraphQL API#2213Piccirello wants to merge 1 commit into
Piccirello wants to merge 1 commit into
Conversation
Piccirello
commented
May 19, 2026
Contributor
Prompt To Fix All With AIFix the following 3 code review issues. Work through them one at a time, proposing concise fixes.
---
### Issue 1 of 3
packages/agent/src/server/agent-server.ts:1633-1637
**Broken heredoc — unterminated shell construct**
The heredoc uses `<<'EOF'` but the terminator ` EOF` is indented with three spaces. POSIX shell requires the terminator for `<<'EOF'` to appear at column 0 — a leading space means the shell will never see the end of the heredoc, consuming the rest of the script as literal content. The `<<-'EOF'` variant strips leading *tabs* only, not spaces, so re-indenting with tabs would fix it — but the cleanest fix is to simply not indent the heredoc body and terminator relative to the outer code block.
### Issue 2 of 3
packages/agent/src/server/agent-server.ts:1651-1654
**`git reset --hard` discards uncommitted working-tree changes**
The instructions say "For *each* commit you want to make", so the agent may loop through steps 1–5 multiple times. After step 5's `git reset --hard "origin/$BRANCH_NAME"`, any files the agent had modified but not yet staged (intended for a later commit) are permanently gone. A safer alternative after the mutation succeeds is to update only the branch ref without touching the working tree, e.g. `git update-ref refs/heads/"$BRANCH_NAME" "$NEW_OID"` and then `git fetch origin "$BRANCH_NAME"` without the hard reset.
### Issue 3 of 3
packages/agent/src/server/agent-server.ts:1607-1629
**`$BRANCH_TIP_SHA` used before it is assigned**
Step 3's bash snippet references `"$BRANCH_TIP_SHA"` in the `git diff` invocation, but the variable is never assigned inside that snippet. Step 2 tells the agent to "determine the branch's current tip SHA" in prose, but there is no shell command that exports `BRANCH_TIP_SHA` before the snippet in step 3 uses it. The agent would have to infer the assignment (e.g. `BRANCH_TIP_SHA=$(git rev-parse HEAD)`). Making the assignment explicit in the snippet, or adding it as the first line of the step-3 code block, would make this self-contained and less fragile.
Reviews (1): Last reviewed commit: "feat(cloud): instruct agent to create si..." | Re-trigger Greptile |
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.
8243ba1 to
ea18f32
Compare
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 land unsigned because the sandbox runs
git commitwith no signing key. This prevents us from enforcing signed commits in our repos.Changes
Switch the cloud system prompt to instruct the agent to use GitHub's
createCommitOnBranchmutation instead, which signs commits with the API token identity automatically.How did you test this?
Untested tbqh
Publish to changelog?
Yes!