Repository navigation
fix(agent): list deleted files under their own path in the change list - #1680
Open
Trainingcqy wants to merge 2 commits into
Open
Trainingcqy wants to merge 2 commits into
Trainingcqy wants to merge 2 commits into
Conversation
Contributor
|
✅ OpenCodeReview: Review complete: 0 finding(s) across 1 selected item(s). |
Contributor
|
Thanks, the fix looks good to me. One optional follow-up: now that the change list shows if d.NewPath != "/dev/null" {
m[d.NewPath] = d.Diff
}Keying it by |
9 of 15 tasks
Author
|
Thanks for the suggestion. I opened #1698 separately to key the map by |
This branch has not been deployed
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
The default plan and main task prompts both carry an
<other_changed_files>block that lists the other changed files in one place. Deleted files that pass the static filters are listed there too, as the comment onfileDecision.retainedstates: "they carry no new content to review but still belong to the change-file list the prompts show."Each entry in the block is produced by
formatDiffEntry, which printsd.NewPath. A deleted file'sNewPathis the sentinel/dev/nulland its real path is only inOldPath, so every deleted file is listed as the same/dev/null. Below is an excerpt from the main task request whenocr review --commit HEADruns on a commit that deleteshelper.goandother.goand modifiesmain.go:The model learns only that two files were deleted, with no way to tell which two. In this example
main.gostill callsHelper(), yet nothing in the prompt lets the model connect that call to the deletedhelper.go.Fix:
formatDiffEntrynow printseffectivePath(d), a helper the package already has. The block in the plan and main task prompts is built from the same value, so the fix applies to both. After the fix, the same request contains:The file list used for grouping is also produced by
formatDiffEntry, but it contains no deleted files, so it is unaffected.The deletion fixture in
TestBuildChangeFilesExceptGroupwas written asNewPath: "removed.go", a shape the parser never produces, so the test did not catch this problem. It now uses the shape the parser actually produces.Out of scope:
file_read_diffstill cannot read a deleted file's diff. The model can now see these file names, and a query for one returns "diff not found", the same result as querying/dev/nullbefore the fix.Type of Change
How Has This Been Tested?
With the updated test kept and the production change reverted,
TestBuildChangeFilesExceptGroupfails:End to end: I built binaries from
mainand from this branch and ranocr review --commit HEADagainst a local stub that records requests and is compatible with the OpenAI API. The two excerpts above come from the main task requests it recorded. The change in this example is small, so the plan phase was skipped.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.