mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-11-16 13:00:55 +00:00
* fix: Let Queued User Turns Go Before Completion Wake-ups at Run End When a run ends with both a server-owned queued user turn and a background or subagent completion wake-up waiting on it, the wake-up was expedited at generation settlement while the queued turn sat out its five-second readiness re-check, so the wake-up claimed the predecessor fence first and the user's turn waited behind a whole automated turn. - Generation settlement now also expedites the conversation's queued-turn deliveries. - Background and subagent wake-ups defer without consuming an attempt while a queued turn holds an unexpired claim or is the due lane head, then run after it, chained to its response. - hasPendingAgentQueuedTurn answers false for rows that need recovery or a user decision (reservations, expired claims, indeterminate admissions, dead heads awaiting dismissal), so a stuck queued turn never holds a wake-up. The read runs in parallel with the existing conversation read and fails open. - Readiness deferral logs now carry the execution error code. * fix: Read Queued-Turn Precedence in Claim Order and Defer on Unknown State - Read the live claim after the head read settles, so a queued -> claimed transition between the two reads cannot answer false. - Take plain identifiers in hasPendingAgentQueuedTurn and convert the user id inside data-schemas, keeping Mongoose types out of packages/api. - A failed precedence read now defers the wake-up without consuming an attempt (QUEUED_TURN_STATE_UNAVAILABLE) instead of proceeding. * fix: Read the Active Queued-Turn Lane in One Query A claim released back to `queued` between the head read and the live-claim read could still answer false. Read the reserving, queued and claimed rows in one query over the capacity index, whose `activeSlot` key holds steady from reservation until a terminal state, so each row is seen exactly once in one state. Dead heads and indeterminate quarantines stay separate indexed reads in parallel. Falls back to a planner-chosen read when the capacity index has not been built yet. * fix: Fall Back to a Planner Read Whenever the Lane Hint Is Refused A hint can be refused for reasons other than a missing index on some engines. The hinted read only pins the stable key, so any refusal now retries unhinted; a genuine outage fails that read too and defers the wake-up. * fix: Read Queued-Turn Blockers After the Turn They Block The precedence read gathered the active lane, the dead lane head and the indeterminate quarantine in parallel, so a blocker could be older than the queued turn it blocked. A dead head dismissed while the reads were in flight still answered false and let a completion wake-up race the successor it had just unblocked. Read the active lane first, and the blockers (a reservation, an expired claim, an indeterminate admission, a dead row ahead of the head) only afterwards and only for a due head, in one existence query. A blocker that has already cleared no longer answers false, and a conversation with no due queued turn now costs one read instead of three. |
||
|---|---|---|
| .. | ||
| api | ||
| chat | ||
| client | ||
| data-provider | ||
| data-schemas | ||