LibreChat/api/server/services/Files
Marco Beretta 698ee25fea
🧯 fix: Close Abandoned Download and Speech Streams and Cap Speech Input (#17270)
* fix: Contain Download and Speech Stream Failures and Cap Speech Input

The code output download piped the Code API stream with .pipe, which adds no
error listener, so a body that failed mid-stream (a bad gzip body, a reset)
became an uncaught exception and the process exited. pipeToResponse uses
stream.pipeline, ending the response and destroying the upstream when the
client leaves.

Text-to-speech piped provider streams the same way and waited only for
'end', so a provider error was uncaught and a client disconnect left the
chunk loop waiting. pipeSegment resolves on end and rejects on an error or
a disconnect, which ends the loop.

A speech request had no length cap, so one request could fan out into
thousands of serial paid provider calls. speech.tts.maxInputChars bounds it
(default 20,000 characters).

* docs: Document the Speech Input Cap in the Example Config

* fix: Reject a Speech Segment When the Client Already Left

* fix: Tear Down Both Ends of a Failed Speech Segment and Cap Streamed Speech

A failed provider segment now destroys the response as well as the source,
so a half-written answer cannot hang the client, and a response-side error
rejects the segment instead of going unhandled. Automatic playback reads a
message only up to speech.tts.maxInputChars, so long messages cannot fan
out past the cap either.

The download scenario now checks the behavior .pipe lacked: leaving a code
download closes the upstream connection right away.

* fix: Keep a Late Response Write Error From Going Unhandled

* test: Key Slow Code Downloads by File and Send a Browser User Agent

* fix: Read Speech Up to the Cap Instead of Refusing It

Manual speech now synthesizes the text up to speech.tts.maxInputChars, the
same as automatic playback, through capSpeechInput, so the CJS service only
passes the capped text along and the request keeps its existing error
contract. A streamed message that reaches the cap exactly now finishes, and
a segment that fails before any audio went out leaves the response open for
the caller's HTTP error.

* fix: Count Only Text Against the Speech Cap
2026-10-19 22:20:40 +02:00
..
Audio 🧯 fix: Close Abandoned Download and Speech Streams and Cap Speech Input (#17270) 2026-10-19 22:20:40 +02:00
Azure 🧩 feat: Add Skill Creation and File Deletion to Management API (#16878) 2026-10-16 09:05:03 -07:00
Citations 🛤️ fix: Align File Search Citation Paths (#15650) 2026-09-06 17:25:47 -04:00
Code 🧹 fix: Let File Deletes Succeed When the Code API No Longer Serves the Ref's Profile (#16671) 2026-10-04 11:38:31 -04:00
Firebase 🧩 feat: Add Skill Creation and File Deletion to Management API (#16878) 2026-10-16 09:05:03 -07:00
images 🪦 refactor: Remove Dead Legacy API Modules and Root Tooling (#17114) 2026-10-15 12:25:24 +02:00
Local 🧩 feat: Add Skill Creation and File Deletion to Management API (#16878) 2026-10-16 09:05:03 -07:00
OpenAI
VectorDB 🚚 feat: Route Attachments and Provision Tools Lazily (#15763) 2026-09-08 23:28:52 -04:00
permissions.js
permissions.spec.js
process.integration.spec.js
process.js ⏳ fix: Expire Dead-Lettered Trigger Deliveries and Clean Up Orphaned Image Uploads (#17049) 2026-10-14 17:58:56 +02:00
process.spec.js ⏳ fix: Expire Dead-Lettered Trigger Deliveries and Clean Up Orphaned Image Uploads (#17049) 2026-10-14 17:58:56 +02:00
provision.js ✂️ refactor: Remove Dead Helpers, Classes and Dependencies From packages/api (#17118) 2026-10-16 15:43:12 +02:00
provisionCallback.js 🚕 feat: Add Per-Call Subagent Machine Selection (#16757) 2026-10-05 06:21:15 -04:00
retention.js ⏳ fix: Separate Temporary and General Chat Retention (#15734) 2026-09-08 11:22:54 -04:00
retention.spec.js ⏳ fix: Separate Temporary and General Chat Retention (#15734) 2026-09-08 11:22:54 -04:00
routing.js 🚚 feat: Route Attachments and Provision Tools Lazily (#15763) 2026-09-08 23:28:52 -04:00
saveBase64Image.spec.js
strategies.js