fix(FN-920): improve error handling in subtask breakdown SSE stream

- Handle empty error messages in subtask-breakdown session by falling back to 'Unknown error'
- Fix backend SSE routes to coerce error data to string and handle missing message
- Improve frontend connectSubtaskStream to validate parsed error data before displaying
- Add tests for error display in SubtaskBreakdownModal component
This commit is contained in:
gsxdsm
2026-04-04 15:13:28 -07:00
parent 0eb8d3b594
commit 040e0e45a0
4 changed files with 27 additions and 4 deletions

View File

@@ -195,7 +195,7 @@ export async function createSubtaskSession(initialDescription: string, _store?:
const existing = sessions.get(sessionId);
if (!existing) return;
existing.status = "error";
existing.error = err instanceof Error ? err.message : "Failed to generate subtasks";
existing.error = err instanceof Error ? (err.message || "Unknown error") : "Failed to generate subtasks";
existing.updatedAt = new Date();
persistSubtaskSession(existing, "error", existing.error);
subtaskStreamManager.broadcast(sessionId, { type: "error", data: existing.error });