LibreChat/api/server
Danny Avila f616bed333 🔒 fix: Renew the /files/usage hold across queued runs, under a ceiling
Codex review on 2bd3c52.

The drain sends one queued item per run completion, and each item starts a
run that may itself pause for the full approval window. Since the hold was
taken once at enqueue and pinned to the upload time, an item several places
back could sit through multiple approval windows and lose its attachment
while its chip and the live approval were still there. Another regression
from this PR: the old `$unset` made retention permanent, so deep queues
happened to work.

The queue is unbounded, so no fixed lifetime covers it. Split the hold into
a renewable window and a ceiling:

  expiresAt = max(expiresAt, min(now + renewMs, createdAt + maxLifetimeMs))

`renewMs` covers one run's wait and is granted from now, so a queue that is
still draining re-asserts it at each transition; `useQueueDrain` now marks
the remaining items' files whenever it pops one. `maxLifetimeMs` is
measured from the immutable upload time and clamps every renewal, so
repeated touches converge on a ceiling instead of advancing per call, which
keeps the replay bound from the previous round intact.

This also tightens abandonment: a queue nobody drains now lapses one
`renewMs` after its last touch instead of surviving to the ceiling.

`useQueueDrain`'s spec gained a QueryClientProvider, since the renewal goes
through react-query.
2026-07-27 22:53:03 -04:00
..
controllers 🔗 fix: Resolve MCP Tool-Key Boundary Against Configured Server Names (#14448) 2026-07-27 14:45:38 -04:00
middleware 🔒 fix: Bound /files/usage TTL Hold Instead of Clearing It 2026-07-27 19:09:10 -04:00
routes 🔒 fix: Renew the /files/usage hold across queued runs, under a ceiling 2026-07-27 22:53:03 -04:00
services 🔗 fix: Resolve MCP Tool-Key Boundary Against Configured Server Names (#14448) 2026-07-27 14:45:38 -04:00
utils 🔄 feat: Continue Shared Conversations as Personal Copies (#13714) 2026-06-24 16:27:01 -04:00
cleanup.js 🧹 refactor: Tighten Config Schema Typing and Remove Deprecated Fields (#12452) 2026-03-29 01:10:57 -04:00
experimental.js perf: Reduce Agent Chat Startup Latency (#14423) 2026-07-25 07:58:20 -04:00
index.js perf: Reduce Agent Chat Startup Latency (#14423) 2026-07-25 07:58:20 -04:00
index.metrics.spec.js ⚖️ feat: Add Operational Prometheus Metrics (#13265) 2026-05-22 20:47:41 -04:00
index.spec.js perf: Reduce Agent Chat Startup Latency (#14423) 2026-07-25 07:58:20 -04:00
socialLogins.js feat: Make OpenID Token Reuse Window Configurable (#13546) 2026-06-06 15:15:58 -04:00
socialLogins.spec.js feat: Make OpenID Token Reuse Window Configurable (#13546) 2026-06-06 15:15:58 -04:00
telemetry.js 📡 feat: Add Backend OpenTelemetry Tracing (#12909) 2026-05-14 09:08:55 -04:00
telemetry.spec.js 📡 feat: Add Backend OpenTelemetry Tracing (#12909) 2026-05-14 09:08:55 -04:00