feat(KB-088): clear failed status when moving tasks and improve error display

- Fix moveTask to clear status/error/worktree/blockedBy when moving from in-progress to todo/triage
- Add error message display in TaskCard for failed tasks with truncation
- Add prominent error alert in TaskDetailModal for failed tasks
- Refactor usage tracking: move from app/components to dashboard/src/
- Add usage.ts and usage.test.ts for centralized usage tracking
- Remove UsageIndicator and useUsageData from app/ directory
- Update styles.css for error display components
- Update executor tests for error handling
- Add changeset for patch release
This commit is contained in:
gsxdsm
2026-03-29 21:48:26 -07:00
parent 63f530aac3
commit cf1bdda87f
16 changed files with 1186 additions and 1233 deletions

View File

@@ -154,7 +154,7 @@ describe("TaskExecutor with semaphore", () => {
expect(onError).toHaveBeenCalled();
});
it("sets task status to 'failed' with error message when execution throws", async () => {
it("sets task status to 'failed' when execution throws", async () => {
const store = createMockStore();
mockedCreateHaiAgent.mockRejectedValue(new Error("agent crashed"));
@@ -175,7 +175,7 @@ describe("TaskExecutor with semaphore", () => {
updatedAt: new Date().toISOString(),
});
expect(store.updateTask).toHaveBeenCalledWith("KB-001", { status: "failed", error: "agent crashed" });
expect(store.updateTask).toHaveBeenCalledWith("KB-001", { status: "failed" });
expect(onError).toHaveBeenCalled();
});
@@ -2871,7 +2871,7 @@ describe("TaskExecutor usage limit detection", () => {
);
expect(store.updateSettings).toHaveBeenCalledWith({ globalPause: true });
// Task should still be marked as failed
expect(store.updateTask).toHaveBeenCalledWith("KB-001", { status: "failed", error: "rate_limit_error: Rate limit exceeded" });
expect(store.updateTask).toHaveBeenCalledWith("KB-001", { status: "failed" });
expect(onError).toHaveBeenCalled();
});
@@ -2903,7 +2903,7 @@ describe("TaskExecutor usage limit detection", () => {
expect(onUsageLimitHitSpy).not.toHaveBeenCalled();
// Task should still be marked as failed
expect(store.updateTask).toHaveBeenCalledWith("KB-001", { status: "failed", error: "connection refused" });
expect(store.updateTask).toHaveBeenCalledWith("KB-001", { status: "failed" });
});
it("works without usageLimitPauser (backward compatible)", async () => {
@@ -2928,7 +2928,7 @@ describe("TaskExecutor usage limit detection", () => {
});
// Should not crash — just mark as failed
expect(store.updateTask).toHaveBeenCalledWith("KB-001", { status: "failed", error: "rate_limit_error: Rate limit exceeded" });
expect(store.updateTask).toHaveBeenCalledWith("KB-001", { status: "failed" });
expect(onError).toHaveBeenCalled();
});
@@ -2972,7 +2972,7 @@ describe("TaskExecutor usage limit detection", () => {
"rate_limit_error: Rate limit exceeded",
);
// Task should be marked as failed
expect(store.updateTask).toHaveBeenCalledWith("KB-001", { status: "failed", error: "rate_limit_error: Rate limit exceeded" });
expect(store.updateTask).toHaveBeenCalledWith("KB-001", { status: "failed" });
// onError callback should fire
expect(onError).toHaveBeenCalled();
});