fix(HAI-018): improve error handling for task detail fetching

- Fix server-side error handling in GET /tasks/:id with retry on transient failures
- Add client-side retry logic for fetchTaskDetail in dashboard
- Add unit tests for routes and API error/retry behavior
- Remove outdated core store tests and vitest config
- Update documentation for error handling improvements
This commit is contained in:
Dustin Byrne
2026-03-25 21:33:39 -04:00
8 changed files with 200 additions and 5 deletions

View File

@@ -186,6 +186,13 @@ export class TaskStore extends EventEmitter<TaskStoreEvents> {
return task;
}
/**
* Read a task's JSON and prompt content.
*
* Retries once after a short delay on non-ENOENT errors to handle
* transient read failures caused by concurrent `writeFile` calls
* (e.g. partial JSON from a non-atomic write during executor updates).
*/
async getTask(id: string): Promise<TaskDetail> {
const dir = this.taskDir(id);
const task = await this.safeReadTaskJson(dir);