Skip to content

fix(desktop): treat dropped folders as context refs - #50424

Closed
DaveCharland wants to merge 1 commit into
NousResearch:mainfrom
DaveCharland:fix/desktop-folder-drop-context
Closed

fix(desktop): treat dropped folders as context refs#50424
DaveCharland wants to merge 1 commit into
NousResearch:mainfrom
DaveCharland:fix/desktop-folder-drop-context

Conversation

@DaveCharland

Copy link
Copy Markdown

Summary

  • Detect File-bearing OS drops that resolve to directories before treating them as file uploads.
  • Attach local dropped folders as folder context refs instead of routing them through file.attach.
  • Show an actionable warning for local folder drops while connected to a remote gateway, where the remote host cannot read the local folder path.

Why

Dragging a folder from the OS can arrive in the renderer with a native File handle. The previous split treated every File-bearing drop as a file/image attachment candidate. For folders, that eventually called file.attach with a directory path and no uploaded bytes, producing the gateway error:

file not found on gateway and no data_url provided

The fix probes the resolved path with the Desktop filesystem bridge before the file/image branch. If the path is a directory, the composer handles it as folder context.

Test plan

npm run test:ui -- src/app/chat/hooks/use-composer-actions.test.ts
# 8 tests passed

npm run typecheck
# tsc -p . --noEmit

@alt-glitch alt-glitch added type/bug Something isn't working comp/tui Terminal UI (ui-tui/ + tui_gateway/) P3 Low — cosmetic, nice to have comp/desktop Electron desktop app (apps/desktop/*) and removed comp/tui Terminal UI (ui-tui/ + tui_gateway/) labels Jun 21, 2026
@teknium1

Copy link
Copy Markdown
Contributor

Thanks for the focused folder-drop investigation.

Automated hermes-sweeper review found this behavior is already implemented on current main:

  • a488fcf107d1c61400db4274c0baf357b908c772 (merged as fix(desktop): detect dropped folders so they attach as @folder refs #56029) detects OS-dropped directories synchronously through DataTransferItem.webkitGetAsEntry().
  • apps/desktop/src/app/chat/hooks/use-composer-actions.ts:165-205 emits detected directories as path-only entries, and :527-539 routes those entries to folder context attachments rather than file.attach.
  • apps/desktop/src/app/chat/hooks/use-composer-actions.test.ts:124-187 covers directory classification, exclusion from the upload path, and duplicate items/files handling.

That commit is contained in release v2026.7.1. Closing as implemented on main.

@teknium1 teknium1 closed this Jul 14, 2026
@teknium1 teknium1 added the sweeper:implemented-on-main Sweeper: behavior already present on current main label Jul 14, 2026
@DaveCharland

Copy link
Copy Markdown
Author

Thanks Tec! You the man. Sorry again to hear about your bestie Link. I'm sure he and my precious angel Minnie and waiting for us on the other side of the rainbow bridge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/desktop Electron desktop app (apps/desktop/*) P3 Low — cosmetic, nice to have sweeper:implemented-on-main Sweeper: behavior already present on current main type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants