Repository navigation
feat(native-chat): show a drop target on the whole chat pane - #20561
Conversation
Dropping a file into a chat only worked if you hit the input box, and nothing on screen said so. A drag aimed at the transcript fell through to the terminal behind the chat, which pastes the paths into the hidden TUI. The chat pane shell is now the drop surface. While a drag carrying files is over it, the pane dims behind a card naming what the drop will do; the composer's existing attach logic — workspace, execution-host and SSH-owner checks included — runs unchanged from the wider element. Two routes reach the composer and they are widened differently: - an in-app drag is claimed in the renderer, so the pane calls the composer's handlers through a claim the composer publishes to the surface around it. - an OS drag is delivered by the preload drop route, which consumes the event at `document` before React sees it. The pane widens that route by publishing the composer's scope key as the nearest drop marker, and learns the drag ended from a document-level listener rather than a React drop. The surface lives in the chat portal because that is the one place wrapping both the bridge and structured panes, so neither pane root grows a second copy of this wiring. No composer mounted (a question card owns the input region) means no marker and no overlay, so that drag stays the terminal's. A guarded composer still answers for the drag — that refusal is what keeps it out of the terminal — but the pane does not invite a drop it will refuse.
There was a problem hiding this comment.
Important
The drop surface is mounted in only one of the two production places a chat composer renders. StructuredAgentSessionPaneOverlayLayer (agent-session tabs) renders NativeChatView mode="structured" with no surface ancestor, and the composer field no longer attaches the workspace-drop handlers itself — so in-app file drags onto those composers now silently do nothing. See the inline comment.
Reviewed changes
- New pane-wide drop surface (
NativeChatPaneFileDropSurface.tsx) — context that lets a mounted composer publish a drop claim; the shell div then owns thecomposerdrop marker, the React capture handlers, and the dimming overlay. - Drag classification (
native-chat-pane-file-drop.ts) — distinguishes in-appworkspacedrags (claimed in the renderer) fromosdrags (delivered by the preload route), plus a child-boundary flicker guard fordragleave. - Composer publishes its claim (
use-native-chat-workspace-file-drop.ts) —useNativeChatPaneFileDropClaim({ scopeKey: paneKey, disabled, … })replaces the directly-attached handlers; the field propworkspaceFileDropHandlersis removed. - Portal becomes the surface (
TerminalPaneNativeChatPortal.tsx) — the shell<div>is replaced byNativeChatPaneFileDropSurface. - New tests + i18n —
native-chat-pane-file-drop.test.tsx(9 cases) and updated composer-drop probe;components.native-chat.drop.{title,subtitle}added toen.json.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 10 included reviews per hour; 7 remain after this review. 📝 WalkthroughWalkthroughNative chat now supports pane-wide file drops. The pane classifies workspace and OS drags, routes workspace drops to the registered composer, and leaves OS drops to the preload route. It displays a localized overlay during eligible drags and clears it during drop and drag-end events. Composer registration now includes a pane scope key. Tests cover routing, disabled composers, overlay lifecycle, and structured chat view integration. Priority: ⬇️ Low Merge Risk: ⚪ Minimal · up to The pane-wide drop routing and cleanup paths are covered by the supplied focused tests, with no actionable merge risk identified. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
Full details: Description checkExplanation The description explains the behavior, implementation, scope, testing, and known validation limits. However, it does not follow the required template headings and omits the required linked issue. It also references visual evidence in a review comment instead of providing the required visual proof in the pull request description.
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
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
- Drop surface moved into
NativeChatView— both the terminal portal and the agent-session overlay path now get a surface, fixing the previously reported silent no-op for in-app drags on overlay composers. - Portal shell restored —
TerminalPaneNativeChatPortalgoes back to a plainnative-chat-pane-shell<div>; the surface is no longer nested there, so there is exactly one surface per pane. - Guard transition clears the overlay — adding
disabledto the claim-registration effect deps tears the hover down before the next paint when a composer becomes guarded. - Handler wiring simplified — dropped the
registrationRef; the handler factory is memoized on[registration]and reads the live claim throughregistration.getClaim(). - Regression coverage — new
native-chat-view-file-drop.test.tsxproves a standalone structured session owns pane drops without a terminal portal, plus a guard-transition case in the pane drop tests.
Verified the moved surface is layout-safe for both hosts: both session roots are flex h-full min-h-0 w-full flex-col bg-background, so the added relative flex … h-full w-full wrapper fills as before. Ran native-chat-pane-file-drop, native-chat-view-file-drop, and native-chat-composer-workspace-file-drop — 26 passed.
ℹ️ Nitpicks
- The PR description still says the surface "lives in
TerminalPaneNativeChatPortal.tsx"; it now lives inNativeChatView.tsx. Worth a one-line update so the next reader isn't sent to the wrong file.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
Electron evidence — updated after review fixesGrok QA exercised the final source committed as
This validates Chromium native-path delivery, not a physical Finder gesture. The earlier Playwright helper constructed pathless JavaScript File objects; that method's limitation does not apply to the successful absolute-path CDP probe. No Windows/Linux desktop gesture validation was performed. Healthy structured chat: invitationAfter explorer drop: one path, invitation clearedAfter a second, native CDP drop: one additional path, invitation cleared |
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Native drop completion listeners subscribed at claim time — the surface's document
drop/dragendteardown now attaches whenever a composer registration exists rather than only after the hover render commits, so an OS drop the preload consumes before that commit still clears the overlay. The listener set and guard-transition behavior are otherwise unchanged; the effect now runs for the composer's lifetime and is removed on unmount. - Regression coverage — new tests prove a native drop that ends before the hover commit clears the overlay, and that the end listeners stay stable across drags and are removed with the composer. Both fail against the previous
[isDragActive]effect and pass at the new head.
Confirmed the fix rests on the preload route (preload-runtime-support.ts:105-157) consuming the OS drop on the same document node with stopPropagation, which does not suppress the surface's own document-capture listener. pnpm test native-chat-pane-file-drop.test.tsx native-chat-view-file-drop.test.tsx — 13 passed.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
|
Review complete at
Working tree is clean. No new PR was opened and this PR was not merged. |




ELI5
You can drag a file into a chat, but only if you hit the small input box, and nothing on screen told
you that. Now the whole chat pane accepts the file and shows you so while you are dragging.
What Changed
The chat view is the drop surface. While a drag carrying files is over it, the pane dims behind a
card naming what the drop will do, and a drop anywhere in the pane attaches to that chat's composer.
The composer's attach logic is unchanged — the same workspace, execution-host and SSH-owner checks
run, just from a wider element. The mounted composer publishes its current handlers and scope key to
the surface around it; nothing validates a path in the new code.
Two routes reach the composer and they are widened differently:
composer's existing handlers.
documentbefore React sees it. The pane widens that route by publishing the composer's scope keyas the nearest drop marker, and learns the drag ended from document drop/dragend listeners instead
of a React drop. That asymmetry is deliberate and is why the surface does not mirror one set of
handlers for both.
The surface lives in
NativeChatView, which is the common entry point for both chat surfaces:terminal-backed chat panes and standalone structured-session tabs (the pane overlay layer). An
earlier revision of this PR mounted it in the terminal-pane portal and therefore missed standalone
structured chats entirely; review caught that and moved it.
Behavior change worth calling out
Dropping a file on the transcript used to fall through to the terminal behind the chat, which
pastes the paths into the hidden TUI. It now attaches to the composer. That is the point of the
change, but it is a change in behavior, not only a new visual.
States that stay as they are
the terminal's.
terminal behind the chat — but the pane does not invite a drop it will refuse, and a composer that
becomes guarded mid-drag clears the invitation.
Why
#20494 added the capability; this makes it discoverable. The input box sits at the bottom of the
pane, so someone dragging out of the File Explorer never looks there, and a drag aimed at the
transcript silently did something else entirely.
Linked Issue
No separate issue. This follows up #20494, which added the drag-and-drop capability, and #15782, the
silent-failure bug behind it.
Visual Proof
After — real chat pane in a background Electron instance: the invitation while dragging, and the
attached path after the drop.
Before — nothing appeared while dragging and only the input box accepted a drop, so a before
shot of this surface is the pane with no drag in flight: visually identical to idle.
Full QA coverage, including a native absolute-path CDP drop and the stale-invitation sequences, is
in this comment. What that
does not cover: a physical Finder gesture, and Windows/Linux desktop gestures.
Testing
analysis, all eight test shards, packaging on macOS and Windows, and pullfrog).
83d3315cbf: the four drop-related suites pass (38 tests) — pane routing, thestandalone structured-view surface, composer workspace drops, and composer drop scope.
pnpm test src/renderer/src/components/native-chat/and.../terminal-pane/both pass.route marker, the no-composer case, the guarded composer, guard transitions mid-drag, child
boundary flicker, drop-completion listeners being live before the hover renders, and listener
cleanup following composer ownership.
pnpm run check:code-quality:changed, React Doctor, max-lines ratchet, and the four localizationgates pass.
Platforms exercised: macOS. No platform-conditional code — the drag types and the preload marker
route are identical on all three.
AI Disclosure
Review
Reviewed with a same-model review loop until clean, plus start/end readiness passes and rendered
Electron QA. Review fixes on this branch:
structured chat tabs get the drop target too.
late overlay behind.
Agent skill upstream boundary
docs/reference/agent-skill-sharing-upstream-boundary.mdand copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.Notes
composer already ran is untouched.
only changes which element the drag is read on.
subscription churn; repeated
dragoversets the same state value, so React bails out rather thanre-rendering the transcript.
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)