Skip to content

A screenshot dragged into a chat lives as long as the chat - #30419

Merged
brennanb2025 merged 22 commits into
mainfrom
brennanb2025/chat-drops-live-with-chat
Oct 21, 2026
Merged

brennanb2025 merged 22 commits into
mainfrom
brennanb2025/chat-drops-live-with-chat

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 6 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​280 $\color{#cf222e}{\Huge{\mathbf{−}}}$​82 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​198
Prod 11 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​316 $\color{#cf222e}{\Huge{\mathbf{−}}}$​145 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​171

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 4d038a7 against main fb21729, 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)

main-D-chat1.png

This PR: the same screenshot still shows after 31 days and a restart

pr-D-chat1.png

This PR: drag, send and a real reply

pr-A-transcript.png

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

pr-D-draft.png

This PR: a screenshot dropped onto a queued message's editor, then sent

pr-E-queued-editor.png

Queued message image after aging and restart: main (8 days) loses it, this PR (31 days) keeps it

main-E-after-aging-restart.png

pr-E-after-aging-restart.png

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 ebabe7e9160a0dd08cab11bf37f1ee653fa0f247 passed the full PR workflow, including its aggregate gate, and the WSL workflow. Final head 4d038a705d6bc877eb1baedca325d7e06eda847a passes 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 56897881 retained 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 66b73ac171e2a31974b03dc86bfe29994e9c4dd0 using the same selector as the normal composer. Narrow source verification, exact-final-head CI and real macOS QA are complete on 4d038a705d6bc877eb1baedca325d7e06eda847a. 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

  • Not applicable; no upstream skill-installer material is copied.

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

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
@brennanb2025
brennanb2025 changed the base branch from brennanb2025/chat-files-live-with-chat to main October 19, 2026 22:12
@coderabbitai

coderabbitai Bot commented Oct 19, 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: b3d32b83-6a54-4d9d-a258-1508d83f6a08
📥 Commits

Reviewing files that changed from the base of the PR and between 1d18e02 and 302ea86.

📒 Files selected for processing: 4
  • src/main/native-chat/agent-session-attachments/agent-session-attachment-store.ts
  • src/main/window/dragged-temp-file-copy.ts
  • src/main/window/dropped-path-preparation.test.ts
  • src/main/window/dropped-path-preparation.ts

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

📝 Walkthrough

Drop preparation now selects the local-chat consumer when applicable and can store eligible imported copies in the local chat attachment store. Repeated destination paths reuse the stored path. Successfully stored temporary copies are removed. Drag-temp copies now use per-batch buffering and cleanup instead of retained-copy measurement or expiry sweeps. Tests add filesystem-backed coverage for storage, fallback, commit, timeout, and cleanup paths.

Priority: ➖ Normal

Merge Risk: 🔵 Low · up to 302ea

Screenshots dropped into a local chat are now stored with the chat. Repeated paths in one drop correctly share the stored file. One minor issue remains: if a drop times out while the store write is still finishing, an unused copy can stay in the attachment store until the 30-day cleanup. This only costs disk space. The change is mergeable with owner awareness of that follow-up.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 17.65% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 34 functions across 24 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly summarizes the main user-facing change: newly copied screenshots remain available for the chat lifetime.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description check Passed The description is mostly complete and follows the template. It includes ELI5, What Changed, Why, a maintainer rationale for no linked issue, visual proof, detailed testing, review notes, the upstream…
Full details: Description check

Explanation

The description is mostly complete and follows the template. It includes ELI5, What Changed, Why, a maintainer rationale for no linked issue, visual proof, detailed testing, review notes, the upstream boundary, and platform notes. The repository Checklist section is not included, and the AI Disclosure section is omitted; the latter is allowed for internal maintainers.

✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

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

Actionable comments posted: 2


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 4735f8aa-b178-48cf-a049-8755265f03c0
📥 Commits

Reviewing files that changed from the base of the PR and between 3d0973d and 51a0f7b.

📒 Files selected for processing: 14
  • src/main/ipc/register-core-handlers/register-core-handlers.test.ts
  • src/main/ipc/register-core-handlers/register-core-handlers.ts
  • src/main/window/dragged-temp-file-copy.test.ts
  • src/main/window/dragged-temp-file-copy.ts
  • src/main/window/dropped-path-preparation-ipc.test.ts
  • src/main/window/dropped-path-preparation-ipc.ts
  • src/main/window/native-chat-drop-copy-keep.test.ts
  • src/main/window/native-chat-drop-copy-keep.ts
  • src/preload/api/filesystem-api.ts
  • src/preload/api/fs-bridge.ts
  • src/renderer/src/components/native-chat/native-chat-drop-copy-store.ts
  • src/renderer/src/components/native-chat/use-native-chat-external-attachments.ts
  • src/renderer/src/web/preload-api/web-filesystem-api.ts
  • src/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.

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

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 45440c76-76ab-4067-b068-6298b48b977e
📥 Commits

Reviewing files that changed from the base of the PR and between 51a0f7b and 55a9a0e.

📒 Files selected for processing: 13
  • src/main/window/attach-main-window-services.ts
  • src/main/window/dragged-temp-file-copy.ts
  • src/main/window/dropped-path-preparation-ipc.test.ts
  • src/main/window/dropped-path-preparation-ipc.ts
  • src/main/window/dropped-path-preparation.test.ts
  • src/main/window/dropped-path-preparation.ts
  • src/renderer/src/components/native-chat/NativeChatPaneFileDropSurface.tsx
  • src/renderer/src/components/native-chat/native-chat-pane-file-drop.ts
  • src/renderer/src/components/native-chat/use-native-chat-external-attachments.test.tsx
  • src/renderer/src/components/native-chat/use-native-chat-external-attachments.ts
  • src/renderer/src/hooks/use-os-file-drop-owner.test.tsx
  • src/renderer/src/hooks/use-os-file-drop-owner.ts
  • src/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.

@brennanb2025

Copy link
Copy Markdown
Contributor Author

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 4d038a705d6bc877eb1baedca325d7e06eda847a. Review corrected shared-source deletion (including duplicate-path and symlink-root variants), owner-change feedback, unconditional extra copying, queued-editor destination selection, and a timing-dependent test fixture. Fresh-copy capture preserves the original bytes on storage failure; abandonment releases the preparation queue without deleting a completed store file. Existing published paths are preserved. Claims use the common attachment path across file types and agents; real runtime QA exercised Codex.

Verified:

  • Focused intake tests passed, including all 22 preparation tests and all 17 queued-editor tests. The queued regression failed before the selector correction. Final paired-case setup was independently checked against the real capability registry.
  • The exact-head full PR workflow and aggregate gate passed, with all 30 jobs accounted for; the WSL workflow also passed. An unchanged Windows installer process-query timeout passed on one failed-job retry, with no code or timeout change. All review threads are resolved.
  • Lane-owner Electron QA 888 and 927 compared this exact head with main fb21729157270307bb49a14f1d1c7a7dd570bc71. Both normal composer drops and queued-editor drops completed send plus a real Codex reply. Main lost its eight-day-aged source after restart; this PR retained the 31-day-aged sent image with the same hash and chat claim after restart and fresh reload. The expired unsent image showed “Attach again” and disabled Send.
  • Queued QA used the test runtime's existing orchestration dispatch route to create an editable queued card, then a real OS drop, Save and automatic send. These builds support queued-message and image editing but do not advertise mid-turn queueing; no capability or saved message was fabricated.

Accepted and deferred:

  • STA-11413 — accepted by Brennan on 2026-10-20: when eligible images in one drop total over 50 MiB and temporary storage and chat storage are on different volumes, the first attachment chip can arrive more slowly. The bounded alternating repeat on the same intake code measured main median 133.90 ms versus PR 241.05 ms (16 samples each). Shared-load ranges overlap; the seven other measured shapes favored the PR. Cross-volume transfer still does extra content copying. This cost is accepted, not fixed.
  • STA-11414 — inherited: workspace-tree drags into a queued editor lose their route while a question or approval replaces the normal composer. OS drops and paste use independent routes; this PR does not repair that internal drag route.
  • Existing behavior remains: Send during preparation can send text before the image arrives; expired nonimage drafts lack proactive missing-file feedback; a partially unreadable drop can omit a file. Missing dropped images say “Attach again,” while pastes have their existing “Not kept” feedback. Earlier large-batch QA saw a grey first image on both revisions despite intact files and claims; its cause remains unverified. Actual quiet-disable/unmount during preparation and agents other than Codex were not exercised in runtime QA; those conclusions have source/test coverage only. Copies with unknown ownership can accumulate.

For Brennan's review

Normal composer, after aging and restart — main loses the image; this PR keeps it:

Main: aged composer drop lost

PR: aged composer drop retained

Queued editor with the dropped image, then the aged sent result on main and this PR:

PR: dropped image in queued editor

Main: aged queued drop lost

PR: aged queued drop retained

Real reply and expired unsent-draft feedback:

PR: sent screenshot and real reply

PR: expired unsent draft asks to attach again

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.

@brennanb2025
brennanb2025 merged commit 9af1ac8 into main Oct 21, 2026
71 of 73 checks passed
@brennanb2025
brennanb2025 deleted the brennanb2025/chat-drops-live-with-chat branch October 21, 2026 00:11
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.

1 participant