Repository navigation
Show Codex file-change approvals as a diff card instead of failing them - #1639
Conversation
Solenta-Message-Id: 42506aaf-d5c8-4b1b-8c4f-120a5fe57a74
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2786bfbd9e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| <div className={diffStyles.patch} data-permission-diff=""> | ||
| {patches.map((p) => ( | ||
| <Fragment key={p.path}> | ||
| <div className={diffStyles.hunkHead}>{p.path}</div> |
There was a problem hiding this comment.
Show the source path for moved files
For an update with move_path, parsePatch selects the +++ destination as p.path, and this heading plus FileHunks is the entire visible diff. The original c.path exists only in patch headers that are never rendered, so a pure rename with an empty diff appears as just the destination and gives no indication that the source file will disappear. Render the source-to-destination rename explicitly before allowing approval.
Useful? React with 👍 / 👎.
| return patch.length <= FILE_CHANGE_DIFF_MAX | ||
| ? patch | ||
| : `${patch.slice(0, FILE_CHANGE_DIFF_MAX)}\n\\ diff truncated (${patch.length - FILE_CHANGE_DIFF_MAX} more chars)\n`; |
There was a problem hiding this comment.
Keep the truncation warning visible outside parsed hunks
When a patch exceeds 200,000 characters and the cutoff lands between file sections or inside a diff --git/---/+++ header, the appended truncation marker is not inside an @@ hunk. parsePatch and FileHunks therefore discard the marker, while edits in the remaining tail are also omitted and the Accept buttons remain enabled. Surface truncation as structured card metadata outside the patch parser so users cannot unknowingly approve an incomplete diff.
Useful? React with 👍 / 👎.
path.relative returned src\a.js on Windows, so the git-style patch headers read a/src\a.js and failed the windows-latest electron test. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…keep #1190 main's #1190 also mapped item/fileChange/requestApproval, as a JSON dump of the streamed item. Kept this branch's diff card and itemId lookup for file changes; the approval action and pendingFromApproval now cover only item/permissions/requestApproval. One ask-file-change fake scenario. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Closes #1189.
Codex app-server's
item/fileChange/requestApprovalused to be fail-closed with a JSON-RPC error because no UI could show what the agent wanted to write. This PR maps it onto the existing pending-permission queue and renders the proposed changes as a diff in the permission card.The request only names an
itemIdand carries no diff. The changes live on thefileChangeitem announced initem/started.Changes
runner-provider-codex.js: keeps each in-flightfile_changeitem'schangesincodexFileChanges, keyed by item id, and drops the entry onitem.completed.codexApprovals.js:classifyServerRequestnow returnsaction: "fileChange"and no longer lists the method as unsupported.pendingFromFileChangebuilds anEditpending permission. Its summary is the first path plus a count of any other files, and it includes the ask'sreasonandgrantRoot.fileChangePatchturns Codexchangesinto a git-style patch:runner-permissions.js:item/startedwas seen for theitemId, the ask still fails closed with an error, so nothing is approved without its diff.classifyToolon every touched path, move target andgrantRoot, and the strictest result applies: any deny wins over ask.fileChangeis passed through to the renderer in the pending-permission info.src/shared/ipc.ts: addsfileChange?: { diff, reason, grantRoot }toPendingPermissionInfo.cards.tsx: whenfileChangeis present,PermissionPromptshows:grantRootasks for session-wide write access under a directory;parsePatchand drawn with the existingFileHunksunified view.Tests
fileChangePatchcovering delete, a move, and a path outside the root.ask-file-changescenario in the fake Codex CLI sendsitem/startedand then the approval request. An end-to-end test checks the pending diff, reason andgrantRoot, and thatallowAlwaysrepliesacceptForSession.test/permissionPrompt.test.tsxfor the file-change card.item/startedis missing or no handler takes the request.realpathSync, so the fake'sprocess.cwd()(/private/var/...on macOS) matches the expected relative paths.🤖 Generated with Claude Code