mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-11-20 06:51:59 +00:00
📮 fix: Count Undelivered Background Results as Outstanding (#16343)
* 📮 fix: Count Undelivered Background Results as Outstanding
* fix: Reconcile delivered tasks, discard exactly, and count pending subagent results
* fix: Settle manually claimed remote deliveries and keep pending controls while wake-ups drain
* fix: Report dead-lettered deliveries as failed and read subagent wake-ups from the durable store
* fix: List restored dead letters and retire deliveries on local durable claims
This commit is contained in:
parent
c6282fa888
commit
34938ebcba
11 changed files with 1527 additions and 19 deletions
|
|
@ -1,9 +1,14 @@
|
|||
const {
|
||||
createBackgroundToolCompletionWakeupHandler,
|
||||
createBackgroundToolDeadClaimRecovery,
|
||||
createPendingBackgroundCompletions,
|
||||
createBackgroundToolResultHandler,
|
||||
claimBackgroundToolResult: claimResult,
|
||||
} = require('@librechat/api');
|
||||
const {
|
||||
listPendingAgentBackgroundToolCompletions,
|
||||
listUndeliveredAgentTriggerTaskIds,
|
||||
} = require('~/models');
|
||||
const {
|
||||
enqueueAgentTrigger,
|
||||
persistAgentBackgroundToolResult,
|
||||
|
|
@ -23,6 +28,12 @@ const preregisterBackgroundToolCompletion = createBackgroundToolCompletionWakeup
|
|||
(deliveryKey) => expediteCompletionWakeups({ deliveryKeys: [deliveryKey] }),
|
||||
);
|
||||
|
||||
const pendingBackgroundToolCompletions = createPendingBackgroundCompletions({
|
||||
list: listPendingAgentBackgroundToolCompletions,
|
||||
listTaskIds: listUndeliveredAgentTriggerTaskIds,
|
||||
retire: retireAgentTrigger,
|
||||
});
|
||||
|
||||
function createBackgroundToolResultPersistence({ req, updateToolCallResult }) {
|
||||
return createBackgroundToolResultHandler({ req, updateToolCallResult });
|
||||
}
|
||||
|
|
@ -46,6 +57,7 @@ function createDeadBackgroundToolClaimRecovery(
|
|||
|
||||
module.exports = {
|
||||
preregisterBackgroundToolCompletion,
|
||||
pendingBackgroundToolCompletions,
|
||||
createBackgroundToolResultPersistence,
|
||||
claimBackgroundToolResult,
|
||||
createDeadBackgroundToolClaimRecovery,
|
||||
|
|
|
|||
|
|
@ -94,6 +94,7 @@ const { processAddedConvo } = require('./addedConvo');
|
|||
const subagentThreadTaskStore = require('./subagentThreadStore');
|
||||
const {
|
||||
preregisterBackgroundToolCompletion,
|
||||
pendingBackgroundToolCompletions,
|
||||
createBackgroundToolResultPersistence,
|
||||
claimBackgroundToolResult,
|
||||
createDeadBackgroundToolClaimRecovery,
|
||||
|
|
@ -517,6 +518,8 @@ const initializeClientWithProvider = async ({
|
|||
}),
|
||||
backgroundToolCompletion: {
|
||||
...(completionWakeupsEnabled ? { preregister: preregisterBackgroundToolCompletion } : {}),
|
||||
/** Deliveries admitted before wake-ups were disabled still drain and still count. */
|
||||
pending: pendingBackgroundToolCompletions,
|
||||
persist: createBackgroundToolResultPersistence({
|
||||
req,
|
||||
updateToolCallResult: db.updateToolCallResult,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue