Skip to content

feat(upload): chunked, resumable upload for large media and KB files — one shared service, streamed to disk, size limits from config #19713

Open

Description

@mrveiss

Problem

Large media cannot be added to the knowledge base, including video files of a few GB whose audio is meant for transcription. Every upload is a single request, and the request size is capped at several layers: the 1 MiB perimeter cap (#19712), the route's own 10 MB, and the web server's 10 MB or 1 GB depending on location. Even with those raised, a multi-GB single request ties up a worker, and if the connection drops the user restarts from zero.

Decision

Maintainer decision (2026-10-26): chunked, resumable upload is the M1 target. Simply raising the limits, or a server-folder-only import, was not chosen.

Design

  • One shared upload service for knowledge files, chat files and transcriber media. No per-feature copy.
  • The client splits the file into chunks (size from config, for example 8 MB). The server streams each chunk to a staging file on disk. The server never holds the whole file in memory.
  • An upload session has an id, the offsets received and a checksum. An interrupted upload resumes from the last acknowledged offset.
  • The maximum total size is one config value, and is not hardcoded. Finished files are handed to the existing intake (KB add_document, or the transcriber job) by path.
  • Staging files are cleaned up only after the handoff has been recorded. An abandoned session expires after a configured TTL and is listed for review; it is not silently deleted.

Acceptance criteria

  • A 4 GB video uploads from the Knowledge UI, and backend memory stays bounded. A test sends N chunks and asserts the staged file's size and checksum.
  • Killing the connection mid-upload, then retrying, resumes from the last acknowledged chunk. A test pins resume.
  • The uploaded video reaches the transcriber, and its transcript lands in the KB.
  • KB document upload and chat file upload use the same service: one implementation, with callers listed in the PR.
  • Chunk size, maximum total size and session TTL are env-backed config. No literal appears in code or in web server config.

Activity

  1. mrveiss commented on Nov 2, 2026

    @mrveiss
    OwnerAuthor

    Maintainer decision (2026-11-02): this goes ahead of other new work and is exempt from the hold on new PRs. The current upload size is too small, and the chunked design stays rather than raising limits as a stopgap, so uploads stay at 10 MB until this lands. Work starts when the queue allows it.

  2. mrveiss commented on Nov 20, 2026

    @mrveiss
    OwnerAuthor

    Branch issue-19713-chunked-upload (PR #20694, head 325b1d6) was deleted as a zero-change branch: its content is already on main. None of the five ACs is ticked; no chunked-upload test, resume test, transcript landing or env-backed chunk config was verified.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions