Skip to content

create_pull_request safe-output: bundle contains only HEAD, no refs/heads/* entry — fallback in #31955 cannot recover (v0.76.0) #34844

@PaulAylward2

Description

@PaulAylward2

Summary

When the create_pull_request safe-output handler runs, the bundle produced by the agent step contains only a HEAD ref — there is no refs/heads/* entry. The fallback added in #31955 (which inspects git bundle list-heads and retries the fetch using the discovered branch ref) requires exactly one refs/heads/* entry and aborts with expected exactly 1 refs/heads entry, found 0.

Net effect: every run that produces changes fails to create a PR, with no recovery path.

This reproduces unchanged from v0.74.4 through v0.76.0 (latest). Tried signed-commits: false and preserve-branch-name: true — both fail identically, so the bug is not in the signed-push code path nor in salt handling; the bundle itself never contains a refs/heads/* entry regardless.

Reproduction

  • gh-aw compiler: v0.76.0
  • AWF runtime: v0.25.55
  • Engine: copilot
  • Workflow trigger: workflow_dispatch (also reproduces on schedule)
  • Repository: shallow checkout (actions/checkout default fetch-depth: 1); git fetch --unshallow succeeds prior to bundle apply
  • Both signed-commits: false and preserve-branch-name: true fail the same way

Log excerpt (v0.76.0)

Patch size: 2 KB (maximum allowed: 1024 KB)
Using branch name from JSONL with added salt: docs/update-migration-version-2026-05-19-4fe3b9f7f99fc1d6
Branch name sanitized: "docs/update-migration-version-2026-05-19" -> "docs/update-migration-version-2026-05-19-4fe3b9f7f99fc1d6"

Applying bundle ...bundle to refs/heads/docs/update-migration-version-2026-05-19-4fe3b9f7f99fc1d6
  using temp ref refs/bundles/create-pr-...-46849576
  from refs/heads/docs/update-migration-version-2026-05-19

Repository is shallow; fetching full history before applying bundle
git fetch --unshallow origin    # succeeds

git fetch <bundle> refs/heads/docs/update-migration-version-2026-05-19:refs/bundles/...
fatal: couldn't find remote ref refs/heads/docs/update-migration-version-2026-05-19

; resolving branch ref from bundle heads
git bundle list-heads <bundle>
ac85f4047717ec43c931d750575f5251c45dc705 HEAD
Bundle list-heads returned 0 candidate branch ref(s): (none)

Error: Failed to apply bundle: Failed to resolve bundle branch ref from
list-heads: expected exactly 1 refs/heads entry, found 0
Error: ✗ Message 1 (create_pull_request) failed: Failed to apply bundle

Expected

Either:

  1. Bundle construction writes a refs/heads/<branch> entry alongside HEAD so the fast path (or the existing Handle bundle ref mismatch in create_pull_request safe output #31955 fallback) can succeed, or

  2. Handle bundle ref mismatch in create_pull_request safe output #31955 fallback is extended to handle the zero-refs/heads/HEAD-only case — e.g. use the HEAD SHA directly as the source object and assign it to the destination ref:

    git fetch <bundle> HEAD:refs/bundles/<dest>
    # then update-ref refs/heads/<branch-with-salt> <SHA>
    

Suspected cause

PR #31955 added the bundle list-heads fallback, but its "exactly 1 refs/heads entry" assertion is strictly less recoverable than the previous failure mode for HEAD-only bundles. Before #31955 the fast path failed with a clear couldn't find remote ref message; after #31955 the fallback fires but fails for a different reason that masks the underlying problem — the bundle never had a branch ref in the first place.

The real fix likely belongs at bundle creation; the apply-side fallback is the symptom surface.

Workflow config (minimal repro)

safe-outputs:
  create-pull-request:
    title-prefix: "[docs-bot] "
    labels: [documentation, automated]
    expires: 14

Tried (none of which fix it)

  • signed-commits: false
  • preserve-branch-name: true
  • Both combined

Metadata

Metadata

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions