LibreChat/client/src/data-provider
Danny Avila deda142d58
🗓️ fix: Refresh the Sidebar When a Scheduled Run Fires or Settles (#15631)
* 🗓️ fix: Refresh the Sidebar When a Scheduled Run Fires or Settles

An automatic occurrence is the one generation nothing in the client starts,
so no submission, stream or event handler tells the sidebar its chat exists,
and the conversation list's five-minute staleness leaves it out of a tab
that stays focused.

The schedules panel is already polling for its cards, and `lastRun` moves at
exactly the two moments the list should be re-read — a fire adds a chat, a
settlement retitles and reorders it — so read the refresh out of that poll
rather than adding one. Only transitions refresh; a schedule first seen is
recorded in silence, so a panel opened long after a run does not refetch a
list that has held its chat all along.

This also settles the row Run Now seeds: the schedule's own completion is
what replaces the schedule name with the generated title.

* 🗓️ fix: Name the Running Occurrence's Chat So the Sidebar Can Fetch It

Four review rounds each found a new way the schedule projection diverges
from the run it stands in for: `lastRun` is not written at fire, `nextRunAt`
moves before the conversation exists, and an edit mid-flight fences the
terminal write so `lastRun` never changes at settlement. Nothing on a
schedule document means "this run's chat is listable now", so every signal
read from one was too early or too late.

Stop inferring. The list handler already reads the user's schedules and
limits in parallel; read their active run rows alongside — one user-scoped
query, joined by schedule id — and project the running occurrence's
conversation id as `activeRun`. It comes from the run's own row, so the
configRevision fence on the schedule projection cannot hide it, and it is
absent until dispatch has actually reserved a conversation.

The panel hook then hands every id the list names to the same admission
watch Run Now uses, which probes until the server has the chat and adds the
server's own row: one mechanism for both paths, idempotent per id. A run
leaving the list has settled, and the list is re-read once for the order
its settlement changed.

* 🗓️ fix: Fetch Every Chat the Schedule List Names, and Scope the Run Read

Three from codex on the rebuilt design.

A run short enough to start and settle between two polls is never seen
running, and most scheduled chats are short. The list also names the chat
the last occurrence produced, so the panel now fetches every chat the list
names that it has not seen — active or settled — through the same admission
watch. The first observation still fetches only runs in flight: a panel
opened long after a run must not go and fetch history.

Project every running occurrence rather than the latest. A `requires_action`
pause does not block the next occurrence, so a schedule can hold two, and
reducing to one hid the pause's settlement. This also deletes the picker.

The single-schedule route's run read started before ownership was known and
was scoped only by schedule id. The response was gated, but a speculative
read must stay scoped to the caller: use the user-bound query the list uses
and narrow it, rather than touch rows the caller may not own.

* 🗓️ fix: Let One Layer Decide What to Watch, and Say Which Runs Are Generating

Two from codex on the previous round.

The admission watch forgets a run whose delivery outlasted its budget so a
later announcement can retry, but the panel kept its own permanent record of
every id it had handed over and never announced one twice — so that retry
could never happen. Drop the panel's record: every chat the list names is
handed to the watch on every observation, and the watch is the one place
that decides whether an id is landed, in flight, or worth trying again.

The one thing the panel still must not do is fetch history. Opening it used
to start a watch per active occurrence, and a run parked on an approval can
sit there indefinitely and accumulate, its chat listed long ago. Carry each
occurrence's status on the wire, and on the first observation treat only a
generating occurrence as in flight; a settled one and a paused one are
history, and a pause resolving later still re-reads the list.

* 🗓️ fix: Read Only Generating Runs for the List, and Hand Over Only Those

Three from codex, and this round removes more than it adds.

The list's run read returned every paused row, unbounded, on each poll.
`ScheduleRun` is indexed by status rather than by user, `requires_action`
rows accumulate for as long as their approvals wait, and `started` rows are
bounded globally by the capacity slots — so the read now asks for `started`
alone, through an optional status narrowing on the existing method. A pause
resolving is still seen through `lastRun`; what this gives up is only the
corner where that projection is fenced by a mid-flight edit.

A run that failed during initialization settles with its reserved id but
never writes a conversation, so its route answers 404 for good — and handing
settled ids to the watch meant re-probing it every poll, forever. The watch
only ever needed generating runs: a settled one is already covered by the
list re-read its settlement triggers, which brings the server's own row.

A deleted schedule leaves the list, and comparing only the schedules still
present missed the abort-and-settle that deletion performs on its run. A
schedule vanishing now counts as its state moving.

* 🗓️ fix: Compare a New Schedule Against Idle, and Bound the Landed-Run Record

Two from codex on the head GitHub replayed onto dev.

A schedule created in another tab can arrive in this client's list with its
first run already settled, and a comparison that walks only the schedules
seen before never looked at it. Compare a newcomer against the idle state:
one that arrives with a run behind it is news the list should hear, one
that arrives with no run yet is not.

The watch remembers every run it landed so a later announcement is a no-op,
and a panel that stays mounted sees a new id per occurrence for as long as
schedules keep firing. Keep the most recent 256: a run is announced only
while in flight, and none is still in flight by the time that many have
started after it, so the oldest can go without a watch ever running twice.

* 🗓️ fix: Re-read on First Sight Only When a Run Outran the Sidebar, and Never Evict a Live Watch

Two from codex.

"The first observation is silent" assumed the sidebar's lists had been read
after any run they should hold, and that is not guaranteed: open the panel
after a run fired and finished with it closed, and the card says the run
succeeded while the sidebar was read before it ever fired. The first
observation has no earlier one to compare against, so compare against the
sidebar instead — re-read only if some run fired after the lists were last
read, which is precisely the case where they lack its chat, and stay silent
otherwise.

The landed-run cap assumed fewer than 256 generations could be in flight at
once, and the config schema bounds neither maxPerUser nor fireConcurrency.
Keep in-flight watches in their own set, bounded by real concurrency and
never evicted — a second watch for a run still being watched is the one
thing that set exists to prevent — and cap only the landed record, where a
forgotten id costs at most one extra probe.

* 🗓️ fix: Re-read on First Sight When Anything Has Run, Release Runs the List Drops, Observe Every Poll

Three from codex, each a defect in an earlier fix, and each answered by
removing something.

Comparing a run's fire time against the list cache's `dataUpdatedAt` was
measuring cache writes, not server reads: a foreground chat inserted after
the run advanced the stamp without adding the scheduled chat. There is no
timestamp for "last read from the server", so stop guessing — the first
observation re-reads if any schedule has run at all, and one refetch on
opening the panel is the honest price.

A run can be landed and still generating for minutes, announced on every
poll; a count cap evicted it and restarted its probes. The hook is the one
place that sees an occurrence leave the list, so it releases the id then,
and the watch remembers a run exactly as long as something can announce it.
No cap.

React Query hands back the same array for a deep-equal poll, so an effect
keyed on the data never ran again while a run stayed in flight — and a watch
that gave up was never asked to try again. Key on the poll's timestamp.

* fix: Release Scheduled Run Retention Across Admission and Unmount 🧹
2026-09-06 15:28:11 -04:00
..
__tests__ 🗓️ fix: Refresh the Sidebar When a Scheduled Run Fires or Settles (#15631) 2026-09-06 15:28:11 -04:00
Agents ⚡ perf: Agent List and Model Selector at Scale (#14601) 2026-08-07 21:04:55 -04:00
Auth 🥚 refactor: Default Agents to Preferred Stateful Workspace Scope (#14908) 2026-08-16 22:31:01 -04:00
Endpoints 🏷️ fix: Model Spec Menu Label and Agent Avatar Fallbacks (#14887) 2026-08-16 11:04:25 -04:00
Files ✏️ feat: Edit Pasted Text and Clear It on New Chat (#15017) 2026-08-25 20:06:59 -04:00
Insights 💡 feat: add DB-backed admin insights (#14898) 2026-08-18 07:51:51 -04:00
Langfuse 🪢 feat: add Langfuse session links (#14776) 2026-08-12 22:25:23 -04:00
MCP
Memories 🛂 feat: Filter Model-Bound Content by Source (#14425) 2026-08-21 22:43:32 -04:00
Messages 📉 perf: start message queries before file map loads (#14188) 2026-07-12 07:54:32 -04:00
Misc
Projects 📌 fix: Fetch Pinned Chats Independently of the Chats List (#14860) 2026-08-16 11:28:33 -04:00
Schedules 🗓️ fix: Refresh the Sidebar When a Scheduled Run Fires or Settles (#15631) 2026-09-06 15:28:11 -04:00
Skills 🧩 fix: Harden Agent Skill Lifecycles End to End (#14429) 2026-07-25 08:19:12 -04:00
SSE 🐝 fix: Keep Polling for Owed Agent Successors (#15537) 2026-09-03 13:23:19 -04:00
Subagents 🔌 refactor: Give the Subagent Surface a Host Seam and Its Own Jotai State (#15455) 2026-09-01 11:15:42 -04:00
Tools
CodeEnvironments.ts 🛰️ feat: Show BYOM Worker Readiness (#15618) 2026-09-04 19:02:35 -04:00
connection.ts
Favorites.ts
index.ts 🛞 feat: Manage Personal Code Environment Lifecycles (#15369) 2026-09-01 21:10:05 -04:00
mutations.ts 🗄️ feat: Archive All Chats From Data Controls (#14885) 2026-08-16 22:11:57 -04:00
prompts.ts
queries.ts 📌 fix: Fetch Pinned Chats Independently of the Chats List (#14860) 2026-08-16 11:28:33 -04:00
roles.ts
tags.ts