Phase 2: base squash/diff on the captured post-rebase bump tip (T9)#2
Merged
Conversation
petemoore
added a commit
that referenced
this pull request
Jun 15, 2026
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The squash/finalize reset the agent's work onto the scan-time pr.HeadSHA. A Phase-0 rebase rewrites the branch head, so that SHA is stale, and `reset --soft <stale>` bundles every unrelated `main` change merged since the branch's original base into the single "fix:" commit (confirmed on petemoore/taskcluster Narrow fix (Q11 kept inherit-and-rebase): - Capture the branch's actual tip SHA in cloneAndBranch, right after `checkout -b branch pr.HeadRef` and before the worker runs — the true post-rebase bump commit — on a new Pipeline.bumpTipSHA field. - Use it as the single canonical base for the squash AND the reviewer diff/commit listing (which used origin/<HeadRef>, mis-based and empty/wrong after the worker force-pushes — M4 / MINOR-1). - Plumb it out via RunResult.TipSHA (named return + one defer stamps every exit path) and record the gave_up terminal outcome — and its sticky comment SHA marker — against it, so the next scan's SHA-skip fires on the rebased head instead of re-entering the expensive agent (N4 / MAJOR-1). Every other recordOutcome call stays on pr.HeadSHA per the agreed scope. Tests: - TestSquashBranchUsesCapturedTipNotStaleBase — git integration: squashing on the captured tip yields a fix commit parented on the bump with ONLY the agent's files; shows the stale base would bundle the bump file (the #193 pollution). - TestTerminalSHA / TestGaveUpSkipFiresAfterRebase — the N4 SHA selection and that the skip fires on the rebased head. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
fd6ac8a to
1128e05
Compare
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.
Phase 2 of the rework (
docs/WORKPLAN.md): the T9 narrow fix. Confirmed empirically in Phase 0 (seedocs/WORKPLAN.md→ Validation experiments).The bug (T9)
squashBranchreset the agent's work onto the scan-timepr.HeadSHA. The Phase-0 rebase rewrites the branch head, so that SHA is stale;git reset --soft <stale>then produces a "fix" commit whose diff bundles every unrelatedmainchange merged since the branch's original base. On petemoore/taskcluster #193 the "fix" commit is 300 files / +27,957/−42,840 for a ~3-file query-string compat fix.The fix
Keep inherit-and-rebase (Q11 → A); only change the base SHA the squash uses.
cloneAndBranchright aftercheckout -b branch pr.HeadRef, before the worker runs — the true post-rebase bump commit — onto a newPipeline.bumpTipSHAfield.rev-parsefailure is now fatal (this SHA is load-bearing).bumpTipSHAis now the base for the squash and the reviewer diff/commit listing. The reviewer previously diffedorigin/<HeadRef>...HEAD— mis-based, and reads empty/wrong once the worker force-pushes (MINOR-1). Both now use the stable captured commit.RunResult.TipSHA, set on every exit path via a named return + one defer. Thegave_uppath records its terminal outcome — and the sticky comment's SHA marker — againstTipSHA(viaterminalSHA(tip, scan)), so the next scan's SHA-skip fires on the rebased head instead of re-entering the expensive agent. Every otherrecordOutcomecall stays onpr.HeadSHAper the agreed scope.#193's bloat is dominated by the
-X theirsrebase reverting 289 unrelated files into the bump commit — a broader form of the Q11 residual. This narrow fix is correct and necessary but does not by itself clean a #193-style branch (it bases off that same polluted bump tip). Recorded indocs/questions.mdfor a maintainer decision; out of scope here (would relitigate Q11).Tests
TestSquashBranchUsesCapturedTipNotStaleBase— git integration: builds bump + 2 agent commits, squashes on the captured tip, asserts the fix commit is parented on the bump and contains only the agent's files; demonstrates the stale base would bundle the bump file.TestTerminalSHA,TestGaveUpSkipFiresAfterRebase— the N4 SHA selection and that the skip fires on the rebased head.Local:
go build/vet/test ./...,gofmt,staticcheckall clean.🤖 Generated with Claude Code