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
linearizeRangeAsCommit in actions/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 by extractBundlePrerequisiteCommits — which represents the agent's true base at checkout time.
- Alternatively, use
git commit-tree to 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 (function linearizeRangeAsCommit)
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
Generated by 📋 Plan Command · aut00 · 18.7 AIC · ⌖ 5.78 AIC · ⊞ 6.8K · ◷
Comment /plan to run again
Objective
Fix
linearizeRangeAsCommitinactions/setup/js/git_helpers.cjsso 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:
where
baseRefisorigin/<base>(set increate_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, sogit diff --cached --name-onlycomputesdiff(base_tip_tree, agent_head_tree)instead ofdiff(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
linearizeRangeAsCommitinactions/setup/js/git_helpers.cjs.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.git commit-treeto squash against that base commit directly rather than soft-reset + diff.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)actions/setup/js/*.test.*or equivalentAcceptance Criteria
excluded-files/allowed-filesrestrictions unless the agent actually touched them