Skip to content

🔧 feat: Unified file upload: per-mime-type routing with lazy provisioning#12626

Open
AtefBellaaj wants to merge 2 commits intoclaude/clever-kirchfrom
feat/unified-upload-phase-1
Open

🔧 feat: Unified file upload: per-mime-type routing with lazy provisioning#12626
AtefBellaaj wants to merge 2 commits intoclaude/clever-kirchfrom
feat/unified-upload-phase-1

Conversation

@AtefBellaaj
Copy link
Copy Markdown
Collaborator

@AtefBellaaj AtefBellaaj commented Apr 12, 2026

Unified File Upload — Phase 1

Summary

  • Replace the 3-way file upload dropdown ("Upload to provider" / "Upload as text" / "Upload for File Search") with a single attach button that auto-routes files
    by mime type
  • Add DefaultLLMDeliveryPath config system: per-mime-type routing to provider, text, or none with endpoint → global → system default fallback chain
  • Implement lazy file provisioning (axis 2): defer tool_resource uploads (file_search, code_interpreter) to ON_TOOL_EXECUTE time instead of upload time, with
    staleness checks and multi-resource support
  • Persist llmDeliveryPath on file records; none files stay visible in chat UI but are skipped in LLM delivery
  • legacyFileUploadUX: true config flag to opt back into the old dropdown

What's NOT in this PR

  • processAttachments skip for none files in BaseClient.js — 4-line addition, deferred to avoid scope creep (only matters when someone configures none overrides)

Phase 2 (future)

  • Read-time delivery re-routing: resolve delivery path per-request based on live endpoint config (handles endpoint switching mid-session). Drops llmDeliveryPath
    persistence
  • Per-model capability config (vision-aware fallback)
  • Size/token-based routing for none
  • Speculative eager provisioning with promise cache
  • Move provision.js to TypeScript in /packages/api

Notes

  • System defaults: image/* and application/pdf → provider, everything else → text
  • Axis 1 (default path) and axis 2 (tool provisioning) are independent — a CSV can be text AND provisioned to code_interpreter simultaneously
  • TODO comments left for review findings from PR 🔧 feat: Unified file experience #12355 (temp file collisions, query param forwarding, shared object mutation)
  • No migration needed — legacy files without llmDeliveryPath are unaffected

@AtefBellaaj AtefBellaaj force-pushed the feat/unified-upload-phase-1 branch 2 times, most recently from 0d7e3be to 25737a6 Compare April 12, 2026 16:59
@AtefBellaaj AtefBellaaj force-pushed the feat/unified-upload-phase-1 branch from 25737a6 to fcabe41 Compare April 12, 2026 17:58
@AtefBellaaj AtefBellaaj changed the title WIP 🔧 feat: Unified file upload — per-mime-type routing with lazy provisioning Apr 12, 2026
@AtefBellaaj AtefBellaaj marked this pull request as ready for review April 12, 2026 19:39
@danny-avila danny-avila changed the title 🔧 feat: Unified file upload — per-mime-type routing with lazy provisioning 🔧 feat: Unified file upload: per-mime-type routing with lazy provisioning Apr 12, 2026
@AtefBellaaj
Copy link
Copy Markdown
Collaborator Author

@danny-avila
Still pending:

  • code execution tests
  • removal of after :drag and drop dialog
    current behavior:
    legacyFileUploadUX is false or not set
    attachment file button open file picker directly and files are uploaded as they are and the LLMDelivery path (text, provider, none) is decieded on upload in the backend.
    picked files uploaded immediately.
    However when you drag and drop a file, a dialog with options (provider, as Text, to file search) is opened.
    ---
    expected behavior:
    similar to picked file from file picker, drag and drop should automatically upload files, with the correct destination based on configured mime types

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