Skip to content

Make git push more robust#19

Merged
belaltaher8 merged 3 commits into
mainfrom
belaltaher8/cca-finalize-push-rebase-noverify
Jun 29, 2026
Merged

Make git push more robust#19
belaltaher8 merged 3 commits into
mainfrom
belaltaher8/cca-finalize-push-rebase-noverify

Conversation

@belaltaher8

@belaltaher8 belaltaher8 commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

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:

  • rebases the agent's commit onto origin/ 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";

…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>
GitHub Advanced Security started work on behalf of belaltaher8 June 26, 2026 18:01 View session
GitHub Advanced Security finished work on behalf of belaltaher8 June 26, 2026 18:01
GitHub Advanced Security started work on behalf of belaltaher8 June 28, 2026 00:45 View session
GitHub Advanced Security finished work on behalf of belaltaher8 June 28, 2026 00:45
@belaltaher8 belaltaher8 changed the title WIP: make CCA finalize push resilient to non-fast-forward and local h… Model git push on runtime robust push logic Jun 29, 2026
@belaltaher8 belaltaher8 changed the title Model git push on runtime robust push logic Make git push more robust Jun 29, 2026
@belaltaher8 belaltaher8 marked this pull request as ready for review June 29, 2026 20:28
@belaltaher8 belaltaher8 requested a review from a team as a code owner June 29, 2026 20:28
Copilot AI review requested due to automatic review settings June 29, 2026 20:28

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 onto origin/<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

Comment thread src/git.ts Outdated
GitHub Advanced Security started work on behalf of belaltaher8 June 29, 2026 20:45 View session
GitHub Advanced Security finished work on behalf of belaltaher8 June 29, 2026 20:45
@belaltaher8 belaltaher8 merged commit 938e6b0 into main Jun 29, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants