Repository navigation
A screenshot dragged into a chat lives as long as the chat - #30419
Conversation
A chat's scratch folder was deleted once the chat had gone 30 days unused, so an old chat's inline visuals turned into "Visualization unavailable" while the chat and its history stayed. The common pattern keeps a chat's files for as long as the chat and never deletes them on an "unused for N days" timer. The sweep now removes only folders no chat record maps to, plus leftover .expired folders older builds parked. Everything that existed only to make the age rule safe goes with it: the per-folder save lock and its expiry candidates, the session-lane idle check, the journal last-activity query, and the migration's fresh-window timestamp. The visuals skill no longer tells agents the folder is temporary.
…chat A local chat's pasted images lived in one paste folder that deleted every file older than 30 days, sent or not, so an old chat's images turned into label chips. Paired-server chats already keep pastes in the host's attachment store, where the send that names a file claims it for its chat and only unclaimed files are ever swept: the common pattern. A local composer paste now goes into this machine's own attachment store (starting the local chat host first), so its send claims it the same way. The old paste folder is no longer written or swept: messages sent before this change may name its files. Restored drafts still read it. An unclaimed upload now waits 30 days instead of one before the sweep takes it. A draft names its image by this path, so the window is how long an unsent draft keeps its image; 30 days is what local drafts had, and it outlasts the host's send-id window so a resent draft still finds its image. A chat folder an older build set aside as unused (<hash>.expired) goes back to its chat instead of being deleted.
A terminal-backed chat has no journal, so no send claims its pastes and nothing can tell a sent one from an abandoned one. Its pastes therefore stay in the paste folder, which is no longer swept, rather than in the attachment store, whose sweep would take them after 30 days unclaimed. Only a local structured chat's paste (forStructuredChat) goes to the store, where its send claims it.
…he chat On macOS a screenshot dragged from its thumbnail is copied into $TMPDIR/orca-drops, and that copy was deleted 7 days after the drop, so a sent dropped screenshot turned into a label chip after a week. The common pattern keeps a file sent in a chat as long as the chat. A local structured chat's composer now moves each such copy into this machine's chat attachment store, where the send that names it claims it for the chat. Every other copy (terminal panes, terminal-backed chats, editors, startup prompts) has no owner Orca can tell, so copies are no longer swept at all. The copy budget now bounds one drop instead of every copy still on disk: without a sweep, counting earlier copies would refuse every later drop.
…h-chat' into brennanb2025/chat-drops-live-with-chat
|
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
📝 Walkthrough
Priority: ➖ Normal Merge Risk: 🔵 Low · up to
|
There was a problem hiding this comment.
Actionable comments posted: 2
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
4735f8aa-b178-48cf-a049-8755265f03c0
📒 Files selected for processing: 14
src/main/ipc/register-core-handlers/register-core-handlers.test.tssrc/main/ipc/register-core-handlers/register-core-handlers.tssrc/main/window/dragged-temp-file-copy.test.tssrc/main/window/dragged-temp-file-copy.tssrc/main/window/dropped-path-preparation-ipc.test.tssrc/main/window/dropped-path-preparation-ipc.tssrc/main/window/native-chat-drop-copy-keep.test.tssrc/main/window/native-chat-drop-copy-keep.tssrc/preload/api/filesystem-api.tssrc/preload/api/fs-bridge.tssrc/renderer/src/components/native-chat/native-chat-drop-copy-store.tssrc/renderer/src/components/native-chat/use-native-chat-external-attachments.tssrc/renderer/src/web/preload-api/web-filesystem-api.tssrc/shared/native-file-drop.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 2 remain after this review.
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
45440c76-76ab-4067-b068-6298b48b977e
📒 Files selected for processing: 13
src/main/window/attach-main-window-services.tssrc/main/window/dragged-temp-file-copy.tssrc/main/window/dropped-path-preparation-ipc.test.tssrc/main/window/dropped-path-preparation-ipc.tssrc/main/window/dropped-path-preparation.test.tssrc/main/window/dropped-path-preparation.tssrc/renderer/src/components/native-chat/NativeChatPaneFileDropSurface.tsxsrc/renderer/src/components/native-chat/native-chat-pane-file-drop.tssrc/renderer/src/components/native-chat/use-native-chat-external-attachments.test.tsxsrc/renderer/src/components/native-chat/use-native-chat-external-attachments.tssrc/renderer/src/hooks/use-os-file-drop-owner.test.tsxsrc/renderer/src/hooks/use-os-file-drop-owner.tssrc/shared/native-file-drop-preparation.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.
…ps-live-with-chat
…ps-live-with-chat
…ps-live-with-chat
|
A screenshot dragged from the macOS thumbnail became a grey filename in a sent chat after seven days: Orca's temporary-copy sweep deleted the file without knowing that the chat still used it. Removing expiry alone also left a retained-copy quota that would eventually refuse new drops. Fresh copies dropped into a local structured chat now enter its existing attachment store before they are published to the composer or queued-message editor. Sending claims them for the chat. Unsent files retain the existing 30-day collection policy. Other drag copies lose Orca's global expiry and retained-copy quota; per-file and per-drop limits remain. This does not make terminal or remote copies permanent: operating-system temporary-file cleanup can still remove them. The full review completed six design rounds, architecture adjudication, readiness review and narrow final integration checks on Verified:
Accepted and deferred:
For Brennan's review Normal composer, after aging and restart — main loses the image; this PR keeps it: Queued editor with the dropped image, then the aged sent result on main and this PR: Real reply and expired unsent-draft feedback: The three judgment points are capture and store before publishing attachment chips, same-volume commit and accepted cross-volume transfer cost, and the captured destination used by queued edits. |







ELI5
On macOS, dragging a screenshot thumbnail makes a copy that an agent can read. Orca used to delete that copy after seven days, even after it was sent in a chat, leaving a label where the image had been. A fresh drop into a local structured chat now uses the same attachment storage as pasted images, so a successful send keeps it with the chat. Orca also stops expiring copies used by terminals and other consumers.
This builds on #30413, which is merged.
What Changed
The drop captures its destination before preparation starts. A local structured chat captures the complete batch before waiting for its attachment store. Batches that fit within 50 MiB of captured bytes go directly into the existing store. Larger batches spill to private temporary files; eligible files move into the store by rename on the same volume, or by a bounded, checked stream between volumes. If storage fails, the captured bytes or readable temporary snapshot remain available as fallback, without rereading the screenshot provider.
Only files created by this operation can move. Sending an image or ordinary file reference claims its stored file through the existing message transaction, for every agent. Unsent stored files remain eligible for the existing 30-day cleanup.
Files selected from Finder, the picker, copied-file paste, or an older drop stay in place. Reattaching an existing copy never removes the path another chat or terminal still uses. Store unavailability, a failed write, or a file above the store's 50 MiB limit keeps the readable temporary copy as fallback.
The seven-day copy sweep and the quota counting all earlier copies are removed. The existing 2 GiB per-file and 8 GiB per-drop copy limits, request queue and operation deadline remain. Preparation still happens before attachment chips appear; this PR adds no progress notice or new Send hold during that interval.
Why
The common pattern ties attachment retention to ownership. Orca reuses its existing host store and send claims, while tracking exactly which unpublished snapshots this operation created. This avoids deleting a published path another chat or terminal still uses. Capturing bytes before store initialization also preserves the same screenshot when the provider changes or disappears.
Intended differences from the common pattern: terminal, legacy and other copies with unknown owners have no Orca expiry or aggregate quota. They can accumulate; operating-system cleanup may still affect temporary storage. This PR does not promise permanent storage for those paths. The existing host store and path-based drafts remain necessary for Orca's local and paired-host ownership model.
Linked Issue
N/A — maintainer change in the existing chat-files-live-with-chat lane.
Visual Proof
Real Electron QA on macOS on this PR's final head
4d038a7against mainfb21729, with a real Codex agent. A screenshot was dragged into a chat and sent, the files were aged (8 days on main, 31 days on this PR), and the app was restarted.Main: the sent screenshot is gone after a week (grey file name instead of the image)
This PR: the same screenshot still shows after 31 days and a restart
This PR: drag, send and a real reply
This PR: a screenshot dragged into a draft and never sent is cleaned up after 30 days; the draft says so and Send is disabled
This PR: a screenshot dropped onto a queued message's editor, then sent
Queued message image after aging and restart: main (8 days) loses it, this PR (31 days) keeps it
Timing, drop to image chip, medians (main / this PR, previous head with the same intake code): same disk, 3 MB 14 / 9 ms, 30 MB 64 / 21 ms, batch under 50 MiB 79 / 61 ms, batch over 50 MiB 268 / 169 ms; Orca's temp folder on a different disk from its data folder, 3 MB 12 / 12 ms, 30 MB 45 / 31 ms, batch under 50 MiB 48 / 41 ms, batch over 50 MiB 134 / 241 ms (16 alternating trials each). That last case is slower and was accepted by Brennan for this PR; the follow-up is tracked in STA-11413.
Testing
Full review path: saved attachments, file deletion, asynchronous ownership and desktop IPC exclude the light path.
Focused tests cover fresh-copy handoff, duplicate paths, retained existing files and siblings, fallback, timeout cleanup, queue progress, late completion, captured destinations and owner-change feedback.
The intake rebuild passed eight named files with 130 tests; the two most affected files then passed 47 tests. The abandonment fixture now controls only its deadline clock after real capture/import starts, removing its dependency on completing 50 MiB of filesystem work within 100 ms. All 22 named preparation tests pass. The queued-editor regression fails on the old local consumer selection and passes after the one-line correction; all 17 tests in that file pass.
The test-fixture head
ebabe7e9160a0dd08cab11bf37f1ee653fa0f247passed the full PR workflow, including its aggregate gate, and the WSL workflow. Final head4d038a705d6bc877eb1baedca325d7e06eda847apasses the full PR workflow, aggregate gate and WSL workflow. One unchanged Windows installer process-probe timeout passed on the single failed-job retry; no code or timeout was changed for that failure.macOS Electron QA on
56897881f01576fe177e820cb50397dfc1e8fae2, with real Codex replies, verified retention through aging/restart/reload, expired-draft feedback, paste, ordinary files, post-chip removal, tab-switch isolation and shared-copy retention through restart. Send during preparation retains the known text-before-image behavior on both revisions. Actual quiet-disable/unmount during preparation was not exercised; tab switching left the old composer mounted and editable on both revisions.Accepted difference, approved by Brennan on 2026-10-20 and tracked in STA-11413: a single drop whose eligible images total more than 50 MiB reaches its first attachment chip more slowly when Orca’s temporary folder and chat storage are on different volumes. The bounded repeat on
56897881retained all 32 samples: main median 133.90 ms, PR 241.05 ms. Ranges overlap under shared-machine load; the extra observed interval is largely between capture and store publication. The other seven measured cases favored the PR. This cost remains in this PR because cross-volume publication copies the captured bytes again; it is accepted rather than fixed.The main-sync review found that queued-message edits ignored the captured local chat destination when preparing OS drops. This is corrected at
66b73ac171e2a31974b03dc86bfe29994e9c4dd0using the same selector as the normal composer. Narrow source verification, exact-final-head CI and real macOS QA are complete on4d038a705d6bc877eb1baedca325d7e06eda847a. QA 888 verified normal composer drops through real Codex send/reply, aging, restart, fresh reload and expired unsent-draft feedback. QA 927 verified queued-editor OS drop, Save, automatic send and real reply, followed by aging/restart/reload with unchanged image hash and claim. Both compared main with this exact head. The queued card came from the test runtime’s existing orchestration dispatch route: these builds support editing queued messages and their images but do not advertise mid-turn queueing.I manually tested these changes locally
Automated tests added/updated
Review
Six design review rounds included architecture adjudication, a fresh full review after the intake rebuild, performance experiments and a blocked verdict on the cross-volume batch cost. Narrow final-main-sync review also corrected queued-drop routing and verified both test-fixture changes on the final head. After the round-6 blocked verdict, Brennan accepted only the cross-volume batch cost described above. Final sync work also corrected queued-message OS-drop routing to the same local chat store as the composer. The timing-sensitive fixture is corrected, with no production timeout change; no further byte-intake redesign is underway. The source-level native-copy feasibility check failed: available copy APIs reopen pathnames and cannot use the checked source descriptor or recorded byte window. No timing experiment or replacement was qualified. The cross-volume cost remains accepted and tracked in STA-11413. Review corrected shared-source deletion, duplicate-path and symlink-root variants, owner-change feedback, and unconditional extra copying. Cross-volume spill still reads and writes the content twice; source review does not establish acceptable latency.
Deferred existing behavior: workspace-tree drops into queued edits cannot route while a question or approval replaces the normal composer (tracked in STA-11414); expired nonimage drafts lack proactive missing-file feedback; Send during preparation can send text before the image arrives; and a partially unreadable drop can silently omit one file. Earlier QA also saw a grey first image on both main and branch in a large batch, with files and claims intact; its cause remains unverified. Missing dropped images keep their existing “Attach again” feedback.
Agent skill upstream boundary
Notes
Fresh thumbnail copying is macOS-only; Windows and Linux retain path pass-through. Paired structured chats retain their existing upload route. SSH terminal-backed native chats retain their existing client-local attachment refusal; terminal drops keep their existing remote resolver. No mobile protocol, saved schema or remote capability changes are introduced.
Author: @BrennanKB5