fix(lint): cover diagnostic phase events

This commit is contained in:
Vincent Koc
2026-05-04 15:40:00 -07:00
parent e39d3b4223
commit ce8bc1a3e3
3 changed files with 5 additions and 5 deletions

View File

@@ -2222,6 +2222,8 @@ export function createDiagnosticsOtelService(): OpenClawPluginService {
case "diagnostic.liveness.warning":
recordLivenessWarning(evt);
return;
case "diagnostic.phase.completed":
return;
case "run.started":
recordRunStarted(evt, metadata);
return;

View File

@@ -39,7 +39,7 @@ export function getCurrentDiagnosticPhase(): string | undefined {
}
export function getRecentDiagnosticPhases(limit = 8): DiagnosticPhaseSnapshot[] {
return recentPhases.slice(-Math.max(0, limit)).map((phase) => ({ ...phase }));
return recentPhases.slice(-Math.max(0, limit)).map((phase) => Object.assign({}, phase));
}
export function recordDiagnosticPhase(snapshot: DiagnosticPhaseSnapshot): void {

View File

@@ -397,7 +397,7 @@ describe("stuck session diagnostics threshold", () => {
}
expect(warnSpy).toHaveBeenCalledWith(expect.stringContaining("terminalProgressStale=true"));
expect(events.filter((event) => event.type === "session.stalled").at(-1)).toMatchObject({
expect(events.findLast((event) => event.type === "session.stalled")).toMatchObject({
terminalProgressStale: true,
lastProgressReason: "codex_app_server:notification:rawResponseItem/completed",
});
@@ -754,9 +754,7 @@ describe("stuck session diagnostics threshold", () => {
expect(warnSpy).toHaveBeenCalledWith(expect.stringContaining("phase=startup.plugins.load"));
expect(warnSpy).toHaveBeenCalledWith(expect.stringContaining("work=[queued=main("));
expect(
events.filter((event) => event.type === "diagnostic.liveness.warning").at(-1),
).toMatchObject({
expect(events.findLast((event) => event.type === "diagnostic.liveness.warning")).toMatchObject({
phase: "startup.plugins.load",
queuedWorkLabels: [expect.stringContaining("main(")],
});