Skip to content

feat: make web upload limits configurable - #41

Merged
douglasjunior merged 2 commits into
mainfrom
ccr-2dc562d5-ud50i6
Nov 26, 2026
Merged

douglasjunior merged 2 commits into
mainfrom
ccr-2dc562d5-ud50i6

Conversation

@douglasjunior

@douglasjunior douglasjunior commented Nov 26, 2026 •

Copy link
Copy Markdown
Owner

Summary

The largest attachment and the number of attachments per message of the web interface were fixed at 10 MB and 10 files. They become two settings, edited live on the settings page (Advanced → Web interface).

Setting Default Bound
WEB_UPLOAD_MAX_MB 10 up to 1024
WEB_MAX_ATTACHMENTS 10 up to 100

The bounds are what the protocol keeps (MAX_UPLOAD_MB, MAX_ATTACHMENTS). An upload is written to disk chunk by chunk, so a large file costs time and disk, not memory: with one upload.ack per 32 KB chunk, 1 GB over remote access takes close to an hour.

Changes

Protocol

  • limits.ts: MAX_UPLOAD_MB = 1024 and BYTES_PER_MB replace MAX_UPLOAD_BYTES; MAX_ATTACHMENTS is 100. Both are the ceilings of the schemas.
  • SETTING_SCHEMAS gets WEB_UPLOAD_MAX_MB and WEB_MAX_ATTACHMENTS.
  • New server event upload.limits { maxBytes, maxAttachments }.
  • PROTOCOL_VERSION is 6.

Server

  • Two catalog entries in the web group, apply: 'live'.
  • WebUploadLimitsService reads both settings where they are used and broadcasts upload.limits to every connection when either changes (ISettingsChangeNotifierPort).
  • The connection gets upload.limits right after auth.ok.
  • WebUploadSessionsService refuses a file above the limit as it is when the upload starts: File is larger than N MB.
  • SendConversationMessageUseCase refuses a message with more attachments than the limit with the notice A message takes at most N attachments. Remove some and send it again. and runs no turn.

Web

  • ConnectionProvider keeps the last upload.limits and exposes it as uploadLimits in useConnection().
  • usePromptAttachments takes the limits: a file above it fails before uploading (File is larger than N MB), and extra files are dropped. Before the server tells its limits, the protocol's bounds apply.
  • Settings page: labels "Largest attachment" (MB) and "Attachments per message" (files).

Docs

  • README (both tables), .env.example, and the settings, web-channel and web-app skills.

Upgrading

  • PROTOCOL_VERSION goes to 6, so the hosted web app of remote access needs a server with this change.
  • With nothing set, the limits stay at 10 MB and 10 files.

Testing

  • pnpm ts, pnpm lint, pnpm test:cov and pnpm test:e2e pass.
  • New specs:
    • upload.limits after auth.ok, and broadcast only on a change of these settings;
    • upload refused against the current setting;
    • message refused above the attachment count;
    • ConnectionProvider keeping the limits;
    • composer using the server's limits, and the protocol's before it hears them.
  • Not checked in a browser.

The largest attachment and the attachments per message of the web
interface were fixed at 10 MB and 10 files. They become the settings
WEB_UPLOAD_MAX_MB and WEB_MAX_ATTACHMENTS, edited live on the settings
page (Advanced, Web interface) up to 100 MB and 50 files, the bounds the
protocol keeps.

The server checks each upload and message against the settings as they
are, and tells every connection the limits in an upload.limits event
after auth.ok and whenever either setting changes, so the composer
refuses a file before uploading it. PROTOCOL_VERSION goes to 6.
WEB_UPLOAD_MAX_MB takes up to 1024 MB and WEB_MAX_ATTACHMENTS up to 100
attachments per message. The defaults stay at 10 MB and 10 files.
@douglasjunior
douglasjunior merged commit 03d7d5d into main Nov 26, 2026
2 checks passed
@douglasjunior
douglasjunior deleted the ccr-2dc562d5-ud50i6 branch November 26, 2026 15:10
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