Repository navigation
Description
Objective
Fix linearizeRangeAsCommit in actions/setup/js/git_helpers.cjs so the rewrite path diffs against the agent's actual base commit instead of the current (possibly moved) origin/<base> tip.
Context
When a shallow checkout forces the signed-push rewrite path (merge commit detected in the bogus full-history range), the code does:
await execApi.exec("git", ["reset", "--soft", baseRef], ...execArgs);where baseRef is origin/<base> (set in create_pull_request.cjs:333, used at :346). If the base branch has moved since the agent's checkout, this soft-reset leaves the index at the new tip's tree, so git diff --cached --name-only computes diff(base_tip_tree, agent_head_tree) instead of diff(agent_base_tree, agent_head_tree). This causes the synthesized commit to revert unrelated base-branch drift and delete files added to base after checkout, attributing them to the agent.
Suggested Approach
- Locate
linearizeRangeAsCommitinactions/setup/js/git_helpers.cjs. - Instead of resetting to
origin/<base>tip, reset/diff against the bundle's actual base commit — the prerequisite SHA already extracted byextractBundlePrerequisiteCommits— which represents the agent's true base at checkout time. - Alternatively, use
git commit-treeto squash against that base commit directly rather than soft-reset + diff. - If the resulting commit needs to sit on the current branch tip, rebase it onto the tip rather than absorbing tip differences into the diff.
- Add/update tests simulating a moving base branch (commits added to base after the agent's checkout) and assert the synthesized commit only contains the agent's actual changes.
Files to Modify
actions/setup/js/git_helpers.cjs(functionlinearizeRangeAsCommit)actions/setup/js/create_pull_request.cjs(baseRef computation around line 333/346, if needed)- Relevant test files under
actions/setup/js/*.test.*or equivalent
Acceptance Criteria
- Rewrite path no longer reverts base-branch commits added after the agent's checkout
- Rewrite path no longer includes files matching
excluded-files/allowed-filesrestrictions unless the agent actually touched them - New/updated tests cover a moving-base-branch scenario with a merge commit forcing the rewrite path
- Existing tests pass
Generated by 📋 Plan Command · aut00 · 18.7 AIC · ⌖ 5.78 AIC · ⊞ 6.8K · ◷
Comment /plan to run again
- expires on Jul 31, 2026, 2:14 PM UTC-08:00
Activity
github-actions commentedon Jul 29, 2026
🍪 Issue Monster selected this for Copilot
I identified this issue as a good candidate for automated resolution and requested assignment to the Copilot coding agent.
If assignment succeeds, the Copilot coding agent will analyze the issue and create a pull request with the fix.
Om nom nom! 🍪