Repository navigation
fix(agent): make deleted files readable through file_read_diff - #1698
Merged
lizhengfeng101 merged 2 commits intoOct 12, 2026
Merged
Conversation
Contributor
|
✅ OpenCodeReview: Review complete: 0 finding(s) across 1 selected item(s). |
9 of 15 tasks
NanaseInori
approved these changes
Oct 12, 2026
NanaseInori
left a comment
There was a problem hiding this comment.
Using effectivePath makes deleted-file diffs available under their original paths while retaining destination paths for renames. This matches the path convention used elsewhere in the agent. The updated test covers deletion and rename lookups. No blocking issue found in the code review.
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.
Description
#1680 makes the change list show deleted files under their real paths, but calling
file_read_diffwith those paths fails.file_read_diffreads diffs by path from a map built byinjectDiffMap, which skips entries whoseNewPathis the sentinel/dev/nulland keys the rest byNewPath. A deleted file has/dev/nullas itsNewPathand its real path only inOldPath, so the map has no entries for deleted files.Fix: the map is now keyed by
effectivePath(d). The change list in #1680 prints the same value, so every file name in the list is a key in the map. For files that were not deleted,effectivePath(d)returnsNewPath, and their keys stay the same.The map is built before file selection, so deleted files that selection excludes are readable too, including those matching a secret path built into OCR. Files that were not deleted already behave this way on main; for example, a modified
.envthat selection excludes can be read throughfile_read_diff. #1262 also states that agent runtime tools were intentionally left unchanged when it introduced the secret path rules.TestInjectDiffMappreviously asserted that looking updeleted.goreturnsnot found, and now asserts that the lookup returns the file's diff. The deletion fixture now carries theIsDeleted: truethat the parser actually produces; otherwise an implementation that skips deleted files byIsDeletedwould also pass the test. The test also adds a renamed file and asserts that it is still keyed byNewPath.Type of Change
How Has This Been Tested?
With the test changes kept and the production change reverted,
TestInjectDiffMapfails:End to end: I built binaries from
mainand from this branch and ranocr review --commit HEADon a commit that deleteshelper.goand modifiesmain.go. The LLM endpoint is a local stub, compatible with the OpenAI API, that records requests and answers the main task with afile_read_diffcall forhelper.go. Onmainthe tool result isError: diff not found for the requested paths; on this branch it is:With fix(agent): list deleted files under their own path in the change list #1680 merged into this branch, the same scenario shows
DELETED helper.go (+0/-3)in the change list, and the tool result is the same as above.make testpasses locallyManual testing (describe below)
Checklist
go fmt,go vet)AI/LLM disclosure, Claude Code (Claude Opus 5.5) was used to investigate the failure, prepare the changes, and draft this PR.
Related Issues
This PR follows up on #1680.