Large File Uploads
Resumable chunked web uploads let browser users upload files up to 1 GiB as chat attachments, project workspace files, and shared-directory files without buffering whole files in Hub RAM or TMPDIR, and without breaking across Hub replicas or rolling updates.
This feature is gated by the hub.large_uploads experiment (off by default) and applies to both Single-node hosted and HA hosted deployments (as well as workstation servers).
Prerequisites and enabling
Section titled “Prerequisites and enabling”-
Enable the experiment. Turn on
hub.large_uploadsin Admin → Server Config → Experiments, or via the CLI:Terminal window scion hub experiments enable hub.large_uploads -
Chat attachments additionally require artifact storage with
Composersupport.- Enable
hub.attachment_artifacts(and ensure artifact storage is configured). Whilehub.attachment_artifactsis off or unready, starting a large chat upload returns409(artifact_attachments_required). - The Hub’s configured blob store must implement
storage.Composer— GCS (gcs) or local storage (local). A backend without compose support returns501(large_uploads_unsupported_storage). - Workspace and shared-directory uploads stage directly on the target filesystem (NFS or local disk) and do not require a blob store. Remote-broker-only linked projects continue to return
409.
- Enable
While hub.large_uploads is off, all .../uploads routes answer 404 (experiment_disabled) and the Web UI keeps its existing single-request multipart upload path. Turning hub.large_uploads off mid-flight fails in-flight sessions on their next request with 404 (experiment_disabled), while already completed files remain intact and the sweeper cleans up abandoned staging.
Raising per-file limits for 1 GiB
Section titled “Raising per-file limits for 1 GiB”Enabling hub.large_uploads does not automatically raise per-file size caps. Raise the target limits under Admin → Server Config (or PUT /api/v1/admin/server-config) to the size you want:
Workspace and shared-directory files
Section titled “Workspace and shared-directory files”server.hub.uploads.max_workspace_file_size:- Default:
52428800(50 MiB) - Maximum:
1073741824(1 GiB)
- Default:
- The legacy single-request multipart workspace upload route remains clamped at
104857600(100 MiB) regardless ofmax_workspace_file_size. Whenhub.large_uploadsis enabled, the web client sends a single multipart request only when the whole request body fits within a fixed 8 MiB threshold (DEFAULT_CHUNK_BYTES/fitsSingleMultipartRequestinweb/src/client/chunked-upload.ts), and uses resumable chunked upload sessions for larger requests (including everything above 100 MiB).
Chat attachments
Section titled “Chat attachments”- Artifact-backed chat attachments use the
artifactsoperational settings section:artifacts.max_file_bytes: default33554432(32 MiB)artifacts.max_bundle_bytes: default268435456(256 MiB)
- To allow 1 GiB chat attachments, raise both
artifacts.max_file_bytesandartifacts.max_bundle_bytes(for example, both to1073741824, or setmax_bundle_bytes≥max_file_bytes). Savingmax_file_bytes > max_bundle_bytesis rejected by validation. server.hub.uploads.max_attachment_size(default10485760= 10 MiB, max104857600= 100 MiB) applies only to the legacy non-artifact attachment store and does not cap artifact-backed large chat uploads.
Chunking and quota settings (server.hub.uploads)
Section titled “Chunking and quota settings (server.hub.uploads)”All server.hub.uploads.* keys are live Layer-1 operational settings stored in the Hub database and applied across replicas without a restart:
| Key | Default | Valid range / rule | Notes |
|---|---|---|---|
server.hub.uploads.chunk_bytes |
8388608 (8 MiB) |
1048576 (1 MiB) – 16777216 (16 MiB) |
Maximum body size of each chunk PUT once a chunked session starts. Does not change the web client’s fixed 8 MiB single-request threshold (DEFAULT_CHUNK_BYTES in web/src/client/chunked-upload.ts). |
server.hub.uploads.session_idle_ttl |
1h |
5m – 24h |
Idle expiry window; advanced only on start and on a successful chunk commit (refused calls and status GET never extend it). |
server.hub.uploads.session_max_lifetime |
24h |
≥ session_idle_ttl, ≤ 7d (168h) |
Hard lifetime cap from session start; never extended. Accepts Go durations (24h, 168h) and whole-day shorthands (7d). |
server.hub.uploads.max_sessions_per_user |
4 |
1 – 64 |
Maximum concurrent active (uploading / finalizing) sessions per user. |
server.hub.uploads.max_pending_bytes_per_user |
2147483648 (2 GiB) |
≥ 1 byte |
Sum of declared_size across a user’s active sessions. Setting it below the largest effective per-file limit returns a save warning (not an error). |
server.hub.uploads.max_pending_bytes_hub |
17179869184 (16 GiB) |
≥ 1 byte and ≥ max_pending_bytes_per_user |
Sum of declared_size across all non-completed sessions holding staging on the Hub. |
Exceeding a session count or pending-bytes quota returns 429 (upload_quota_exceeded) with Retry-After: 60.
1 MiB non-final chunk floor
Section titled “1 MiB non-final chunk floor”Every non-final chunk (offset + contentLength < declaredSize) must be at least min(1 MiB, chunk_bytes) — 1048576 bytes for any valid chunk_bytes setting. Smaller non-final chunks are rejected with 400 (chunk_too_small). Only the final chunk may be shorter. For chat attachments, the Hub also enforces a defensive part-count ceiling of ceil(declaredSize / minChunk) + 1 (400 too_many_parts).
Reverse proxy body limits
Section titled “Reverse proxy body limits”- When
hub.large_uploadsis enabled, the web client uses a fixed 8 MiB whole-request threshold (DEFAULT_CHUNK_BYTES/fitsSingleMultipartRequestinweb/src/client/chunked-upload.ts) to decide whether to try a single multipartPOSTor start chunked sessions. - Once a chunked session starts, every chunk
PUTbody is at most the server’sserver.hub.uploads.chunk_bytes(default 8 MiB, hard maximum 16 MiB). - The 16 MiB ceiling leaves 2× headroom under Cloud Run’s 32 MiB HTTP/1.1 request body limit.
- If a front proxy (such as nginx or an enterprise ingress) enforces a smaller body limit down to 1 MiB and answers
413to a single multipart request or a chunkPUT, the web client automatically falls back to chunked uploads or halves its chunk size (down to the 1 MiB floor) and retries from the server’s committed offset (web/src/client/chunked-upload.ts). - Lowering
server.hub.uploads.chunk_bytesto match a smaller proxy limit (for example4194304behindclient_max_body_size 4m) avoids413retries on chunkPUTrequests once a chunked session has started; single multipart requests up to 8 MiB still attempt onePOSTfirst and fall back to chunked automatically on413.
Staging storage and lifecycle cleanup
Section titled “Staging storage and lifecycle cleanup”-
Chat attachments (object storage): chunks are staged under the top-level prefix
uploads-staging/{hub_id}/{session_id}/in the Hub’s artifacts bucket, then server-side composed into the content-addressed blob at finalize. -
Workspaces and shared directories (filesystem): bytes are written to
.scion-upload-{session_id}.partialin the target’s parent directory and atomically renamed into place on completion, so failed or aborted uploads never truncate an existing file. -
Hub sweeper: the singleton job
upload-session-sweepruns every 1 minute (regardless of whetherhub.large_uploadsis enabled) to expire idle or hard-expired sessions, mark stuck finalizing sessions failed, and delete staged objects/partials and terminal session rows after a 15-minute replay retention window. -
GCS bucket lifecycle rule (backstop): both the
hub-cloudrunandhub-gkeTerraform modules configure a lifecycle rule on the artifacts bucket that deletes objects underuploads-staging/after 8 days:action.type = "Delete"condition.age = 8condition.with_state = "ANY"condition.matches_prefix = ["uploads-staging/"]
The 8-day age strictly exceeds the 7-day maximum
server.hub.uploads.session_max_lifetime(with headroom for GCS lifecycle evaluation lag) so early parts of a live, long-running upload session are never deleted before finalize; the Hub’supload-session-sweepjob remains the primary cleanup for normal expirations and aborts. If you manage your GCS artifacts bucket outside the Scion Terraform modules, add an equivalent lifecycle rule so orphaned staging objects are reclaimed even if a Hub is offline. No bucket CORS configuration and no Cloud Run memory or GKE ephemeral-storage bump are needed.
Mixed-version rollout note
Section titled “Mixed-version rollout note”During a rolling update while some replicas do not yet serve the .../uploads routes, an older replica returns 404; the Web UI retries 404 responses on active chunk/status requests for up to 60 seconds so in-flight uploads can ride out the rollout once all replicas are updated.
Agent attachment delivery cap
Section titled “Agent attachment delivery cap”Raising artifacts.max_file_bytes lets users upload and view large chat attachments in the Web UI, but delivering attachments into an agent’s inbox remains governed by messaging.attachment_delivery_max_bytes:
- Default:
33554432(32 MiB) total attachment bytes per message sent to an agent. - Setting
messaging.attachment_delivery_max_bytesto0disables attachment delivery to agents. - Messages whose total attachments exceed
messaging.attachment_delivery_max_bytesare refused when addressed to an agent, even if the attachment uploaded successfully to the chat attachment store.