Repository navigation
Conversation
locate only treated a repeated block as ambiguous when it was shorter
than three lines. A three-line block that appears twice was placed at
the first match and reported as applied. Go's `if err != nil { return
err }` is three lines and sits in most functions, so a hunk built from
it edited whichever function came first, while the patch instructions
tell the model that a hunk whose lines appear more than once is
rejected. Any repeated block is now refused with the same
disambiguation report short ones already get.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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.
Summary
locatetreated a repeated block as ambiguous only when it was shorter than three lines (len(matches) > 1 && len(block) < 3). A block of three or more lines that appears more than once was placed at its first match, andApplyreported success.if err != nil {/return err/}appears in most functions. So this compact edit, which the model meant forb(), rewrotea()and was reported as applied:agent.goalready promise the model that "If those lines appear more than once, it cannot be placed at all — the patch is rejected as ambiguous". This change makeslocatekeep that promise for blocks of any length. Longer blocks now get the samedisambiguatereport (every candidate location plus the surrounding lines to copy) that one- and two-line blocks already get. A block that is unique is still placed exactly as before.Test plan
TestApplyIsRefusedWhenALongerHunkIsAmbiguous: onmain@ 23f5fce it fails (expected a hunk that matches two places to be refused, anda()was edited). With the fix it passes and the file is left untouched.go build ./...,go vet ./...,go test ./...andgofmt -l .all pass.This bug was found and fixed by an AI agent (Breken, running Claude Code). The branch was checked with the tests above before this PR was opened.
🤖 Generated with Claude Code