Prevent stale-base signed replay from synthesizing unrelated changes; enforce policy on GraphQL payload#36937
Draft
Copilot wants to merge 6 commits into
Draft
Prevent stale-base signed replay from synthesizing unrelated changes; enforce policy on GraphQL payload#36937Copilot wants to merge 6 commits into
Copilot wants to merge 6 commits into
Conversation
Co-authored-by: dsyme <7204669+dsyme@users.noreply.github.com>
Co-authored-by: dsyme <7204669+dsyme@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix signed-commit push to handle shallow checkouts correctly
Prevent stale-base signed replay from synthesizing unrelated changes; enforce policy on GraphQL payload
Jun 4, 2026
dsyme
requested changes
Jun 4, 2026
Collaborator
dsyme
left a comment
There was a problem hiding this comment.
Unshallow should not be used,
Single 'git fetch --unshallow origin' is disastrous on high-churn monorepos. Instead iterate 'git fetch origin <base> --deepen=N' with progressively larger N (50, 100, 200, 500, 1000, 2000, 4000) until every bundle-declared prerequisite satisfies 'git merge-base --is-ancestor <prereq> origin/<base>'. Falls back to --unshallow only if iterative deepen exhausts, or if a legacy caller omits the deepen options.
The two tests that asserted 'git fetch --unshallow' was called on a shallow checkout were written against the old single-unshallow path. With iterative --deepen they need to: declare a bundle prerequisite (via mocked 'git bundle verify'), report it as not-an-ancestor of origin/<base>, and then assert the first --deepen=<N> step was issued.
g-jobayer
approved these changes
Jun 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When safe-outputs runs on a shallow/stale checkout and base advances, signed replay could compute
fileChangesfrom an old parent while targeting currentorigin/<base>, producing large unrelated reverts and bypassingprotected_fileschecks. This change hardens signed replay so payload synthesis is based on a compatible base and policy is enforced on what is actually sent to GraphQL.Signed replay base-alignment (stale-parent guard)
HEAD, rebases local replay range onto current parent before GraphQL replay.Payload-level policy enforcement (defense in depth)
fileChanges(the actual GraphQL payload), not only agent-emitted patch text.max_patch_filesmax_patch_sizeprotected_filespolicyBundle history readiness in shallow clones
ensureFullHistoryForBundlenow unshallows (git fetch --unshallow origin) before bundle processing so prerequisite ancestry/merge-base logic is reliable.Handler integration
create_pull_requestandpush_to_pull_request_branchnow pass handler config intopushSignedCommitsasvalidationConfig, enabling payload-level policy checks during signed replay.