Conversation
|
PR author is not in the allowed authors list. |
|
@bottercode is attempting to deploy a commit to the Modem Team on Vercel. A member of the Team first needs to authorize it. |
squad-joey
left a comment
There was a problem hiding this comment.
The opt-in image-view flow works in my scoped Linux PTY checks at d3d28805. With the same PNG inputs, base 88f8dbed stays on the raw binary view; head shows the before/after preview under --no-extensions and a second i restores the raw view.
I exercised file comparison and Git working-tree inputs, including an untracked added PNG and a deleted PNG. At 160 columns, both captions share a row; resizing to 62 columns stacks them, and widening restores the side-by-side layout. Corrupt replacement bytes and a Git LFS pointer produce the expected explanation while retaining the readable side. A text SVG stays in the raw diff on both revisions.
An additional live-session check kept the preview selected while changing the replacement PNG and running session reload: the dimensions updated from 32×20 to 12×24, with the old caption gone. Toggling back to raw still worked.
No actionable UI regression found in those checks. This is not verification of Kitty graphics, exact pixel output, JPEG/GIF/WebP, or the byte-reader/API contract.
Supporting checks and limits
- Exact base
88f8dbedf5a879d8bf0fb051ee22f1280f4b5dd8→ headd3d2880596dcae36fbffbce1d0ba721a833b7f2d; Linux x86_64, Bun 1.4.2, frozen dependencies without lifecycle scripts, isolated HOME/config/temp paths and test sessions. - Independent seven-case PTY matrix on each revision, plus the head live-reload check. Existing file-view PTYs: base 14 pass, head 15 pass.
- Head: 135 focused UI tests, 118 review-conformance tests and typecheck pass.
- TTY smoke initially had the same two filename assertions fail on both revisions with my long isolated temp path: the displayed filename was truncated. Both revisions pass all 11 with an equally isolated shorter temp path; the long-path failure wasn't fixed by this PR.
- No full default or full PTY suite, installed-binary, macOS or Windows verification. These checks cover the current opt-in behavior, not a decision about the proposed default key or whether previews should be enabled by default.
This comment was generated by Pi using GPT-6.1 Sol
squad-robert
left a comment
There was a problem hiding this comment.
The byte-reader/backend slice works in my Linux checks, with one request-deduplication issue below to fix before relying on the new API’s “at most once per file and side” guarantee.
On 88f8dbed → d3d28805, the same real loader workloads go from no binary byte capability to exact old/new bytes for index/worktree, HEAD/index, HEAD/worktree, commit, rename, addition, deletion, untracked and file-pair inputs. The fixtures contain NUL and invalid UTF-8 bytes; binary files remain outside text-source consumers. Exact-limit/over-limit filesystem and Git reads, stream cancellation, and optional-reader/failure handling also checked out.
The overlapping-request regression fails on head and passes with a scratch-only pending-read cache. That experiment preserves failed-read retry behavior; head and experiment each pass the focused 125-test slice and typecheck.
This isn’t image-rendering certification: I didn’t verify Kitty pixels, UI layout, installed binaries or non-Linux behavior. Jujutsu isn’t installed here, so its real-repository byte test was skipped, not verified.
This comment was generated by Pi using GPT-6.1 Sol
|
|
||
| let result: unknown; | ||
| try { | ||
| result = await read({ |
There was a problem hiding this comment.
[P2] Share in-flight reads across replacement file-view requests
The cache is populated only after await read(...). If another layout request asks for this side before that finishes, it starts another backend read instead of sharing the first one. I reproduced this with a real Git-loaded binary: start readBytes("old"), abort that input, then create a replacement createFileViewInput over the same DiffFile and read the old side. That launches two git show processes; two calls within a single input correctly launch only one.
This breaks the public reader’s “at most once per file and side” contract and duplicates I/O/buffer allocation when requests are replaced while bytes are loading. Please cache the pending per-side promise immediately and share it across requests, while still evicting rejected/malformed reads so later layouts can retry. A scratch-only pending cache makes the same real-Git regression pass without losing the existing retry behavior.
This comment was generated by Pi using GPT-6.1 Sol
There was a problem hiding this comment.
Good catch, fixed in 1afbd3c (was c42d5d2 before the rebase). The pending read is now cached per side as soon as it starts, so a replacement request shares the in-flight git show; rejected or malformed answers are evicted so later layouts can still retry. Added a test that issues two overlapping requests and asserts one adapter call; it fails on the previous implementation.
squad-robert
left a comment
There was a problem hiding this comment.
My in-flight byte-read finding is addressed at c42d5d27.
The original real-Git reproduction now launches one git show read across an aborted file-view input and its replacement, versus two on d3d28805. The original byte-fidelity and side-selection checks still pass. I also checked overlapping rejected, malformed and too-large reads: callers share the pending read, transient failures remain retryable, and the other side stays independent.
The new regression test fails on the previous implementation and passes here; the focused slice is now 126 pass / 9 skip, and typecheck passes.
No remaining objection from that backend finding. This isn’t blanket image-feature approval; the previously stated rendering/platform limitations still apply.
This comment was generated by Pi using GPT-6.1 Sol
squad-joey
left a comment
There was a problem hiding this comment.
Rechecked the UI slice at c42d5d279caed7a15b843d9f0cc00fcf561ae162 after the byte-cache change. The same seven PNG/SVG controls and the active-preview session-reload check pass, including narrow/wide reflow and toggling back to raw. No UI/layout code changed from the previously reviewed head.
Existing file-view PTYs (15), focused UI tests (135), review conformance (118), typecheck and short-path TTY smoke (11) also pass on this exact head.
This remains a Linux/Bun 1.4.2 source-level UI check—not verification of the deduplication/retry fix, exact Kitty pixels, other image formats, installed binaries or other platforms. The earlier review's full-suite and long-temp-path limits still apply.
This comment was generated by Pi using GPT-6.1 Sol
Changed PNG, JPEG, GIF, and WebP files show only "Binary file skipped". Add a bundled "Image preview" file view (toggled with `i`, or View → File presentation) that draws the before and after images inline with OpenTUI's <image>, plus a summary of dimensions and size. To keep the preview provider-neutral, extension API 32 adds: - `ExtensionFileViewInput.readBytes(side)`, lazy and cached like `readDocument`, and served for binary files; - optional `ExtensionVcsPatchResult.readFileBytes`, implemented by the Git and Jujutsu providers. File comparisons and untracked files read bytes from disk. Bundled UI can now register file views, composed ahead of user views like bundled commands and highlighters.
The byte fetcher cached a side only after its read finished, so a layout request that replaced an aborted one while bytes were loading started a second provider read. Cache the pending read immediately and evict it only when it rejects or answers malformed, so later layouts can still retry.
c42d5d2 to
1afbd3c
Compare
squad-joey
left a comment
There was a problem hiding this comment.
Rechecked the rebase/API-33 integration at 1afbd3c5a49b20135d6a260946f8558f6299e6ef (base 96619dbc). The earlier PNG UI checks still pass on this exact head: seven file-pair/Git/error/SVG-control cases plus actual session reload, including wide ↔ narrow layout and updated PNG dimensions with preview selected.
Existing file-view PTYs pass (15), as do focused file-view/host/selection tests (192), review conformance (118), typecheck, and TTY smoke (11). Linux source, Bun 1.4.2, isolated sessions, --no-extensions.
No actionable UI integration issue found. This does not independently verify the backend deduplication contract, Kitty image pixels, other image formats/platforms, or the full test suites.
This comment was generated by Pi using GPT-6.1 Sol
|
+1 from a user who'd really like to see this land. I review a lot of agent-generated changes to Android projects — drawables, launcher icons, screenshot fixtures — and right now every one of them is "Binary file skipped", so I have to leave Hunk to check the images. I tried the extension route first, but on API 32 a file view can't get a binary file's bytes, so it ends up shelling out to Git like the first prototype here did. The On the open questions, as one user:
It looks like the PR is only blocked on bookkeeping: squad-robert's earlier "changes requested" review is still active even though the follow-up review says it was addressed in |


Problem
When an agent changes an icon, screenshot, or other image, Hunk shows only "Binary file skipped", so reviewing the change means leaving the terminal. Follow-up to the Discord thread with screenshots of the prototype, and to #1178, which made binary files selectable again.
What this adds
i(or View → File presentation → Image preview) to draw the before and after images inline where "Binary file skipped" was, with a summary such assame size 180×180 · 1.4 KB → 2.2 KB (+822 B). Sides sit next to each other on wide terminals and stack on narrow ones. Added and deleted images show the one side that exists; undecodable bytes and Git LFS pointers get a caption instead of an image.maintook 32 forctx.selection.layout):ExtensionFileViewInput.readBytes(side), lazy, deduplicated, andnull-on-failure exactly likereadDocument, but also served for binary files.ExtensionVcsPatchResult.readFileBytes, the byte counterpart ofreadFileSource. It takes the same request, and the boundary caches each side once. It is optional, so existing adapters (e.g. hunk-hg) keep working; their files simply keep the raw diff.hunk diff a.png b.png, difftool) and untracked images read from disk.--no-extensions.Why core
My first version was an extension, but it had to run
git cat-fileon the blob ids in the patch header, because file views had no way to get a binary file's bytes. That only works for Git and doesn't belong in an extension or in core. The general piece is the byte reader, which also enables PDF, font, or hex views as extensions. The image preview is then a small bundled view on top, with no VCS-specific code.Decisions I'd like your call on
ias the default key.iwas unbound on the review surface. Bundled commands are composed before user extensions, though, so an extension that already bindsinow loses it, with the existing chord-conflict warning. One test extension usedifor exactly that, and I moved it too. Happy to ship the command unbound instead (hunk.imagePreview.toggle).Visual evidence
Ghostty on macOS,
hunk show a3321c82 --no-extensions(the logo commit), auto layout, default theme, 200×50, run from source:Real pixels (Kitty graphics) also scroll cleanly. With the images partly scrolled under the pinned file header, the top rows are cut off, nothing draws over the header, and nothing stays behind.
Terminal multiplexers
Hunk doesn't pick the image protocol itself; OpenTUI's
<image>does.OPENTUI_IMAGE_PROTOCOL=kittywith tmux'sallow-passthroughforces Kitty graphics, at the usual passthrough risks.With
terminal.kitty_graphics = false, herdr stops advertising image support, and the preview falls back to blocks as in tmux.Tests
@hunk/vcs/source.readBytesdeduplication andnullresolution.ishows the preview with no extensions loaded, and pressing it again restores the raw diff.scripts/packaging: the doc-example and consumer checks now cover the new API.Commands run (macOS, Bun 1.4.3):
The
bun run testfailures on both this branch and cleanmainare therewriteInstalledPackageSpecifiersgroup (4), "does not retain resolution misses across installs", "locates relative dependency files…", "selects import versus require conditions…", "suppresses lifecycle scripts in transitive Git dependencies…", and "status-owned reload configuration…". The integration failure on both is "enabled trusted launch extensions span real broker-mounted sibling reviews and shut down once". A terminal-color-watcher test failed once and passed on the rerun.Limitations
hunk patch/ stdin input.