Repository navigation
fix(composer): import clipboard disk images within limits - #2532
Closed
skyler-developer wants to merge 1 commit into
Closed
skyler-developer wants to merge 1 commit into
skyler-developer wants to merge 1 commit into
Conversation
vastsa#2316 routed every native clipboard file into a path-only live reference, so pasted screenshot-tool images (PixPin copy-as-file, Finder/Explorer copies) stopped reaching the model as visual content (vastsa#2529). Split the reference flow per file: images within the picker import limits (same isImageFile decision, SVG excluded, 64 MiB per file, 128 MiB across one paste's images) materialize into session scratch via importComposerFiles and dispatch as regular visual attachments; non-image files and oversized images keep the no-copy live reference, and a paste whose images exceed the total cap falls back to references for all of them. Fixes vastsa#2529
Collaborator
|
Review: this fixes the confirmed #2316 regression and retains the bounded-reference path for non-images/oversized files. The branch has targeted unit coverage; however, PR #2533 adds a real built-Desktop/preload/Host/native-pasteboard E2E (with a local model fixture) and covers deleting the source before dispatch. I recommend consolidating on #2533 rather than landing two competing implementations. This PR is also based on 7254a04, 15 commits behind/diverged from current |
This was referenced Nov 24, 2026
Closed
Contributor
Author
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.
Summary / 概要
Native clipboard file paste (PixPin "copy as file", Finder/Explorer copies) regressed in 0.23.0: #2316 routed every clipboard disk file into a path-only live reference, so pasted disk images stopped reaching the model as visual content — the agent only saw a
Local file references … (N bytes)text. Bitmap screenshots were unaffected, which is why only file-copying screenshot tools broke.Fix: split the clipboard reference flow per file in
referenceComposerFiles:isImageFiledecision as picker/drag imports, SVG excluded, 64 MiB per file, 128 MiB across one paste's images) materialize into session scratch via the existingimportComposerFilesand return withoutlocalReference— they dispatch exactly like picker images (inline chip, image block on send,attachments/<sha256>archival). This restores the 0.22 behavior.The IPC layer (
composer/importFileswithreference: true) is unchanged; docs synced (ADR, IPC protocol spec, E2E scenarioE2E-COMPOSER-local-file-references).Requirement link / 需求关联
Closes #2529Validation / 验证
Task candidate: branch
fix/clipboard-image-import(commit b02dbc1) based on latestorigin/main(7254a04, merge-base verified).pnpm build:js— passpnpm --filter @pi-desktop/desktop typecheck— passpnpm lint— passnode --import ./test/helpers/ts-import-hooks.mjs --test test/composer-file-references.test.mjs— 7/7 pass, including two new regression tests ([Bug] 新版本无法读取图片内容 #2529): mixed png/txt/svg paste imports the png in paste order and keeps references for the rest; an image set past the 128 MiB batch cap stays fully referenced with no scratch writesNOT RUN:
node scripts/e2e-composer-paste.mjs(Electron binary unavailable; deps installed with--ignore-scripts). Its--file-references-onlymode pastes a 64 MiB+1 binary and a text file, both of which still take the reference path after this change, so the script required no edits and its assertions remain valid. The image-import branch is covered by the new unit tests.Platform note: verified by code trace and unit tests on macOS. The reported PixPin flow is Windows-specific; real-machine paste verification on Windows is still pending — happy to hear results from a Windows user.
Rollback / 回滚
Single commit reverting to the #2316 all-reference behavior; no schema, IPC contract, or persisted-format changes (
localReferencerecords and scratch imports already exist).