Skip to content

Bundle transport fails with 'refusing to merge unrelated histories' in shallow checkout #31345

Closed

Description

@mrjf

Problem

The bundle transport for push_to_pull_request_branch (#30287) fails in the safe_outputs job because the job uses a shallow checkout (fetch-depth: 1). When git merge --ff-only tries to merge the bundle ref into the local branch, git refuses because the shallow clone doesn't have enough history to find a common ancestor.

[command]/usr/bin/git merge --ff-only refs/bundles/push-autoloop-build-tsb-pandas-typescript-migration
fatal: refusing to merge unrelated histories
##[error]Failed to apply bundle: The process '/usr/bin/git' failed with exit code 128

Reproduction

Every autoloop run on githubnext/tsessebe hits this. The safe_outputs job:

  1. Shallow-clones main (fetch-depth: 1)
  2. Fetches the PR branch (git fetch origin autoloop/build-tsb-pandas-typescript-migration)
  3. Fetches the bundle to refs/bundles/...
  4. Tries git merge --ff-only refs/bundles/... → fails: unrelated histories

The bundle contains commits that descend from the PR branch, but the shallow clone doesn't have enough history to see that relationship.

Possible fixes

  1. Unshallow before merge: git fetch --unshallow (or deepen enough to find the merge base)
  2. Use git update-ref instead of git merge --ff-only — directly point the branch at the bundle's HEAD (if the bundle is a strict superset)
  3. Use the GitHub API to update the branch ref instead of local git operations
  4. Increase fetch-depth in the safe_outputs checkout step

Impact

All autoloop programs on githubnext/tsessebe are blocked. Every run since the v0.72.1 upgrade fails at safe_outputs with this error.

Related

Activity

  1. linked a pull request that will close this issueFix bundle transport in shallow checkouts #31346on May 10, 2026
  2. mrjf commented on May 11, 2026

    @mrjf
    ContributorAuthor

    #31346 fixed the git merge --ff-only step but the failure now happens earlier — at git fetch <bundle> itself:

    [command]/usr/bin/git fetch /tmp/gh-aw/aw-autoloop-perf-comparison.bundle refs/heads/autoloop/perf-comparison:refs/heads/autoloop/perf-comparison
    error: Repository lacks these prerequisite commits:
    error: 466842b1f487366ad12921b8b64e8a846c347a34 
    error: 3810dc016756c2078e074f888fa39cbdc75d7fa8 
    

    The bundle references parent commits that the depth-1 clone doesn't have. The fix needs to either:

    1. git fetch --unshallow before fetching the bundle
    2. Or deepen the clone enough to include the bundle's prerequisites
    3. Or generate bundles that don't require prerequisites (use --all or include the full history needed)

    Example run (v0.74.0 deployed, #31346 included): https://github.com/githubnext/tsessebe/actions/runs/25702866515

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions