You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(native-chat): list each file in a counted Codex diff - #48033
When Codex edits two files in one step, the finished chat turn now lists both files. Before, that turn showed no changed-files summary at all.
What Changed
Before: a completed multi-file Codex edit was saved as one diff labeled 2 files, with the real names kept beside it. The chat summary only read the label, treated it as "not a file," and showed nothing.
After: the summary reads that file list and splits the joined diff on the blank line between files. One file's own hunks stay together. a.txt and b.txt show up with their own add/remove counts. A 2 files diff that has no file list still shows no card.
Why
The names were already on the journal row. Pairing hunks by count would attach a cut file's later hunk to the next path, so the split only accepts a blank line between files, which is what joining those diffs produces.
N/A. This is text in the completed-turn summary, not a layout change. I did not launch Orca. The unit test checks the file names and the +2 -2 / +1 -1 counts.
Testing
I manually tested these changes locally
Automated tests added/updated, or explained why not below
Every added test fails without this change and avoids the test anti-patterns
src/shared/native-chat/tools/native-chat-file-count-diff.test.ts failed before the fix (files was undefined) and passed after it. Neighbor agent-message-preview-line.test.ts passed (12 tests total).
Also ran oxlint, oxfmt --check, and check-changed-code-quality.mjs --base origin/main (0 new findings). pnpm tc:web exited 0.
Did not run full pnpm lint, full pnpm test, pnpm build, or a live Codex chat.
Performance
None, because this only parses a completed multi-file diff when the turn summary is built. A one-file edit is unchanged.
Risk
Level: Low
A joined diff whose blank lines do not match the file list still shows no summary, which is the old behavior. A wrong split would list a hunk under the wrong name; the split refuses that shape. Revert the two commits to restore the missing summary. No saved data, wire, or platform branch changes.
AI Disclosure
Authored by Cursor Agent (Grok 4.7). Independent review: magpie-remote did not respond (HTTP 000), so OpenAI Codex via codex exec read-only reviewed the branch. Round 1 found findings and the split was tightened. Round 2 on 0fd79c82786 reported no actionable findings.
Review
Agent skill upstream boundary
Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.
Notes
Open #42271 also touches codex-structured-item-translation.ts for review-mode items. This PR does not edit that file.
Checklist
This PR is small and focused
I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
I stated the risk: what could break, for whom, and how to back it out
Before/after screenshots or videos attached for UI changes, or N/A with reason
Self-reviewed for correctness, security, and performance
Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)
The diff projection now includes nonempty action paths. Native chat filters those paths and passes multiple valid paths to the patch parser. The parser splits a joined patch when the number of nonempty diff parts matches the number of paths, then parses each part. A test checks that the resulting summaries contain separate paths and change counts for two files.
Severity of issue fixed: Medium
Merge Risk: Low · up to 0fd79
Multi-file Codex patch summaries now list each file, but a rename on the last file would be shown as a plain edit. This is a small display issue that is easy to fix before or shortly after merge.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title names the change and its scope: a counted Codex diff now lists each file in native chat. It matches the main change in the summary, which splits a multi-file Codex diff by its path list. It …
Description check
The description follows the template and fills most sections. It covers ELI5, What Changed, Why, a linked issue (Fixes #48025), Visual Proof (N/A with reason), Testing, Performance, Risk with level, A…
Linked Issues check
Issue #48025 requires a completed Native Chat turn to list a.txt and b.txt with +1 -1 each when one apply_patch updates both files. At the reviewed head, editFilesFromPatchText no longer returns null …
Out of Scope Changes check
All changed files serve the objective of #48025. The native-chat-edit-patch-files.ts change adds the counted-path split and the summary-only and truncation handling for it. The native-chat-edit-normal…
Full details: Title check
Explanation
The title names the change and its scope: a counted Codex diff now lists each file in native chat. It matches the main change in the summary, which splits a multi-file Codex diff by its path list. It uses the conventional commit form and avoids vague terms.
Full details: Description check
Explanation
The description follows the template and fills most sections. It covers ELI5, What Changed, Why, a linked issue (Fixes #48025), Visual Proof (N/A with reason), Testing, Performance, Risk with level, AI Disclosure, and the upstream boundary checkbox. Required gaps remain: the Testing checklist leaves the manual-test box unchecked, and the Performance section is one line that is acceptable. The final checklist item for lint, typecheck, test, and build is unchecked, though the author lists which checks ran. The Ensure-no-issues Notes section is template text. The description is mostly complete.
Full details: Linked Issues check
Explanation
Issue #48025 requires a completed Native Chat turn to list a.txt and b.txt with +1 -1 each when one apply_patch updates both files. At the reviewed head, editFilesFromPatchText no longer returns null for a file-count path when countedPaths has at least two entries. filesForFileCountPath splits the joined diff with splitCountedFileDiffs. The split accepts only when the number of blank-line-separated parts equals paths.length, then pairs each part with its path and parses it as a single-file diff. editFilesFromToolPair passes input.paths through countedFilePaths, and the structured tool-call projection now forwards paths when present. The author reports that native-chat-file-count-diff.test.ts fails before the fix and passes after it, and that it asserts the names a.txt and b.txt with +2 -2 and +1 -1 counts. The two-call control path produces one-path diffs and is unchanged. Limitation: I did not run the test suite. The result relies on the diff-level code reading and the author's reported test results. The split depends on join('\n') producing a blank line between per-file diffs, which the code comment states.
Full details: Out of Scope Changes check
Explanation
All changed files serve the objective of #48025. The native-chat-edit-patch-files.ts change adds the counted-path split and the summary-only and truncation handling for it. The native-chat-edit-normalize.ts change forwards input.paths as countedPaths. The structured-agent-session-tool-call-block.ts change projects paths into the Diff tool-call input, which the normalizer needs. The test file covers the new behavior. No unrelated change was found. The PR description notes that the related open PR #42271 is not edited here, and no edits to codex-structured-item-translation.ts appear in the reviewed summary.
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
The reason will be displayed to describe this comment to others. Learn more.
Minor · Functional Correctness · Quick win
Preserve the final file's move marker.
If the second file's diff ends with Moved to: c.txt, this call removes the marker and discards movedTo. With paths ["a.txt", "b.txt"], recursive parsing then reports b.txt as edited instead of reporting its rename to c.txt.
Split bounded.text without removing the move marker. Let each recursive parser process its own marker. Ordinary updates will retain the same splitting behavior.
The reason will be displayed to describe this comment to others. Learn more.
This gap is real on 0fd79c82786: filesForFileCountPath strips a final Moved to from the whole payload, so the last file stays an edit.
A local follow-up, e8144ebea4a, leaves that marker on the last blank-line part. I am not pushing it. #48038 is now open on the same issue and edits this same parser with a different split.
Thanks @bbingz for digging into this and for the fix! We landed the change for #48025 through #48038, which adds git headers per file on the Codex side, so the client never has to split on blank lines (add or delete content that contains blank lines could otherwise split in the wrong place). Your idea of carrying body.paths into the Diff call is in there too, as the check that the files match, and you're credited as a co-author on the commit. Closing this one in favor of #48038.
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
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.
ELI5
When Codex edits two files in one step, the finished chat turn now lists both files. Before, that turn showed no changed-files summary at all.
What Changed
Before: a completed multi-file Codex edit was saved as one diff labeled
2 files, with the real names kept beside it. The chat summary only read the label, treated it as "not a file," and showed nothing.After: the summary reads that file list and splits the joined diff on the blank line between files. One file's own hunks stay together.
a.txtandb.txtshow up with their own add/remove counts. A2 filesdiff that has no file list still shows no card.Why
The names were already on the journal row. Pairing hunks by count would attach a cut file's later hunk to the next path, so the split only accepts a blank line between files, which is what joining those diffs produces.
Linked Issue
Fixes #48025
Visual Proof
N/A. This is text in the completed-turn summary, not a layout change. I did not launch Orca. The unit test checks the file names and the
+2 -2/+1 -1counts.Testing
src/shared/native-chat/tools/native-chat-file-count-diff.test.tsfailed before the fix (fileswas undefined) and passed after it. Neighboragent-message-preview-line.test.tspassed (12 tests total).Also ran oxlint, oxfmt --check, and
check-changed-code-quality.mjs --base origin/main(0 new findings).pnpm tc:webexited 0.Did not run full
pnpm lint, fullpnpm test,pnpm build, or a live Codex chat.Performance
None, because this only parses a completed multi-file diff when the turn summary is built. A one-file edit is unchanged.
Risk
Level: Low
A joined diff whose blank lines do not match the file list still shows no summary, which is the old behavior. A wrong split would list a hunk under the wrong name; the split refuses that shape. Revert the two commits to restore the missing summary. No saved data, wire, or platform branch changes.
AI Disclosure
Authored by Cursor Agent (Grok 4.7). Independent review: magpie-remote did not respond (HTTP 000), so OpenAI Codex via
codex execread-only reviewed the branch. Round 1 found findings and the split was tightened. Round 2 on0fd79c82786reported no actionable findings.Review
Agent skill upstream boundary
Notes
Open #42271 also touches
codex-structured-item-translation.tsfor review-mode items. This PR does not edit that file.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)