fix(branch): Reject unresolved explicit anchors#14812
Open
reneleonhardt wants to merge 1 commit into
Open
Conversation
Keep an omitted anchor as the only path that selects the default workspace base. Reject a supplied external commit before branch metadata or refs are changed, preventing later picks from producing synthetic conflict trees. Co-Authored-By: GPT-5.6 Sol <codex@openai.com>
reneleonhardt
force-pushed
the
fix/fetched-merge-anchor-replay
branch
from
July 17, 2026 13:14
dcfbf7f to
ef4c545
Compare
Collaborator
|
Thanks a lot for the minimal fix and the tests. As the source change is so minimal, I think @slarse would be able to take a look and see if the PR has merit, especially in the face of a possibly planned 'branch2'. |
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.
fix(branch): Reject unresolved explicit anchors
🧢 Changes
but branch new --anchor <value>that cannot be resolvedin the current workspace.
--anchor.ref.
☕️ Reasoning
An explicit anchor is a requested history boundary, not a hint. Omitting one
and supplying one that cannot be resolved are distinct operations.
The invariant is independent of selector syntax: future change-ID or worktree
graph improvements may make more anchors resolvable, but an unresolved explicit
anchor must never fall back to the workspace base. Failing before mutation
keeps the repository recoverable and prevents agentic coding from replaying
history onto a boundary it did not request.
🧪 Reproduction
cargo test -p but rejects_fetched_merge_anchor_outside_workspace_before_replayBefore this fix, the explicit fetched merge anchor was treated as absent, so
branch creation succeeded at the workspace common base and a later replay could
synthesize widespread conflicts.
✅ Verification
reconstruction ref is created.
passed.
Developed with carefully directed, manually reviewed AI assistance.
Co-Authored-By: GPT-5.6 Sol codex@openai.com