LibreChat/api/server/services
Danny Avila 5f094cefe6 fix: harden lifecycle review round 1 (P1 resume slot + topology wiring)
Adversarial review of abaae9a7f confirmed 13 findings; fix the P1 and the
higher-value P2/P3 ones:

- P1 (resume slot ownership): reserveScheduledResume promoted the run to
  'started' BEFORE the approval claim, so the reserve-winner and claim-winner
  could diverge and a claim-loser would flip the claim-winner's active row back
  to requires_action (breaking the single-active invariant mid-generation).
  Split into a read-only checkScheduledResume (overlap/capacity) BEFORE the claim
  (keeps the approval claimable) and promoteScheduledResume AFTER the claim is
  won, so only the run's driver ever owns the slot. Removed the release race.

- P2 (topology wiring dead in production): api/server/index.js called
  initializeScheduleEngine() with no clustered flag, so isJobStoreShared was
  always true and a horizontally-replicated in-memory-stream deployment would
  reap peers' live runs. index.js now passes clustered=USE_REDIS; experimental.js
  passes clustered=(workers>1) instead of USE_REDIS.

- P2 (manual run-now fencing gap): manual fires skipped revalidateClaim, so a
  delete/edit landing after acquireManualRunLease still dispatched. revalidateClaim
  now takes requireEnabled; the manual path revalidates (delete/edit fenced),
  only relaxing the enabled check.

- P3 (soft-deleted schedule leaks through reads/edits/claims): getScheduleById,
  updateScheduleById, and claimDueSchedule now exclude deleting schedules.

- P3 (account-deletion job leak): quiesceUserSchedules aborts without
  preserveForReconcile (its run rows are hard-deleted, so nothing reconciles),
  while per-schedule delete keeps preserve=true.

Accepted residuals (documented): clustered-in-memory orphan reaping limits
(mitigated by the topology fix), narrow Redis TOCTOU on reconcile delete, and
the pre-revalidate skip-bookkeeping chip — all P3, self-healing or topology-gated.
2026-07-22 10:05:15 -04:00
..
__tests__ 🙋 feat: ask_user_question - agent-initiated questions with durable pause/resume (#14139) 2026-07-08 15:31:05 -04:00
Agents 📇 feat: Agent Contact Visibility with Owner Fallback (#13663) 2026-06-25 15:58:15 -04:00
Artifacts 🧵 fix: Preserve Fenced Markdown Artifacts (#14121) 2026-07-05 12:04:59 -04:00
Config ⚙️ perf: reduce first-load MongoDB round trips (#14101) 2026-07-06 09:36:34 -04:00
Endpoints 🖼️ feat: Return Sandbox Images From read_file as Viewable Artifacts (#14277) 2026-07-16 07:27:33 -04:00
Files 🚏 fix: Route Admin-Configured Document Types to RAG /text on Agent Upload (#14345) 2026-07-20 22:46:28 -04:00
Runs 🧹 chore: Cleanup Logger and Utility Imports (#9935) 2025-10-01 23:30:47 -04:00
Schedules fix: harden lifecycle review round 1 (P1 resume slot + topology wiring) 2026-07-22 10:05:15 -04:00
Skills 🧬 feat: Add GitHub Skill Sync (#13293) 2026-06-10 21:05:54 -04:00
start 🙋 feat: ask_user_question - agent-initiated questions with durable pause/resume (#14139) 2026-07-08 15:31:05 -04:00
Threads 🪪 fix: Scope Message Conversation Access (#13183) 2026-05-18 17:34:30 -04:00
Tools 🃏 fix: Attach Request-Scoped MCP Servers From the Builder via the mcp_all Wildcard (#14177) 2026-07-12 08:10:01 -04:00
ActionService.js fix: Extend and Decouple MCP OAuth Flow Timeouts (#13622) 2026-06-09 17:50:02 -04:00
ActionService.spec.js ⚗️ feat: Agent Context Compaction/Summarization (#12287) 2026-03-21 14:28:56 -04:00
AssistantService.js 🪦 refactor: Remove Legacy Code (#10533) 2025-12-11 16:36:12 -05:00
AuthService.js 🔡 fix: Normalize Email Case When Issuing Verification Tokens (#14172) 2026-07-09 08:42:39 -04:00
AuthService.spec.js 🔡 fix: Normalize Email Case When Issuing Verification Tokens (#14172) 2026-07-09 08:42:39 -04:00
cleanup.js 📦 refactor: Consolidate DB models, encapsulating Mongoose usage in data-schemas (#11830) 2026-03-21 14:28:53 -04:00
createRunBody.js
GraphApiService.js 🪪 feat: Optimized Entra ID Group Sync with Auto-Creation (#12606) 2026-04-13 08:50:52 -04:00
GraphApiService.spec.js 🧵 refactor: Migrate Endpoint Initialization to TypeScript (#10794) 2025-12-11 16:37:16 -05:00
GraphTokenService.js 🔒 feat: Add On-Behalf-Of (OBO) token exchange support for MCP Servers (#13429) 2026-06-01 22:36:18 -04:00
initializeMCPs.js 🔐 fix: Honor Admin-Panel MCP Allowlist Overrides Without Restart (#13814) 2026-06-17 20:14:53 -04:00
initializeMCPs.spec.js 🔐 fix: Honor Admin-Panel MCP Allowlist Overrides Without Restart (#13814) 2026-06-17 20:14:53 -04:00
initializeOAuthReconnectManager.js
MCP.js 🧵 feat: Background Tool Calls for Agents & Model Specs (#14197) 2026-07-13 12:51:36 -04:00
MCP.spec.js 🤫 refactor: Silent MCP OAuth Refresh on Mid-Session 401 (#13369) 2026-06-10 13:12:42 -04:00
MCPRequestContext.js 🪢 fix: Tie MCP Cleanup To Resumable Runs (#13769) 2026-06-15 15:26:03 -04:00
OboPolicyService.js 🔒 feat: Add On-Behalf-Of (OBO) token exchange support for MCP Servers (#13429) 2026-06-01 22:36:18 -04:00
OboTokenService.js 🔒 feat: Add On-Behalf-Of (OBO) token exchange support for MCP Servers (#13429) 2026-06-01 22:36:18 -04:00
OboTokenService.spec.js 🔒 feat: Add On-Behalf-Of (OBO) token exchange support for MCP Servers (#13429) 2026-06-01 22:36:18 -04:00
PermissionService.js 🚪 fix: Keep Owners From Being Locked Out of Their Own Resource When Sharing (#14347) 2026-07-20 22:27:25 -04:00
PermissionService.spec.js 🚪 fix: Keep Owners From Being Locked Out of Their Own Resource When Sharing (#14347) 2026-07-20 22:27:25 -04:00
PluginService.js
systemGrant.spec.js 📜 feat: Implement System Grants for Capability-Based Authorization (#11896) 2026-03-21 14:28:54 -04:00
ToolService.js 🧵 feat: Background Tool Calls for Agents & Model Specs (#14197) 2026-07-13 12:51:36 -04:00
twoFactorService.js 🔑 fix: Require OTP Verification for 2FA Re-Enrollment and Backup Code Regeneration (#12223) 2026-03-14 01:51:31 -04:00