Repository navigation
feat(native-chat): attach several files from one picker selection - #23956
brennanb2025 merged 9 commits into
Conversation
|
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📥 CommitsReviewing files that changed from the base of the PR and between 25b2561df8f16569bf7e0d79a99c085e6d66912d and 9023fa8071c5badd52c84db977e7d576088eb240. 📒 Files selected for processing (8)
🚧 Files skipped from review as they are similar to previous changes (6)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review. 📝 WalkthroughWalkthroughThe native file picker now supports selecting multiple files through the shell API. The chat composer forwards the selected paths. External attachment batches above 256 paths are rejected with a localized notice. Tests cover multi-selection, cancellation, over-limit batches, and remote-runtime notice precedence. The source-control localization test now checks locale-specific descriptions. Priority: ➖ Normal Merge Risk: ⚪ Minimal · up to The multi-file attachment change is mergeable after normal checks; no specific unresolved issue is established. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to Multiple selections use the existing attachment checks, preserve the single-file picker, and are limited to 256 files per batch. No introduced security flaw was identified. Cleanup of remote uploads abandoned before attachment remains an uncertainty. Retained concerns Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
Resilience and Maintainability Implications
Hardening Proposals
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
Full details: Out of Scope Changes checkExplanation The change to Full details: Docstring CoverageExplanation Docstring coverage is 10.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 10 functions across 12 files. (6 skipped: 6 unsupported.) 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. Comment |
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes — reviewed the multi-select attachment picker end to end: the new main-process IPC handler, the preload/web bridges, the composer wiring, the 256-file batch guard, its tests, and the six locale catalogs.
- New
shell:pickAttachmentsIPC — adds a second native dialog withopenFile+multiSelectionsthat returns every picked path (or[]on cancel). The single-selectshell:pickAttachmentis retained for the notebook interpreter picker and the legacy composer handler. - Composer wiring —
useNativeChatFileAttachmentActionsnow forwards the full array to the existingattachExternalPaths, so picked files reuse the drop path's authorization, SSH upload, and owner-change checks; an empty array is a silent no-op, so Cancel does nothing. - Batch limit — a selection over
NATIVE_FILE_DROP_MAX_PATHS(256) is refused as a whole with the composer notice, ordered after the remote-runtime check so a remote chat reports the local-attachment block first. - Tests + i18n — adds a main-process multiselect test and hook tests for the 257-path rejection and runtime-before-limit ordering, plus the
tooManyAttachmentsstring in all six catalogs.
Verification: both changed test files pass (58 passed / 1 skipped), oxlint reports 0 warnings/errors on the changed sources, and verify:localization-catalogs passes with the new key resolving at the same components.native-chat.composer.tooManyAttachments path in every catalog.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes — reviewed the two commits since the prior pullfrog review at 94f3a93 (#pullrequestreview-5360198059): the composer action rename, the handler comment, and the new test coverage.
- Renamed the hook's returned action
pickAttachment→pickAttachmentsand updated its single caller, so the name now matches the multi-file result it forwards. - Documented why the plural
shell:pickAttachmentshandler sits beside the singular one (the notebook interpreter picker keeps single-select). - Added
use-native-chat-file-attachment-actions.test.tsx: the picker forwards every picked path (this fails if the one-liner is reverted topaths[0]), Cancel attaches nothing, and a drop aimed at another pane is ignored. Also added the missing canceled-return case for theshell:pickAttachmentshandler.
Verification: pnpm test on use-native-chat-file-attachment-actions.test.tsx + shell.test.ts — 46 passed, 1 skipped.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
4da1a0c to
0e073b3
Compare
|
Thanks, Kelvin. This does what #23905 asks. The paperclip now opens a multi-select dialog, and every picked file goes through the same path a drop does: images become chips, other files become Thanks for rebasing onto main. CI is green, so this is good to go from my side. Small follow-ups, not for this PR: the comment above |
25b2561 to
4e9942b
Compare
Picks over 256 files are rejected whole, matching the drop limit. Fixes stablyai#23905
…attaches The hook still returned `pickAttachment` after it started attaching a whole selection. Also records why the plural IPC handler sits next to the singular one, matching its siblings in the same file.
The one line that makes the feature work — the composer handing the whole picker result to attachExternalPaths — had no test; reverting it to paths[0] kept every existing test green. Adds a hook test for the multi-path, canceled, and wrong-pane cases, plus the missing canceled case for the shell:pickAttachments handler.
Keep latest main's missing-label fixture and restore its translation namespace after cleanup, so later tests still load real catalogs. Independently assert the shipped Spanish resource and rendered supported-agents label.
1091dd9 to
2ad0908
Compare
nwparker
left a comment
There was a problem hiding this comment.
Multi-picker retains singular callers, uses existing attachment owner/SSH upload guards and caps batches before filesystem/upload work. Rebase preserves current scoped stat access. 62 tests pass/one conditional skip, plus web typecheck and quality gates.
Current-main translation test drift repaired without changing production catalogs; the translation-sensitive audit passes 856 tests across 95 suites, including real Spanish label and deliberately missing-locale fallback coverage.
Rebased again onto main e46fa0d. Removed duplicate upstream localization repair, retained explicit missing-locale fallback and real Spanish rendering proof. Test cleanup restores the translation namespace after removing its synthetic locale so lazy loading remains independent.
Code review and local regression validation are complete on this exact commit: 2ad0908. Fresh GitHub Actions static analysis is currently QUEUED waiting for ubuntu-24.04-arm runners. CI has been triggered but has not completed on this rebased commit. This approval records the code review; pending required checks must still finish before merge. No PR merge performed.
|
The native chat paperclip selected one file per dialog, so attaching several files required repeated openings. This change passes every selected path through the existing attachment handling. Images keep individual previews and removal, other files keep editable prompt references, cancellation adds nothing, and SSH workspaces use the existing upload route. Selections above 256 files are rejected before file checks or uploads. Independent functional, architecture and release-readiness review found no proven PR-caused or review-loop P0–P3 issue. The contributor’s implementation was retained; main integration preserved draft, dictation and locale changes. Existing dialog ownership timing and drop-oriented error wording remain deferred baseline concerns. A fresh comparison with current main found that the requested picker change has not already landed and that the branch can merge without conflicts; no additional source changes were justified. Reviewed head: Required final-head UI and SSH acceptance is still incomplete. Earlier M4Air UI testing at superseded head In round 2, a freshly fetched main renderer responded through its debugging connection, and an exact-head app also rendered, but no final-head picker acceptance sequence completed. The last authorized, capped attempt rebuilt the exact head and then failed before Electron started because its isolated launcher could not find Node. This is a QA setup failure, not an established PR defect. No SSH target was created in this continuation and no real final-head upload or remote file-hash comparison ran. Earlier launch hangs remain unclassified. The actual native OS chooser, Windows/WSL chooser, folder-only workspace UI, mobile/older-client behavior, live agent send, network interruption and production-packaged SSH were not verified. Packaging success and skipped CI lanes do not establish those flows. The source review is complete, but the required QA gate remains blocked; the PR was not merged. Original screenshots below: the picker image is from superseded head
|
…er's attachments Main's multi-file picker (#23956) and this branch together took NativeChatComposer over the 400-line limit; reading the two pending-image handlers the way the neighbouring ones already are keeps it at the limit.
…er (#25146) * feat(native-chat): a paired server keeps a store for chat attachments A structured chat on a paired Orca server had nowhere to put a file the client attached. The server now keeps a per-chat attachment store under its userData, filled through agentSessionAttachment.uploadStart/Append/Commit/Abort and read back for previews through agentSessionAttachment.read, behind the structured session gate and advertised as agent-session.attachments.v1. Nothing records cleanup as owed: a sweep re-derives what may go from the host's chat records and journal (unfinished uploads after an hour, uploads for a chat that never existed or that its journal never mentions after a day). The clipboard RPC's in-flight bookkeeping moves into a shared ChunkedUploadRegistry both use. * feat(native-chat): upload attached files into a paired server's chat store Main streams dropped or picked files (fs:uploadPathsToAgentSessionAttachments) and pasted images (clipboard:saveImageAsTempFile with agentSessionAttachment) into the chat's store on its paired server, reusing the file-import slice streamer and pinning every call to the pairing revision and server process. The browser client's paste takes the same route. * feat(native-chat): attach files to a structured chat on a paired server Pasted images, files dropped from Finder/Explorer and the file picker no longer refuse with "Local attachments are not available for remote sessions." in a structured chat on a paired server: they upload into that server's chat store and the chat gets only the stored path. Dropped files show as pending chips at once so Send waits for them; every attached item carries the server, pairing and chat it was stored for, and a send to anywhere else drops it with the existing "changed hosts" notice. Chips and transcript images read stored files back through the server, never from this machine's disk. An older server gets an update notice instead of an upload. The terminal-backed chat keeps refusing. * test(native-chat): type the attachment test doubles without bare casts * refactor(native-chat): keep the clipboard RPC on its own upload bookkeeping The chunked upload registry stays for the chat attachment store only, beside it. * feat(native-chat): claim chat attachments when the host admits a message A message's references into the host's attachment store are claimed in the same journal transaction that makes it durable (a direct send, a queued draft, a /clear carry). The sweep deletes an upload only after marking it in that database while no claim exists, so a send and a sweep can never both win: a client's send that names an expired or foreign upload is refused whole with the new attachmentExpired reason, before anything is recorded. This replaces scanning chat transcripts for paths. The store is now <root>/<upload id>/<name>, refuses uploads for chats the host does not hold, caps stored names in UTF-8 bytes and avoids Windows device names. The preview read goes through the protected bounded read and the request's reply budget, so an image too large for one reply is refused instead of closing the connection. * feat(native-chat): let structured Claude read the host's chat attachment store Attached non-image files live outside the workspace; the store root is passed as an added directory so the agent reads them without asking, the common pattern. * fix(native-chat): skip a dropped folder before staging walks into it * fix(native-chat): pin the browser client's chat paste to its server Every upload call goes to the environment the paste was meant for and checks its pairing and server process, as the desktop upload does; a re-pair ends the upload instead of storing the image on another server. * refactor(native-chat): let the host's claim be the only attachment check The composer no longer records which server and pairing each attachment came from, and Send no longer strips attachments it judges foreign: the host refuses an expired or unknown stored path when it admits the message, which also covers retries, Stop-restores and queued edits the client check missed. Previews of stored files route through the chat's own server by path. Removing a file's chip while it uploads now keeps its @path out of the draft. A dropped or picked file shows its name and kind on its chip while it uploads, with no separate progress toast, and files that did not attach are named in one notice. A rich-text paste into a chat on an older server no longer shows the update notice beside the pasted text. * chore(native-chat): keep the claim hook beside the draft consume and fit the line budgets The submission's claim runs in the same append hook as a draft's consume, owned by the queued-message collaborator, so the journal store stays within its size limit. Formats the new files and regenerates the runtime-required English catalog. * test(native-chat): pin the attachment store grant in the Claude launch, restore upload result types * fix(native-chat): create the attachment store at install and claim only exact store paths Claude drops an added directory that does not exist when it starts, so the store root is created when the host installs it, best effort. A commit keeps its upload in flight until the rename lands, so a sweep never takes a slow upload's part file. Only a path under this host's exact store root is claimed and required; any other mention of a store path is plain text and never refuses the message. * refactor(native-chat): reuse the newer-Orca notice and drop leftover attach options An older server's refusal to store attachments uses the notice every other write it refuses already shows, so one string fewer in every catalog; the attach callbacks lose an options parameter no caller passes since the provenance check went. * fix(native-chat): give a message refused for an expired attachment back to the composer Sending the same message again can never bring the attachment back, so instead of a Retry that always fails the message's text and images return to the composer, as a Stop's withdrawn message does, and the notice says what to remove. * fix(native-chat): keep uploads across a prompt, say why a file did not attach An upload that finishes while a prompt card has replaced the composer lands in the scope's attachment and draft caches, which the composer reads back when it returns, instead of the unmounted composer. The single failure notice names the cause the files share, such as the size limit. Rich text pasted into a chat on an older server no longer flashes an image chip: the chip waits for the server to take the image. A picked command waits, as Send does, while an attachment is still uploading. * fix(native-chat): keep a paste's upload across a prompt; pin the Claude grant hand-off A paste uploading into a paired server's store keeps its chip live when a prompt card unmounts the composer, and its result is filed for the composer's return, as a drop's is. A failure cause ending in full-width punctuation gets no extra full stop. A runtime test pins that the store root reaches Claude's launch resolver through the adapter. * test(native-chat): type the grant hand-off captures without casts * test(native-chat): pin that the composer files a paste's upload across a prompt * fix(native-chat): retry a held rename at commit and keep cut names Windows-safe A commit renames the part file with the Windows retry the app uses elsewhere, so an antivirus or indexer holding it briefly no longer loses the upload. A name cut to the byte limit is stripped of trailing dots and spaces again. The upload pump's result cast states why it holds. * fix(native-chat): keep attachments still on their way in the pane's attachment cache A prompt card unmounts the composer, and an attachment still saving or uploading lived only in that composer: one that came back showed no pending chip, so Send went out without the file and the file then landed in the next draft. Pending chips now live in the pane's attachment cache beside settled ones and settle there whichever composer is showing, so Send waits for them after a remount too. A stored file's @path goes into the pane's draft cache, which keeps it through an input-method composition and a remount. A rich-text paste's image is registered as a hidden pending chip before the server is asked, so Send waits for it from the start, and it shows only once the server takes it. * test(native-chat): a dropped file still uploading stays pending across a remount * fix(native-chat): reveal a rich-text image in a composer that came back; keep caret inserts A rich-text paste's held image is revealed through the pane's attachment cache, so a composer a prompt card remounted during the server's answer shows it rather than holding Send on an invisible chip. A stored file's @path goes in at the caret while the composer is showing and not composing, as every other attach does; only mid-composition or after a remount does it go to the pane's draft. * fix(native-chat): never evict a pane's attachments while a composer shows them or one is on its way The pane attachment cache is now where chips live, so its 128-scope bound passes over a scope a mounted composer subscribes to or that still holds a pending attachment, and evicts the oldest scope nobody uses instead. Protected scopes are bounded by mounted composers and attachments in flight. * fix(native-chat): never evict the scope just written when every older one is in use * fix(native-chat): keep the attachment store out of the RPC method table's imports The method table is imported far and wide (the SSH relay's CLI included), and the attachment RPCs pulled in the store, whose preview read loads modules that read fs constants at load: any test that mocks fs/promises without them failed to import. The installed store now lives in a small registry module; only the host wiring loads the store itself. * refactor(native-chat): the submission hook gets its own module Merging main added the operation receipt to the queued-message insert, which put journal-queued-messages.ts over the 300-line limit. The submission hook only uses the queued-messages object's public methods, so it moves out. * refactor(native-chat): fit the attachment sweep and paste upload into main's line budgets After merging main, the record store and the clipboard handlers each ran a few lines over the 300-line budget. The sweep now asks the record store whether a chat is recorded through the two lookups it already has (readable or unreadable) instead of a new id-listing method, and the paired-server paste upload lives beside the other attachment uploads. No behavior changes. * fix(native-chat): pending chips sit beside main's saved draft, which keeps server-stored images Main now saves a composer's draft (text and settled images) in one store that survives a reload or quit. This branch kept every chip, settled or not, in its own pane cache. After the merge the saved draft owns settled images and the pane cache holds only chips still on their way: they come back pending in a composer a prompt card remounted, hold Send, settle into the saved draft whichever composer is showing, and are never saved themselves, so a restored draft cannot bring back an upload as if it were attached. An image a paired server stored for the chat is saved with the draft as the real image (a pasted one is no longer turned into a "Not kept" placeholder), and the restore check leaves it to that server, whose claim at Send refuses one it no longer holds, instead of asking this machine's disk for a path that only exists on the server. Also: previews and the pending subscription move into their own small hooks to fit the line budget, the "local attachments" notice moves to the composer-target module so the attachments hook no longer pulls in the upload module's imports, and tests follow main's new mocks. * test(native-chat): give the claims test main's provider handle and message source * fix(native-chat): a paste still uploading dies with its tab or workspace A pasted image still uploading to a paired server sits in the pending chip cache, which by design outlives the composer and its tab. Removing the workspace deleted its saved drafts but left those chips, so the upload finishing afterwards recreated and saved the deleted draft. With the workspace's tabs gone it had no owner either, so no later workspace cleanup could ever remove it. A pending chip now records the owner its draft would have, resolved the way the draft store resolves one when the chip is added. Workspace removal and a user's tab close drop pending chips by the same owner, conversation and tab matches they delete drafts by, and a chip that settles after its chat's tab closed writes its draft under the owner it was begun in. * fix(native-chat): the claim type uses the journal's own SQLite type * refactor(native-chat): read the pending-image handlers off the composer's attachments Main's multi-file picker (#23956) and this branch together took NativeChatComposer over the 400-line limit; reading the two pending-image handlers the way the neighbouring ones already are keeps it at the limit. * test(native-chat): pass the launch-args resolver main now requires in the attachment grant test * fix(native-chat): grant the attachment store beside folders the saved Claude Arguments add Main (#25721) now builds additionalDirectories from the user's --add-dir arguments; this branch's attachment-store grant replaced that list instead of adding to it. Both are granted now. Moves the Claude session-id derivation to its own module to keep the resolver under the line limit. * test(native-chat): run the attachment store's SQLite tests in the Node runtime project * test(native-chat): follow main's attach ownership recheck (#25749) in the attachment tests * test(native-chat): a named upload chip still shows when the agent takes no images * fix(native-chat): a paired-server image paste failure keeps its error apart, as main's notice card does * fix(native-chat): the attachment sweep reads the chat list directly now that records have no import still owed



ELI5
In chat view, the paperclip used to let you pick only one file at a time. Now you can pick several at once in the same file dialog, and they all attach.
What Changed
How it works:
pickAttachments, since it no longer stops at one file.Why
Linked Issue
Fixes #23905
Visual Proof
After:
https://github.com/user-attachments/assets/408b44c8-0a62-4de9-becf-bd57a3489097
Testing
Not verified: the Windows and Linux dialogs (Electron's multi-select option exists on both), SSH in the running app (covered by the shared attach path's existing tests), and hitting the 256 limit in the running app (covered by the test).
Notes
Agent skill upstream boundary
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)