Make git push more robust#19
Merged
Merged
Conversation
…ooks The Engine SDK finalize push (commitAndPush -> finalizeChanges) ran a bare "git push --set-upstream origin HEAD" with no rebase/retry and surfaced only Node's generic "Command failed" message, dropping git's rejection reason. On follow-up CCA jobs the runner can check out a base behind the live branch tip, so the finalize push is rejected non-fast-forward and fails silently. This change: - rebases the agent's commit onto origin/<branch> and retries the push when a push is rejected non-fast-forward (fetch first / behind); - surfaces git's captured stdout/stderr so the real reason is logged instead of a bare "Command failed"; - adds --no-verify to commit/push as defense-in-depth so automated CCA pushes are not blocked by the repository's local git hooks (matches the runtime error path, which already pushes with noVerify). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves resiliency and debuggability of the Engine SDK’s git push flow by capturing git stdout/stderr in errors and retrying rejected non-fast-forward pushes via fetch+rebase.
Changes:
- Added a
git()helper that captures stdout/stderr and includes combined output in thrown errors. - Added
pushWithRebaseFallback()to detect non-fast-forward push rejections, fetch/rebase ontoorigin/<branch>, and retry the push. - Updated
commitAndPush()to use the new helper and push fallback.
Show a summary per file
| File | Description |
|---|---|
| src/git.ts | Adds captured git output on failures and a non-fast-forward push rebase/retry fallback, then wires it into commitAndPush(). |
Review details
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 1/1 changed files
- Comments generated: 1
- Review effort level: Low
ritchxu
approved these changes
Jun 29, 2026
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.
This PR adds some resiliency to when the engine SDK pushes. If we run into an issue where the push is rejected, we rebase the current branch and then try again.
Specifically this changes: