fix(tui): show every file in multi-file edit permission prompts by drakeo338 · Pull Request #55344 · anomalyco/opencode · GitHub
Skip to content

fix(tui): show every file in multi-file edit permission prompts - #55344

Open
drakeo338 wants to merge 3 commits into
anomalyco:devfrom
drakeo338:claude/55337-fix
Open

drakeo338 wants to merge 3 commits into
anomalyco:devfrom
drakeo338:claude/55337-fix

Conversation

@drakeo338

@drakeo338 drakeo338 commented Oct 14, 2026 •

Copy link
Copy Markdown

Issue for this PR

Closes #55337

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

The edit permission prompt read only metadata.files[0], so approving an apply_patch that touched several files showed a single diff. It now exposes every file and renders each diff under its own file label (also in the mini footer), falling back to the combined diff when an entry has no patch.

How did you verify your code works?

Added tests in packages/tui/test; before the change 4 of 5 failed, after it all 5 pass on the committed HEAD.

AI-assisted (Claude Code); I reviewed and tested the change.

Screenshots / recordings

None; I did not capture a recording.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

The edit permission read only metadata.files[0], so approving an apply_patch touching several files showed one diff. Expose all files and render each one.
Read the label from the file entry (file, filePath, relativePath) instead of the positional resource, which was wrong when a move made resources longer than files. Show the mini footer diffs with the same per-file header, and fall back to the combined diff when an entry has no patch.
@github-actions

Copy link
Copy Markdown
Contributor

@opencode-agent opencode-agent Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good. I ran the reproduction script from #55337 on the base and on this branch, both from source. On the base the prompt read Edit src/alpha.ts and showed only alpha's diff. With this change it reads Edit 3 files and shows each file's diff under its own path label, with a scrollbar for the rest. The metadata it reads (file and patch on each entry) matches what the patch tool sends, including the target path for moves. The new tests and the nearby permission tests pass, and typecheck in packages/tui passes.

Public API: unchanged. The new files field on PermissionPresentation is internal to the TUI.

One concern, noted inline: in mono mode the per-file labels are dropped, so several diffs are shown with nothing saying which file each belongs to.

Before

After

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In mono mode this joins every file's diff into lines without the file path, so a multi-file prompt shows several diffs with nothing saying which file each one is. The title only says Edit N files. Could each diff be preceded by its file path, as the non-mono rendering does? Otherwise mono users still can't tell which files they are approving.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pushed 6eb7374: mono-mode multi-file edit permission prompts now show each file's path above its diff, as the non-mono view does.

In mono mode the multi-file edit prompt listed every diff with nothing saying which file it belonged to. Put the file path before each diff, as the non-mono rendering does.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Apply Patch / Edit permission view only shows the first file

1 participant