Uh oh!
There was an error while loading. Please reload this page.
fix: disambiguate sync-from-public branch checkout - #1235
Conversation
After 'git remote add public' fetches the same branches that already exist on origin, 'git checkout <branch>' becomes ambiguous and fails with: fatal: 'preview' matched multiple (2) remote tracking branches Both sync jobs now use 'git checkout -B <branch> origin/<branch>' which explicitly resets the local branch from origin's tracking ref, removing the ambiguity and combining the previous 'checkout + reset --hard' into one step. Last 4 scheduled runs of 'Sync from Public Repo' all failed with this error; the workflow has been silently broken since the public/origin branches collided.
Package TarballHow to installnpm install https://github.com/aws/agentcore-cli/releases/download/pr-1235-tarball/aws-agentcore-0.13.1.tgz |
agentcore-cli-automation
left a comment
There was a problem hiding this comment.
Looks good to merge. The diagnosis is accurate — git fetch public main populates refs/remotes/public/main (since git remote add installs the default +refs/heads/*:refs/remotes/public/* fetch refspec), so once both origin and public have a main/preview ref, DWIM git checkout <branch> becomes ambiguous and fails. git checkout -B <branch> origin/<branch> sidesteps DWIM by giving git an explicit start point, and it preserves the original semantics (force-create-or-reset local branch to origin/<branch>) while collapsing two commands into one. Symmetric application to both jobs is correct. No test or telemetry concerns since this is CI infra.
Coverage Report
|
Uh oh!
There was an error while loading. Please reload this page.
Summary
The `Sync from Public Repo` workflow has been silently failing on every scheduled run (every 6h) since the public-origin branch collision started. This PR fixes the underlying `git` ambiguity.
Root cause
Each job runs:
```bash
git remote add public https://github.com/aws/agentcore-cli.git
git fetch public main # or 'preview'
...
git checkout main # ← ambiguous!
```
After fetching, both `origin` and `public` have a branch named `main` (and `preview`), so the DWIM shortcut `git checkout main` fails:
```
fatal: 'preview' matched multiple (2) remote tracking branches
##[error]Process completed with exit code 128.
```
Recent failures (all caused by this):
Fix
Replace `git checkout ` + `git reset --hard origin/` with `git checkout -B origin/` in both jobs. `-B` creates or resets the local branch from an explicit ref, sidestepping the DWIM ambiguity entirely and consolidating two steps into one.
Why now
Before the App-token rollout (5767d93), the same workflow already had this latent bug — but at that time the public mirror was lagging behind, so the `merge-base --is-ancestor` short-circuit kept hiding it. Once the repos drifted, every run started hitting the failed `checkout`.
Test plan