mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-08-04 14:57:42 +00:00
fix: cap agent abort and disconnect partial saves to the parent expiry
The agents /chat/abort endpoint and the resumable disconnect handler save a partial response through saveMessage without saveConvo following, but did not pass capExpiryToConversation. In an ephemeral deployment with a parent that already has an earlier active expiredAt, the partial response got a freshly computed later deadline and outlived its conversation. Pass the same cap metadata used by the other message-only abort path so the partial response cannot outlive its parent. If generation later completes, the normal response-end save re-stamps the message with a fresh deadline.
This commit is contained in:
parent
fd8292669d
commit
6ab4400ace
3 changed files with 9 additions and 2 deletions
|
|
@ -315,7 +315,10 @@ const ResumableAgentController = async (req, res, next, initializeClient, addTit
|
|||
interfaceConfig: req?.config?.interfaceConfig,
|
||||
},
|
||||
partialMessage,
|
||||
{ context: 'api/server/controllers/agents/request.js - partial response on disconnect' },
|
||||
{
|
||||
context: 'api/server/controllers/agents/request.js - partial response on disconnect',
|
||||
capExpiryToConversation: true,
|
||||
},
|
||||
);
|
||||
|
||||
logger.debug(
|
||||
|
|
|
|||
|
|
@ -285,6 +285,7 @@ describe('Agent Abort Endpoint', () => {
|
|||
}),
|
||||
expect.objectContaining({
|
||||
context: 'api/server/routes/agents/index.js - abort endpoint',
|
||||
capExpiryToConversation: true,
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -313,7 +313,10 @@ router.post('/chat/abort', configMiddleware, async (req, res) => {
|
|||
interfaceConfig: req?.config?.interfaceConfig,
|
||||
},
|
||||
responseMessage,
|
||||
{ context: 'api/server/routes/agents/index.js - abort endpoint' },
|
||||
{
|
||||
context: 'api/server/routes/agents/index.js - abort endpoint',
|
||||
capExpiryToConversation: true,
|
||||
},
|
||||
);
|
||||
logger.debug(`[AgentStream] Saved partial response for: ${jobStreamId}`);
|
||||
} catch (saveError) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue