feat(FN-2136): merge fusion/fn-2136

This commit is contained in:
gsxdsm
2026-04-19 05:51:49 -07:00
parent fec0dd3889
commit 52b2d2c2f1
2 changed files with 11 additions and 11 deletions

View File

@@ -3241,7 +3241,7 @@ describe("TaskExecutor pause behavior", () => {
});
});
describe("session tracking failure diagnostics", () => {
describe("swallowed async store failure observability", () => {
beforeEach(() => {
vi.clearAllMocks();
mockedWithRateLimitRetry.mockImplementation((fn: () => Promise<unknown>) => fn());
@@ -3309,7 +3309,7 @@ describe("session tracking failure diagnostics", () => {
expect(store.moveTask).toHaveBeenCalledWith("FN-001", "in-review");
expect(warnSpy).toHaveBeenCalledWith(
expect.stringContaining("FN-001: failed to log rate-limit retry 2: step-session retry log failure"),
expect.stringContaining("FN-001 failed to log rate-limit retry: step-session retry log failure"),
);
warnSpy.mockRestore();
@@ -3371,7 +3371,7 @@ describe("session tracking failure diagnostics", () => {
expect(store.moveTask).toHaveBeenCalledWith("FN-001", "in-review");
expect(warnSpy).toHaveBeenCalledWith(
expect.stringContaining("FN-001: failed to log rate-limit retry 1: main-agent retry log failure"),
expect.stringContaining("FN-001 failed to log rate-limit retry: main-agent retry log failure"),
);
warnSpy.mockRestore();
@@ -3421,7 +3421,7 @@ describe("session tracking failure diagnostics", () => {
expect(mockedCreateHaiAgent).toHaveBeenCalledTimes(2);
expect(warnSpy).toHaveBeenCalledWith(
expect.stringContaining("FN-001: failed to persist retry session file: retry sessionFile write failed"),
expect.stringContaining("FN-001 failed to persist retry sessionFile: retry sessionFile write failed"),
);
warnSpy.mockRestore();
@@ -3462,7 +3462,7 @@ describe("session tracking failure diagnostics", () => {
expect(store.moveTask).toHaveBeenCalledWith("FN-001", "in-review");
expect(warnSpy).toHaveBeenCalledWith(
expect.stringContaining("FN-001: failed to clear session file on exit: session clear failed"),
expect.stringContaining("FN-001 failed to clear sessionFile: session clear failed"),
);
warnSpy.mockRestore();
@@ -3492,7 +3492,7 @@ describe("session tracking failure diagnostics", () => {
await Promise.resolve();
expect(warnSpy).toHaveBeenCalledWith(
expect.stringContaining("Failed to delete spawned child agent child-007"),
expect.stringContaining("Failed to delete spawned agent child-007: delete failed"),
);
} finally {
warnSpy.mockRestore();

View File

@@ -1434,7 +1434,7 @@ export class TaskExecutor {
executorLog.warn(`${task.id} rate limited — retry ${attempt} in ${delaySec}s: ${error.message}`);
this.store.logEntry(task.id, `Rate limited — retry ${attempt} in ${delaySec}s`, undefined, this.currentRunContext).catch((err: unknown) => {
const msg = err instanceof Error ? err.message : String(err);
executorLog.warn(`${task.id}: failed to log rate-limit retry ${attempt}: ${msg}`);
executorLog.warn(`${task.id} failed to log rate-limit retry: ${msg}`);
});
},
});
@@ -1917,7 +1917,7 @@ export class TaskExecutor {
if (retrySessionFile) {
this.store.updateTask(task.id, { sessionFile: retrySessionFile }).catch((err: unknown) => {
const msg = err instanceof Error ? err.message : String(err);
executorLog.warn(`${task.id}: failed to persist retry session file: ${msg}`);
executorLog.warn(`${task.id} failed to persist retry sessionFile: ${msg}`);
});
}
@@ -2006,7 +2006,7 @@ export class TaskExecutor {
if (!wasPaused && !this.pausedAborted.has(task.id)) {
this.store.updateTask(task.id, { sessionFile: null }).catch((err: unknown) => {
const msg = err instanceof Error ? err.message : String(err);
executorLog.warn(`${task.id}: failed to clear session file on exit: ${msg}`);
executorLog.warn(`${task.id} failed to clear sessionFile: ${msg}`);
});
}
// Invoke plugin onAgentRunEnd hook (fire-and-forget)
@@ -2021,7 +2021,7 @@ export class TaskExecutor {
executorLog.warn(`${task.id} rate limited — retry ${attempt} in ${delaySec}s: ${error.message}`);
this.store.logEntry(task.id, `Rate limited — retry ${attempt} in ${delaySec}s`, undefined, this.currentRunContext).catch((err: unknown) => {
const msg = err instanceof Error ? err.message : String(err);
executorLog.warn(`${task.id}: failed to log rate-limit retry ${attempt}: ${msg}`);
executorLog.warn(`${task.id} failed to log rate-limit retry: ${msg}`);
});
},
});
@@ -4187,7 +4187,7 @@ and show an appropriate message to the user.\`
void setTimeout(() => {
this.options.agentStore?.deleteAgent(childId).catch((err: unknown) => {
const msg = err instanceof Error ? err.message : String(err);
executorLog.warn(`Failed to delete spawned child agent ${childId}: ${msg}`);
executorLog.warn(`Failed to delete spawned agent ${childId}: ${msg}`);
});
}, 5000);