Improve workflow error messaging

This commit is contained in:
2026-03-09 23:51:37 -04:00
parent fa2de3e259
commit f2c25fb9c6
11 changed files with 272 additions and 41 deletions

View File

@@ -202,8 +202,8 @@ describe('task repos', () => {
resource_key: 'index_search:ticker:AAPL'
});
await tasksRepo.markTaskFailure(failedTask.id, 'Embedding request failed', 'failed', {
detail: 'Embedding request failed',
await tasksRepo.markTaskFailure(failedTask.id, 'Search indexing could not generate embeddings for AAPL · doc-2. The AI provider returned an empty response.', 'search.embed', {
detail: 'Embedding generation failed.',
context: {
progress: { current: 2, total: 5, unit: 'sources' },
counters: { chunksEmbedded: 20 },
@@ -216,7 +216,9 @@ describe('task repos', () => {
expect(completed?.stage_detail).toContain('Analysis report generated');
expect(completed?.stage_context?.subject?.ticker).toBe('AAPL');
expect(failed?.stage_detail).toBe('Embedding request failed');
expect(failed?.stage).toBe('search.embed');
expect(failed?.stage_detail).toBe('Embedding generation failed.');
expect(failed?.error).toContain('Search indexing could not generate embeddings');
expect(failed?.stage_context?.progress?.current).toBe(2);
});
});