LibreChat/api/server/controllers/agents
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__ fix: Codex round 11 — pause recording, resume/abort preserve, Redis preserve TTL 2026-07-21 23:56:03 -04:00
callbacks.js 🙊 refactor: Clarify Ask Question Schema Errors and Retry Guidance (#14279) 2026-07-15 11:06:29 -04:00
client.js fix: address deep review — indexes, redis metadata, capacity, crash-retry, cascade (14 findings) 2026-07-21 20:13:15 -04:00
client.test.js 🪝 feat: Human-in-the-Loop Runtime - Tool Approval + Ask-User-Question (Slice B) (#13942) 2026-06-29 16:56:41 -04:00
errors.js 📦 refactor: Consolidate DB models, encapsulating Mongoose usage in data-schemas (#11830) 2026-03-21 14:28:53 -04:00
filterAuthorizedTools.spec.js 🧠 feat: Add Memory as an Agent Capability with Inline Tools and Ephemeral Badge (#13869) 2026-06-24 17:14:13 -04:00
openai.js 🧵 feat: Background Tool Calls for Agents & Model Specs (#14197) 2026-07-13 12:51:36 -04:00
recordCollectedUsage.spec.js 🪢 chore: Consolidate Pricing and Tx Imports After tx.js Module Removal (#12086) 2026-03-21 14:28:53 -04:00
request.js fix: Codex round 14 — durable conversationId, manual lease, limiter/refill/expiry 2026-07-22 01:39:16 -04:00
responses.js 🧵 feat: Background Tool Calls for Agents & Model Specs (#14197) 2026-07-13 12:51:36 -04:00
resume.js fix: harden lifecycle review round 1 (P1 resume slot + topology wiring) 2026-07-22 10:05:15 -04:00
steer.js 🧭 feat: Mid-Run Steering and Queued Messages for Agent Runs (#14220) 2026-07-14 10:11:10 -04:00
v1.js 🧊 fix: Include Conversation Starters in Agent View and List Responses (#14142) 2026-07-08 12:54:54 -04:00
v1.spec.js 🧊 fix: Include Conversation Starters in Agent View and List Responses (#14142) 2026-07-08 12:54:54 -04:00