fix(cli): init --pr stamps the checked-out SHA, not the pre-checkout HEAD (#669) - #672
Conversation
…HEAD (#669) init --pr resolved and saved the project commit SHA at the user's HEAD BEFORE selectMode fetched and checked out the PR head — the project identity, the scan-dir key, and the sha-level meta.json all pointed at a commit that was never scanned, while the analyzed tree was the PR head. The first --incremental scan then took the never-analyzed SHA as its diff base. Fix: selectMode (which runs FetchPR) now runs BEFORE the project save; after the PR checkout, the commit SHA is re-resolved so the project, scan dir, and meta all name the tree that was actually checked out. A re-resolution failure is a warning (the project names the pre-checkout commit — degraded but not silent), never an init abort. Fixes #669 Agent: ISSUES-TO-PR ses_f3e7372a5ffe3b2I6lP4Wm3w2d
|
Status: ON HOLD — do not merge. The adversarial review (2026-09-22) found defects in this PR that need rewriting before it can merge. The specific finding is in the review record. The PR is being rewritten; the current branch and all evidence are preserved. Agent: ISSUES-TO-PR ses_f3e7372a5ffe3b2I6lP4Wm3w2d |
|
Hold stands — real work remains, honestly listed: the 2026-09-22 10:41Z containment hold is NOT lifted for this PR. The branch's last commit predates the hold and the fix cycle it demanded never ran on it: no regression test for the stamped-SHA behavior, the run's core-promise table shows the coverage MISS, and the verification pass found a body/code contradiction — the body says an explicit |
|
Fix-offer packet — three items before this PR could be called ready:
Menu: (a) you fix (the guard + the test + the ordering disposition); (b) we push under review provenance with your ack; (c) rescope with the reason. Your census's CASE 6 claimed the composed-path tests — none have landed on the branch; if they're still coming, say so and the packet waits. |
An explicit --commit under --pr was silently overridden by the PR checkout's re-resolve: the project stamped the post-checkout SHA with no line saying the user's flag was superseded. Warn exactly when the explicit flag coexists with the PR path. Agent: PR-MERGE process (the maintainer's author grant turn 33 + the push waiver turn 35); RED->GREEN receipt: the e2e probe (the fake refs/pull remote) — pre-patch 0 override-warnings with the stamp overridden; post-patch the warning fires, the stamp identical.
What
openant init <repo> --pr Nnow stamps the checked-out commit SHA (the PR head), not the pre-checkout HEAD. Closes #669.The bug
init resolved and saved the project's commit SHA before
selectModefetched and checked out the PR head. The project identity, the scan-dir key, and the sha-levelmeta.jsonall pointed at a commit that was never scanned, while the analyzed tree was the PR head — a self-inconsistent record. The first--incrementalscan then took the never-analyzed SHA as its diff base (git diff <pre-checkout>...HEADmeasures the wrong range).The issue's executed repro (a public Hello-World clone, zero spend — init does no LLM work) proved it: init --pr saved the pre-checkout SHA while the tree was at the PR head.
The fix
selectMode(which runsFetchPR) now runs before the project save. After the PR checkout, the commit SHA is re-resolved so the project, scan dir, and meta all name the tree that was actually checked out. A re-resolution failure is a warning (degraded but not silent — the project names the pre-checkout commit), never an init abort.--commit+--prcorrection (2026-09-23, verified against the diff — the earlier line here was wrong): when both are set, the stamped SHA is the post-checkout PR head, not the user's explicit--commitvalue (init.gore-resolves and overrides under--pr). This is the intended invariant — the recorded identity must name the tree actually scanned, matching the existing tested contract incmd/init_commit_test.go(an unmatched local--commitis ignored with a warning). A composed-path regression test covering this combination is queued with this PR's fix cycle.Testing
go build ./...— clean build--prordering; the fix reorders within init.go's flow, not across function boundaries)Fixes #669
Agent: ISSUES-TO-PR ses_f3e7372a5ffe3b2I6lP4Wm3w2d