LibreChat/api/server/routes
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
..
__test-utils__ 🔑 feat: Let Users Connect Their Own Account for Pull Request Lookups (#16989) 2026-10-12 15:58:23 +02:00
__tests__ 🙊 fix: Keep API Keys and Internal Errors Out of Logs and Responses (#17258) 2026-10-19 21:36:46 +02:00
admin 🗂️ feat: Audit MCP, Code Worker, Langfuse, Skill Credential, Passkey and Audit Log Access (#17054) 2026-10-15 00:30:26 +02:00
agents 🔌 feat: Integrate Durable Skill Lifecycle Across Writers and Routes (#17043) 2026-10-16 09:05:05 -07:00
assistants 📿 fix: Inspect Stored File Locators Per Message (#15841) 2026-09-11 16:47:48 -04:00
files 🧯 fix: Close Abandoned Download and Speech Streams and Cap Speech Input (#17270) 2026-10-19 22:20:40 +02:00
accessPermissions.js 🛂 feat: Audit Resource Sharing Changes and Fail Closed on Reversible Audit Writes (#17053) 2026-10-15 00:30:16 +02:00
accessPermissions.sharePolicy.test.js 🛂 feat: Audit Resource Sharing Changes and Fail Closed on Reversible Audit Writes (#17053) 2026-10-15 00:30:16 +02:00
accessPermissions.test.js
actions.js
apiKeys.js
auth.2fa-ratelimit.test.js 🔐 feat: Enforce Required Two-Factor Authentication (#14731) 2026-10-01 23:39:51 +02:00
auth.cloudfront.test.js 🔐 feat: Enforce Required Two-Factor Authentication (#14731) 2026-10-01 23:39:51 +02:00
auth.cross-site.test.js 🔐 feat: Enforce Required Two-Factor Authentication (#14731) 2026-10-01 23:39:51 +02:00
auth.js 🔐 feat: Enforce Required Two-Factor Authentication (#14731) 2026-10-01 23:39:51 +02:00
auth.reset-password-ratelimit.test.js 🔐 feat: Enforce Required Two-Factor Authentication (#14731) 2026-10-01 23:39:51 +02:00
balance.js
banner.js
categories.js
code-environments.js 🧲 feat: Attach or Leave a Workspace on a Saved Chat (#16124) 2026-09-25 10:08:28 -04:00
code-environments.test.js 🧲 feat: Attach or Leave a Workspace on a Saved Chat (#16124) 2026-09-25 10:08:28 -04:00
config.js 🙊 fix: Keep API Keys and Internal Errors Out of Logs and Responses (#17258) 2026-10-19 21:36:46 +02:00
convos.js 🔑 feat: Let Users Connect Their Own Account for Pull Request Lookups (#16989) 2026-10-12 15:58:23 +02:00
endpoints.js 🎚️ feat: Filter OpenRouter Reasoning Efforts by the Selected Model (#16808) 2026-10-08 18:04:13 +02:00
index.js 🔑 feat: Let Users Connect Their Own Account for Pull Request Lookups (#16989) 2026-10-12 15:58:23 +02:00
insights.js 🩻 feat(insights): Scope Insights to Authorized Agents (#15549) 2026-09-04 20:16:58 -04:00
keys.js 🔏 fix: Encrypt Provider Keys With v3, Reject Plaintext in decryptV2 and Default to Strong Backup Codes (#17051) 2026-10-13 22:19:37 +02:00
mcp.js 🪢 fix: Restore MCP OAuth Browser Binding (#16634) 2026-10-01 15:25:46 -04:00
memories.js 🧠 fix: Return 400 for Invalid Memory Keys (#14618) 2026-09-06 04:34:06 +02:00
memories.test.js 🧠 fix: Return 400 for Invalid Memory Keys (#14618) 2026-09-06 04:34:06 +02:00
messages.js 🛰️ fix: Route Subagent Files Delivered After a Mid-Run Reload (#17212) 2026-10-18 11:15:55 +02:00
models.js
oauth.js 🧿 fix: Bind Login Flows to the Browser That Started Them (#15880) 2026-09-13 11:47:29 -04:00
oauth.state.test.js 🧿 fix: Bind Login Flows to the Browser That Started Them (#15880) 2026-09-13 11:47:29 -04:00
oauth.test.js 🔐 fix: Redirect OAuth Browser Navigations Instead of Rendering JSON (#15440) 2026-08-31 21:13:47 -04:00
openapi.js 🔌 feat: OpenAPI spec and docs for the public Agents API (#15928) 2026-09-16 13:50:05 -04:00
presets.js 📿 fix: Inspect Stored File Locators Per Message (#15841) 2026-09-11 16:47:48 -04:00
presets.test.js 🛂 feat: Filter Model-Bound Content by Source (#14425) 2026-08-21 22:43:32 -04:00
projects.js 🎒 feat: Carry Project Context Across Conversations (#15684) 2026-10-01 03:46:19 +00:00
prompts.js 🔗 feat: use LibreChat prompt groups as agent instructions (#16686) 2026-10-04 21:27:26 -04:00
prompts.test.js 🔗 feat: use LibreChat prompt groups as agent instructions (#16686) 2026-10-04 21:27:26 -04:00
pullRequests.js 🔑 feat: Let Users Connect Their Own Account for Pull Request Lookups (#16989) 2026-10-12 15:58:23 +02:00
roles.js 📜 feat: Audit Admin Role, Group, Config and IdP Role Mutations (#17052) 2026-10-14 23:57:07 +02:00
rum.js 🔭 feat: Recover Stale Chunks Without the Error Page and Ship Client Logs to RUM (#16701) 2026-10-03 23:17:56 -04:00
schedules.js 🦫 feat: Enforce Scheduled MCP Read-Only Authority (#16681) 2026-10-03 20:39:43 -04:00
search.js
settings.js 📌 feat: Unified Pinned Section With Sidebar Drag Interactions (#15057) 2026-09-11 10:41:05 -04:00
share.js 🪶 perf: Load Tool-Call Previews and Fetch Full Parts on Demand (#16753) 2026-10-05 07:42:45 -04:00
skills.js 🔌 feat: Integrate Durable Skill Lifecycle Across Writers and Routes (#17043) 2026-10-16 09:05:05 -07:00
skills.tenant.test.js 🔌 feat: Integrate Durable Skill Lifecycle Across Writers and Routes (#17043) 2026-10-16 09:05:05 -07:00
skills.test.js 🔌 feat: Integrate Durable Skill Lifecycle Across Writers and Routes (#17043) 2026-10-16 09:05:05 -07:00
static.js
tags.js
traces.js 🔭 feat: Conversation Trace Viewer (#15869) 2026-09-13 00:56:52 -04:00
user.js 📧 feat: add email address change (#14597) 2026-10-01 03:46:16 +00:00
user.verify-ratelimit.test.js 📧 feat: add email address change (#14597) 2026-10-01 03:46:16 +00:00