Skip to content

[WIP] Fix push_to_pull_request_branch for HEAD-only bundles - #50912

Closed
pelikhan with Copilot wants to merge 1 commit into
mainfrom
copilot/push-to-pull-request-branch-fix
Closed

[WIP] Fix push_to_pull_request_branch for HEAD-only bundles#50912
pelikhan with Copilot wants to merge 1 commit into
mainfrom
copilot/push-to-pull-request-branch-fix

Conversation

Copilot AI commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Thanks for asking me to work on this. I will get started on it and keep this PR's description up to date as I form a plan and make progress.


This section details on the original issue you should resolve

<issue_title>push_to_pull_request_branch cannot apply HEAD-only filtered bundles</issue_title>
<issue_description>## Summary

push_to_pull_request_branch cannot apply a valid HEAD-only git bundle produced by filtered bundle synthesis. create_pull_request.applyBundleToBranch already supports this bundle shape, but the push handler always fetches refs/heads/<branch> and fails when only HEAD is advertised.

Production reproduction

Run: https://github.com/microsoft/vscode-engineering/actions/runs/31064344569

After the checkout-hook workaround, the agent created the requested changes and emitted push_to_pull_request_branch. Authentication succeeded with gh-aw v0.85.0 (no duplicate Authorization error). Safe outputs then failed:

fatal: couldn't find remote ref refs/heads/fix/notebook-celllist-invalid-index-328987-aw-30926877686
Failed to apply bundle: Failed to fetch bundle

Downloaded bundle heads:

4f80191700da9afc6d0b20b9ec6c81fb376f8714 HEAD

The fork branch remained at e226f0c.

Root cause

Filtered bundle synthesis uses a detached temporary worktree and creates the bundle from <base>..HEAD, so the bundle advertises HEAD rather than refs/heads/<target>. create_pull_request.cjs::applyBundleToBranch handles this by inspecting git bundle list-heads and fetching HEAD:<temp-ref>. push_to_pull_request_branch.cjs lacks that fallback and throws immediately when there are no missing prerequisite commits.

Proposed fix

When the initial named-ref fetch fails without prerequisite errors:

  1. inspect git bundle list-heads;
  2. prefer the single validated refs/heads/* entry if one exists;
  3. otherwise accept exactly one <40-hex> HEAD entry and fetch HEAD:<bundle-temp-ref>;
  4. retain existing prerequisite recovery and fail closed for ambiguous or invalid bundles;
  5. add a unit/integration test for HEAD-only filtered bundles.</issue_description>

Comments on the Issue (you are @copilot in this section)

Copilot AI requested a review from pelikhan August 6, 2026 16:16
@pelikhan pelikhan closed this Aug 6, 2026
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.

push_to_pull_request_branch cannot apply HEAD-only filtered bundles

2 participants