Merge pull request #1225 from buster-so/wells-bus-2004-fix-todos-step-erroring-without-throwing-an-error

Fixing the todo step to throw llm errors if the model throws an error
This commit is contained in:
wellsbunk5 2025-09-30 14:57:17 -06:00 committed by GitHub
commit ec1c90138a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 4 deletions

View File

@ -102,6 +102,10 @@ async function generateTodosWithLLM(
messages: todosMessages, messages: todosMessages,
temperature: 0, temperature: 0,
providerOptions: DEFAULT_ANTHROPIC_OPTIONS, providerOptions: DEFAULT_ANTHROPIC_OPTIONS,
onError: (error) => {
console.info('LLM error while generating todos', error);
throw new Error('LLM error while generating todos');
},
}); });
// Process text deltas for optimistic updates // Process text deltas for optimistic updates
@ -111,11 +115,8 @@ async function generateTodosWithLLM(
} }
})(); })();
// Wait for the final object
const result = await object;
// Ensure all delta processing is complete before finalizing // Ensure all delta processing is complete before finalizing
await deltaProcessing; const [_, result] = await Promise.all([deltaProcessing, object]);
// Finalize the reasoning message // Finalize the reasoning message
await onStreamFinish(result); await onStreamFinish(result);