Skip to content

feat(native-chat): attach several files from one picker selection - #23956

Merged
brennanb2025 merged 9 commits into
stablyai:mainfrom
AmoabaKelvin:fix/pick-several-files-in-chat-composer
Oct 6, 2026
Merged

brennanb2025 merged 9 commits into
stablyai:mainfrom
AmoabaKelvin:fix/pick-several-files-in-chat-composer

Conversation

@AmoabaKelvin

@AmoabaKelvin AmoabaKelvin commented Sep 30, 2026 •

Copy link
Copy Markdown
Collaborator
Files Added Deleted Net
Test 3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​182 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​182
Prod 14 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​47 $\color{#cf222e}{\Huge{\mathbf{−}}}$​15 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​32

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

  • Before: you clicked the paperclip, picked one file, and repeated for every extra file.
  • After: you click the paperclip, Cmd-click or Shift-click several files (Ctrl-click on Windows and Linux), and click Open. They all attach, with the same previews, removal and SSH upload as before. Cancel does nothing.

How it works:

  • The paperclip now opens a native file dialog with multi-select switched on, and gets back every path you picked. It used to open a single-file dialog and keep only the first path.
  • The picked paths go into the same attach function the chat composer already uses for dragged-in files. So each file is still checked, uploaded to SSH worktrees, and refused if the workspace changes host mid-attach, exactly as for a multi-file drop.
  • A selection of more than 256 files is refused as a whole, with "Attach 256 or fewer files at a time." on the composer's notice line.
  • The composer's paperclip action is renamed to pickAttachments, since it no longer stops at one file.

Why

  • A new multi-select dialog next to the single-file one. The notebook's "choose a Python interpreter" picker must stay single-select. One dialog with a flag would return one path or a list depending on who called it. This follows the existing "pick a folder" / "pick folders" pair.
  • A 256-file limit, matching drops. A drop of more than 256 files is already refused. Without the same limit, Cmd+A in a folder of thousands of files would start one file check after another, or thousands of SSH uploads, with no way to cancel, and nothing further down counts. The number is the drop limit reused as a sensible batch size.
  • Refuse the whole selection rather than attach the first 256. The dialog doesn't return files in a meaningful order, so "the first 256" would be an arbitrary subset. Refusing everything also matches how drops and the waiting-attachments limit behave.
  • The message goes on the composer's notice line, not a toast. Every other chat-attach problem, such as an unreadable file, a workspace that changed host, or a remote session, is reported there. Drops use a toast only because they're refused before Orca knows which composer they were aimed at.
  • The limit is checked where picks and drops meet, after the "can this chat take local files" check. One check covers both sources. Drops over 256 are already stopped earlier, so in practice it only fires for the picker. Someone picking 300 files in a remote-runtime chat is told first that local files can't be attached there, because trimming to 256 wouldn't help.
  • The new message is translated into all six languages, worded like each language's existing drop-limit message.
  • Web and mobile are unchanged. The web client's picker still returns nothing, as it did before, and mobile has its own picker.

Linked Issue

Fixes #23905

Visual Proof

After:
https://github.com/user-attachments/assets/408b44c8-0a62-4de9-becf-bd57a3489097

Testing

  • I manually tested these changes locally: macOS, picking several PNG and JPEG files in chat view, removing one, and Cancel.
  • Automated tests added:
    • The dialog opens with multi-select and returns every path, and returns nothing on Cancel. This fails on main.
    • The paperclip hands the whole selection to the composer's attach function, and a canceled picker attaches nothing. This is the line the feature rests on, so it has its own test: restoring the old "keep the first path" behaviour fails it.
    • A drop aimed at a different chat pane is still ignored, so the shared handler was not widened by accident.
    • 257 picked files are refused with the notice, and nothing is checked or attached.
    • A remote-runtime chat reports "local attachments aren't available" before the limit.

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

  • Follow-ups, not in this PR:
    • The new-workspace composer has an attach handler that nothing on screen calls (unused since Simplify new workspace quick-create and wire Use button to direct launch #913). Removing it is a separate cleanup.
    • Two older messages, "Couldn't read the dropped files." and "…drop the files again.", can also appear after a picker selection. That was already true for a single pick, so rewording them is also a separate change.

Agent skill upstream boundary

  • Not applicable — this change touches the chat composer's file picker and copies no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

@greptile-apps

greptile-apps Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 5/5

[Medium risk] Allows picking multiple files instead of one in the chat attachment flow.

The PR appears safe to merge; no outstanding or newly established issue was identified.

Summary

The PR adds a multi-select native file dialog for chat attachments and sends every selected path through the existing attachment flow.

  • It leaves the single-file picker available for callers that require one path.
  • It rejects selections over 256 files with a localized composer notice.

Reviews (3) · Last reviewed commit: "test(native-chat): cover the paperclip f..."

@coderabbitai

coderabbitai Bot commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Note

Reviews paused

It 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 reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 0bbfc30c-031a-4ae2-8191-0a7c6f198c2d
📥 Commits

Reviewing files that changed from the base of the PR and between 25b2561df8f16569bf7e0d79a99c085e6d66912d and 9023fa8071c5badd52c84db977e7d576088eb240.

📒 Files selected for processing (8)
  • src/renderer/src/components/native-chat/use-native-chat-file-attachment-actions.test.tsx
  • src/renderer/src/components/right-sidebar/source-control-discard-localization.test.ts
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/i18n/locales/es.json
  • src/renderer/src/i18n/locales/fr.json
  • src/renderer/src/i18n/locales/ja.json
  • src/renderer/src/i18n/locales/ko.json
  • src/renderer/src/i18n/locales/zh.json
🚧 Files skipped from review as they are similar to previous changes (6)
  • src/renderer/src/i18n/locales/ja.json
  • src/renderer/src/i18n/locales/es.json
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/i18n/locales/zh.json
  • src/renderer/src/i18n/locales/ko.json
  • src/renderer/src/i18n/locales/fr.json

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The 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 9023f

The multi-file attachment change is mergeable after normal checks; no specific unresolved issue is established.

Security Architecture Review

Security architecture risk: 🔵 Low · up to 9023f

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
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The added picker route increases per-dialog selection to at most 256 processed paths. Its sensitive outcome is transfer of selected client-local files to the captured SSH worktree's staging directory, using the existing connection authority. It does not introduce a new upload destination mechanism.

Trust Boundaries and Controls

  • observed — The plural picker accepts no caller-provided path argument and obtains paths from the native dialog. Drop events retain composer-target and exact pane-scope checks. SSH mutation requests carry target, generation and execution-host expectations that are checked at handler entry and before remote writes.

Resilience and Maintainability Implications

  • observed — Remote uploads are not rolled back as a batch when later attachment is refused. The importer closes its upload session in finally and attempts owner-checked cleanup of partially created directories, but completed independent files may remain staged. This behavior predates the PR's picker change and is shared with existing multi-file drops; it is not retained as an introduced security concern.

Hardening Proposals

  • proposed — Define the retention or cleanup policy for uploads abandoned after workspace changes, interruption or renderer closure. Any cleanup should remain bound to the original SSH owner and must not execute against a replacement connection.
🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning The change to source-control-discard-localization.test.ts updates expected discard descriptions for six locales. This source-control test change has no connection to the chat composer multi-select r… Remove the unrelated source-control localization test change from this pull request.
Docstring Coverage ⚠️ Warning 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:… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: selecting several files from one native chat picker.
Description check ✅ Passed The description covers the user-facing change, rationale, linked issue, implementation, testing, and checklist. The visual proof includes an after image but no before image; the rest of the descriptio…
Linked Issues check ✅ Passed The changes satisfy [#23905]. The composer picker enables multi-selection and forwards all selected paths to the existing attachment flow. That flow preserves per-file previews, removal, checks, and u…
Full details: Out of Scope Changes check

Explanation

The change to source-control-discard-localization.test.ts updates expected discard descriptions for six locales. This source-control test change has no connection to the chat composer multi-select request [#23905].

Full details: Docstring Coverage

Explanation

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@pullfrog pullfrog 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.

✅ 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:pickAttachments IPC — adds a second native dialog with openFile + multiSelections that returns every picked path (or [] on cancel). The single-select shell:pickAttachment is retained for the notebook interpreter picker and the legacy composer handler.
  • Composer wiring — useNativeChatFileAttachmentActions now forwards the full array to the existing attachExternalPaths, 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 tooManyAttachments string 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.

Pullfrog  | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@pullfrog pullfrog 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.

✅ 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 → pickAttachments and updated its single caller, so the name now matches the multi-file result it forwards.
  • Documented why the plural shell:pickAttachments handler 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 to paths[0]), Cancel attaches nothing, and a drop aimed at another pane is ignored. Also added the missing canceled-return case for the shell:pickAttachments handler.

Verification: pnpm test on use-native-chat-file-attachment-actions.test.tsx + shell.test.ts — 46 passed, 1 skipped.

Pullfrog  | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@AmoabaKelvin
AmoabaKelvin force-pushed the fix/pick-several-files-in-chat-composer branch from 4da1a0c to 0e073b3 Compare October 1, 2026 13:18
@brennanb2025

Copy link
Copy Markdown
Contributor

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 @ references, SSH workspaces upload first, and remote-server chats get the same "not available" notice. I checked it on a production build on macOS: before, picking four files attached only the first; after, all four attached (two references plus two image thumbnails). Cancel adds nothing, 257 files show "Attach 256 or fewer files at a time.", and exactly 256 attach in well under a second.

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 shell:pickAttachments says the notebook picker is the only remaining single-file caller, but the unused new-workspace attach handler also calls it (that handler is never rendered, so users can't hit it). The "drop the files again" / "Couldn't read the dropped files." notices still say "drop" after a picker selection, as they did for single picks.

@nwparker
nwparker force-pushed the fix/pick-several-files-in-chat-composer branch 2 times, most recently from 25b2561 to 4e9942b Compare October 5, 2026 06:09
AmoabaKelvin and others added 5 commits October 5, 2026 01:13
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.
@nwparker
nwparker force-pushed the fix/pick-several-files-in-chat-composer branch from 1091dd9 to 2ad0908 Compare October 5, 2026 08:21

@nwparker nwparker 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.

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.

@brennanb2025

Copy link
Copy Markdown
Contributor

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: ee12e2061fef38e255f112c07d125041d4f94e3c. All 122 targeted tests passed (one platform skip), changed-code quality passed, and renderer/main-process typechecks passed. All final CI checks completed: 12 passed, 16 skipped and two failed. The failing unit job expects one Explorer cache scan after main added a second bounded scan. The identical expected-2001/received-4002 assertion reproduces on both this head and merged main 54ded3bc185fb3fec7b3ad55cfa2ca9c0596cfd7; the other red check depends on it. CI remains red; this is a proven baseline failure, not a flake.

Required final-head UI and SSH acceptance is still incomplete. Earlier M4Air UI testing at superseded head 6a9bf92e03a37ea9e65a6992060a08ecad433cbb exercised mixed JPEG/Markdown/CSV selection, append/removal, cancellation, 256-file acceptance and 257-file rejection. Only the native dialog’s return value was replaced for those tests; paperclip clicks and attachment processing ran through production code. That evidence does not establish final-head acceptance.

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 6a9bf92e03a37ea9e65a6992060a08ecad433cbb; the main control is from 670c59d23a1d87f9ef3bd63b65f44673f16d28e2. Neither is final-head acceptance.

Earlier mixed-file selection Round 2 main control
Earlier mixed-file selection Round 2 main control

@brennanb2025
brennanb2025 merged commit 81a1968 into stablyai:main Oct 6, 2026
28 of 30 checks passed
brennanb2025 added a commit that referenced this pull request Oct 6, 2026
…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.
brennanb2025 added a commit that referenced this pull request Oct 7, 2026
…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
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.

[Feature]: Allow selecting multiple files when attaching to the Chat UI composer

3 participants