fix(lint): cover diagnostic phase events · openclaw/openclaw@ce8bc1a
vincentkoc
·
2026-05-05
·
via Recent Commits to openclaw:main
File tree
extensions/diagnostics-otel/src
| Original file line number | Diff line number | Diff line change |
|---|
@@ -2222,6 +2222,8 @@ export function createDiagnosticsOtelService(): OpenClawPluginService {
|
2222 | 2222 | case "diagnostic.liveness.warning": |
2223 | 2223 | recordLivenessWarning(evt); |
2224 | 2224 | return; |
| 2225 | +case "diagnostic.phase.completed": |
| 2226 | +return; |
2225 | 2227 | case "run.started": |
2226 | 2228 | recordRunStarted(evt, metadata); |
2227 | 2229 | return; |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -39,7 +39,7 @@ export function getCurrentDiagnosticPhase(): string | undefined {
|
39 | 39 | } |
40 | 40 | |
41 | 41 | export function getRecentDiagnosticPhases(limit = 8): DiagnosticPhaseSnapshot[] { |
42 | | -return recentPhases.slice(-Math.max(0, limit)).map((phase) => ({ ...phase })); |
| 42 | +return recentPhases.slice(-Math.max(0, limit)).map((phase) => Object.assign({}, phase)); |
43 | 43 | } |
44 | 44 | |
45 | 45 | export function recordDiagnosticPhase(snapshot: DiagnosticPhaseSnapshot): void { |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -397,7 +397,7 @@ describe("stuck session diagnostics threshold", () => {
|
397 | 397 | } |
398 | 398 | |
399 | 399 | expect(warnSpy).toHaveBeenCalledWith(expect.stringContaining("terminalProgressStale=true")); |
400 | | -expect(events.filter((event) => event.type === "session.stalled").at(-1)).toMatchObject({ |
| 400 | +expect(events.findLast((event) => event.type === "session.stalled")).toMatchObject({ |
401 | 401 | terminalProgressStale: true, |
402 | 402 | lastProgressReason: "codex_app_server:notification:rawResponseItem/completed", |
403 | 403 | }); |
@@ -754,9 +754,7 @@ describe("stuck session diagnostics threshold", () => {
|
754 | 754 | |
755 | 755 | expect(warnSpy).toHaveBeenCalledWith(expect.stringContaining("phase=startup.plugins.load")); |
756 | 756 | expect(warnSpy).toHaveBeenCalledWith(expect.stringContaining("work=[queued=main(")); |
757 | | -expect( |
758 | | -events.filter((event) => event.type === "diagnostic.liveness.warning").at(-1), |
759 | | -).toMatchObject({ |
| 757 | +expect(events.findLast((event) => event.type === "diagnostic.liveness.warning")).toMatchObject({ |
760 | 758 | phase: "startup.plugins.load", |
761 | 759 | queuedWorkLabels: [expect.stringContaining("main(")], |
762 | 760 | }); |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。