LibreChat/api/server/controllers/agents/__tests__
Danny Avila 6e964d5897 feat: Scheduled Chats — agent-centric scheduled runs creating real conversations
Squash of the full review-hardened branch (PR 14540, supersedes 14373) onto
latest dev, preserving the exact verified tree. History prior to this commit
lived on the pre-squash branch; every invariant below survived 25 Codex review
rounds plus two external audit rounds (R26) with regression tests that fail
without their fixes.

Feature:
- Schedules CRUD + side-panel UI (cadence dialog, run cards, Run Now), roles/
  permissions (SCHEDULES:USE), interface.schedules availability, per-user limits
  and capacity slots, timezone-aware cadence with DST-conservative floors and
  misfire grace.
- Engine: single-process claim/fire loop with leases, loopback POST dispatch
  (signed schedule-fire JWT claims, per-occurrence idempotency key inside the
  route's clientRequestId charset), overlap/balance/capacity/duplicate skip
  policies with auto-disable streaks (too_many_failures, insufficient_balance),
  reconciliation from retained terminal-job evidence, erasure sweep.
- Scheduled runs create real conversations through the resumable agents chat
  path: HITL pauses surface on the card (requires_action), resumes re-apply the
  fire boundary's admission policy (revision fence, enabled, global kill switch,
  SCHEDULES:USE, availability) before continuing a billed generation.

Correctness invariants (the audit surface):
- Settlement discipline: every persistence-producing write happens-before a
  run's terminal outcome write; Stop/complete/pause race through single-winner
  terminal CAS claims (dev's TerminalJobClaim substrate) with retained,
  completedAt-less evidence for scheduled fires plus an owner-intended outcome
  stamp (scheduleOutcome) the reconciler prefers over re-derived success —
  round-tripped through the Redis hash mapper.
- Swallowed generation failures (client error content parts) classify to
  error/skipped_balance instead of success on both initial and resumed paths;
  stale stamps are refreshed evidence-first when persistence plus the Mongo
  outcome write both fail.
- Abort honesty: delivery judged by generation ownership and the CAS's actual
  from-status; republication escalates to the transport's acknowledged variant;
  the Stop route settles only genuinely paused runs.
- Account deletion: one-way barrier (deletionRequestedAt) with auth-cache
  tombstone-before-stamp, boundary rechecks across all auth strategies, quiesce
  of scheduled + interactive work with durable per-stream abort fences
  (positive-evidence acknowledgement only), owner-side finalization markers for
  post-terminal billed writes, deferred-deletion sweep (explicitly ensured
  partial index) that completes cascades autonomously. Remote OpenAI-compatible/
  Responses requests are documented as outside the quiesce and tracked in issue
  14594.
- Store compatibility: finalization markers optional on the legacy IJobStore
  contract with coherent degradation (registration fails -> synchronous title
  fallback; count reads 0).
2026-08-18 07:46:18 -04:00
..
askUserQuestion.e2e.spec.js feat: Scheduled Chats — agent-centric scheduled runs creating real conversations 2026-08-18 07:46:18 -04:00
callbacks.spec.js 🛤️ feat: Per-Agent Code Execution Routing With Stateful Session Scopes (#14848) 2026-08-16 09:42:15 -04:00
client.contextMetadata.spec.js 🪙 fix: Correct Context Usage Gauge After Summarization (#13744) 2026-06-14 18:23:30 -04:00
client.memory.spec.js 🧰 refactor: Unify code-execution tools (#12767) 2026-04-25 04:02:01 -04:00
client.steerWiring.spec.js 🛑 feat: Preemptive Steer - Backend Interrupt & Steer (#14518) 2026-07-30 12:36:13 -04:00
client.subagentUsage.spec.js 🧵 feat: Persist View-Only Subagent Threads (#14957) 2026-08-18 07:41:42 -04:00
client.transactions.spec.js 🧾 fix: Honor Disabled Transactions on the Token-Count Fallback Path (#14774) 2026-08-12 22:31:13 -04:00
hitlCheckpoint.e2e.spec.js feat: Scheduled Chats — agent-centric scheduled runs creating real conversations 2026-08-18 07:46:18 -04:00
jobReplacement.spec.js feat: Scheduled Chats — agent-centric scheduled runs creating real conversations 2026-08-18 07:46:18 -04:00
modelEndHandler.spec.js 💸 feat: Per-Agent Endpoint Token Config in Multi-Endpoint Billing (#13738) 2026-06-14 12:00:32 -04:00
openai.spec.js 🕸️ feat: Run Saved Agent Teams as Subagents (#14944) 2026-08-17 18:02:52 -04:00
protocol.spec.js ⚡ feat: Reliable Interrupt & Steer Escalation and Recovery (#14558) 2026-07-31 20:07:56 -04:00
request.partialDisconnect.spec.js feat: Scheduled Chats — agent-centric scheduled runs creating real conversations 2026-08-18 07:46:18 -04:00
request.resumeMetadata.spec.js feat: Scheduled Chats — agent-centric scheduled runs creating real conversations 2026-08-18 07:46:18 -04:00
responses.unit.spec.js 🧵 feat: Persist View-Only Subagent Threads (#14957) 2026-08-18 07:41:42 -04:00
resume.spec.js feat: Scheduled Chats — agent-centric scheduled runs creating real conversations 2026-08-18 07:46:18 -04:00
steer.spec.js 🛰️ feat: Execute Generic Agent Trigger Deliveries (#14921) 2026-08-17 08:45:49 -04:00
usageEvents.integration.spec.js 🪙 refactor: Reconcile Context Gauge to Actual Provider Tokens (#13780) 2026-06-16 11:05:44 -04:00
usageEvents.live.spec.js 📊 feat: Real-Time Context Window & Token Usage Tracking (#13670) 2026-06-13 19:38:28 -04:00
v1.duplicate-actions.spec.js 🛡️ refactor: Scope Action Mutations by Parent Resource Ownership (#12237) 2026-03-15 10:19:29 -04:00
v1.spec.js 🕸️ feat: Run Saved Agent Teams as Subagents (#14944) 2026-08-17 18:02:52 -04:00