mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-07-02 12:22:22 +00:00
test: Stabilize HITL abort fallback specs
This commit is contained in:
parent
58c18e720e
commit
8dc4e2da57
2 changed files with 9 additions and 3 deletions
|
|
@ -74,6 +74,10 @@ describe('Agent Abort Endpoint', () => {
|
|||
|
||||
beforeEach(() => {
|
||||
jest.clearAllMocks();
|
||||
mockGenerationJobManager.getJob.mockReset();
|
||||
mockGenerationJobManager.abortJob.mockReset();
|
||||
mockGenerationJobManager.getActiveJobIdsForUser.mockReset();
|
||||
mockSaveMessage.mockReset();
|
||||
});
|
||||
|
||||
describe('POST /chat/abort', () => {
|
||||
|
|
@ -325,7 +329,6 @@ describe('Agent Abort Endpoint', () => {
|
|||
describe('Job Not Found', () => {
|
||||
it('should skip paused fallback jobs and abort the running job', async () => {
|
||||
mockGenerationJobManager.getJob
|
||||
.mockResolvedValueOnce(null)
|
||||
.mockResolvedValueOnce({
|
||||
status: 'requires_action',
|
||||
metadata: { userId: 'test-user-123' },
|
||||
|
|
@ -355,7 +358,7 @@ describe('Agent Abort Endpoint', () => {
|
|||
});
|
||||
|
||||
it('should not abort paused fallback jobs', async () => {
|
||||
mockGenerationJobManager.getJob.mockResolvedValueOnce(null).mockResolvedValueOnce({
|
||||
mockGenerationJobManager.getJob.mockResolvedValueOnce({
|
||||
status: 'requires_action',
|
||||
metadata: { userId: 'test-user-123' },
|
||||
});
|
||||
|
|
|
|||
|
|
@ -231,7 +231,10 @@ router.post('/chat/abort', async (req, res) => {
|
|||
// streamId === conversationId, so try any of the provided IDs
|
||||
// Skip "new" as it's a placeholder for new conversations, not an actual ID
|
||||
let jobStreamId =
|
||||
streamId || (conversationId !== 'new' ? conversationId : null) || abortKey?.split(':')[0];
|
||||
streamId ||
|
||||
(conversationId !== 'new' ? conversationId : null) ||
|
||||
abortKey?.split(':')[0] ||
|
||||
null;
|
||||
let job = jobStreamId ? await GenerationJobManager.getJob(jobStreamId) : null;
|
||||
|
||||
// Fallback: if job not found and we have a userId, look up active jobs for user
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue