LibreChat/api/server
Claude d6cc015cac
fix(schedules): repair the deletion CLI and order restore before the fence release
Addresses three findings from the fresh Codex review.

P1 — config/delete-user.js called methods.disableUserSchedulesForDeletion, which
Wave B removed in favor of suspendUserSchedulesForDeletion. The file is
@ts-nocheck and its spec mocked the removed name, so neither typecheck nor tests
caught it; the real CLI would throw a TypeError before deleting anything and then
only unwind the fence. The CLI now uses the tokenized protocol: it mints a
suspension token, suspends with it, and restores that exact attempt's rows in its
finally block when the deletion does not commit. Its spec mocks the real methods,
so the breakage can no longer hide.

P2 — both the HTTP controller and the CLI released the user-deletion fence BEFORE
restoring schedules. That fence is what refuses new schedule writes/claims, so the
gap let an owner PATCH edit a still-suspended row and have its enabled/next-run
state overwritten by the older snapshot, and let a second deletion attempt
re-suspend under a new token — making the first restore a no-op and stranding the
disabled snapshot permanently. Restore now runs first, while writes are still
fenced.

Hardening for the same defect class across a crash: suspendUserSchedulesForDeletion
now ADOPTS an existing suspension's snapshot when re-suspending a row abandoned by
an earlier attempt, instead of re-capturing the row's current (already-suspended)
state. Without this, an attempt that died before restoring would have its
successor snapshot "disabled, no next run" and permanently strand the schedule.

Tests: CLI restore-before-fence ordering and no-restore-on-success; the same
ordering assertion on both controller post-quiesce failure paths; a data-method
regression that a second attempt adopts the abandoned snapshot and restores the
original enabled/next-run state.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CZwZPDBgxy4mCWWg6zQSjq
2026-08-18 19:59:51 +00:00
..
controllers fix(schedules): repair the deletion CLI and order restore before the fence release 2026-08-18 19:59:51 +00:00
middleware refactor: rebuild scheduled chats on durable agent triggers 2026-08-18 07:48:58 -04:00
routes fix(schedules): Wave B.2 — wire the interactive Stop persistence protocol 2026-08-18 18:39:47 +00:00
services fix(schedules): Wave C.1 — reconcile durable trigger delivery with the reservation 2026-08-18 19:03:25 +00:00
utils 🧵 feat: Persist View-Only Subagent Threads (#14957) 2026-08-18 07:41:42 -04:00
cleanup.js 🧹 refactor: Tighten Config Schema Typing and Remove Deprecated Fields (#12452) 2026-03-29 01:10:57 -04:00
experimental.js fix(schedules): Wave A — null-balance CAS, atomic paused-card clear, clustered erasure sweep 2026-08-18 18:04:18 +00:00
experimental.spec.js fix(schedules): Wave A — null-balance CAS, atomic paused-card clear, clustered erasure sweep 2026-08-18 18:04:18 +00:00
index.js Merge remote-tracking branch 'origin/dev' into pr14939-work 2026-08-18 08:15:46 -04:00
index.metrics.spec.js test: isolate scheduler startup in server specs 2026-08-18 07:48:58 -04:00
index.spec.js test: isolate scheduler startup in server specs 2026-08-18 07:48:58 -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