Found while testing resumeStream for LibreChat-AI#16609.
When the stream status route answers a running job without resumeState, useResumeOnLoad builds a minimal resume submission whose initialResponse is { messageId: 'resume_', conversationId, text: '', content } with no isCreatedByUser (client/src/hooks/SSE/useResumeOnLoad.ts, the else branch that sets resumeStreamId). If the reattached stream then delivers a server-written error event, errorHandler builds the error turn from that initialResponse and tMessageSchema.parse throws a ZodError (isCreatedByUser required) in parseErrorResponse (client/src/hooks/SSE/useEventHandlers.ts). The error card is never written and the pane stays submitted.
Reproduce: in client/src/hooks/Chat/__tests__/transport.spec.tsx (resume block), answer the status read with { active: true, streamId, status: 'running', createdAt } and no resumeState, call resumeStream(), then emit { type: 'error', data: { message: 'x' } } on the reattached stream.
Current servers send resumeState for running jobs, so this needs an older server or a status without it. Fix: give the minimal initialResponse isCreatedByUser: false (and a parent), and cover the error path in that spec.
Found while testing
resumeStreamfor LibreChat-AI#16609.When the stream status route answers a running job without
resumeState,useResumeOnLoadbuilds a minimal resume submission whoseinitialResponseis{ messageId: 'resume_', conversationId, text: '', content }with noisCreatedByUser(client/src/hooks/SSE/useResumeOnLoad.ts, theelsebranch that setsresumeStreamId). If the reattached stream then delivers a server-written error event,errorHandlerbuilds the error turn from thatinitialResponseandtMessageSchema.parsethrows a ZodError (isCreatedByUserrequired) inparseErrorResponse(client/src/hooks/SSE/useEventHandlers.ts). The error card is never written and the pane stayssubmitted.Reproduce: in
client/src/hooks/Chat/__tests__/transport.spec.tsx(resume block), answer the status read with{ active: true, streamId, status: 'running', createdAt }and noresumeState, callresumeStream(), then emit{ type: 'error', data: { message: 'x' } }on the reattached stream.Current servers send
resumeStatefor running jobs, so this needs an older server or a status without it. Fix: give the minimalinitialResponseisCreatedByUser: false(and a parent), and cover the error path in that spec.