-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathevaluator.mjs
More file actions
3835 lines (3602 loc) · 156 KB
/
evaluator.mjs
File metadata and controls
3835 lines (3602 loc) · 156 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
import { buildAgentTurnBreakdown } from "./collectors/agent-turns.mjs";
import {
buildAgentCliPreProviderAttribution,
summarizeAgentCliPreProviderAttributions
} from "./collectors/agent-cli-attribution.mjs";
import {
buildGatewaySessionPreProviderAttribution,
summarizeGatewaySessionPreProviderAttributions
} from "./collectors/gateway-session-turn-attribution.mjs";
import { computeProviderTurnAttribution } from "./collectors/provider.mjs";
import { summarizeRuntimeDepsLogs } from "./collectors/logs.mjs";
import { buildHealthMeasurement, healthReadinessClassification } from "./health.mjs";
import { resolveThresholdPolicy } from "./evaluation/thresholds.mjs";
import {
isAgentCliMessageCommand,
isAgentMessageCommand,
measuredProductPhase,
measurementScopeForPhase,
normalizeMeasurementScope
} from "./measurement-contract.mjs";
import {
checkAggregateThreshold,
checkDuration,
checkEvidenceThreshold,
checkRoleThresholds,
checkTurnThreshold
} from "./evaluation/violations.mjs";
export function evaluateRecord(record, scenario, options = {}) {
const originalStatus = record.status;
const thresholdPolicy = resolveThresholdPolicy({
profile: options.profile,
surface: options.surface,
scenario
});
const thresholds = thresholdPolicy.thresholds;
const roleThresholds = thresholdPolicy.roleThresholds;
const violations = [];
const allResults = collectResults(record);
const measurementScopeSummary = summarizeMeasurementScopes(record);
const measuredResults = collectResults(record, { productOnly: true });
const resourceSummary = collectResourceSummary(measuredResults);
const primaryResourceRole = resolvePrimaryResourceRole(resourceSummary, options.surface);
const primaryRoleResources = primaryResourceRole ? resourceSummary.byRole[primaryResourceRole] : null;
const peakTrackedRssMb = maxNullable(
collectPeakRss(record, { productOnly: true }),
resourceSummary.peakTotalRssMb
);
const cpuPercentMaxTracked = maxNullable(collectCpuPercentMax(record, { productOnly: true }), resourceSummary.maxTotalCpuPercent);
const resourceGateKind = primaryResourceRole && primaryRoleResources ? "role" : "tracked-total";
const peakRssMb = resourceGateKind === "role" && typeof primaryRoleResources?.peakRssMb === "number"
? primaryRoleResources.peakRssMb
: peakTrackedRssMb;
const cpuPercentMax = resourceGateKind === "role" && typeof primaryRoleResources?.maxCpuPercent === "number"
? primaryRoleResources.maxCpuPercent
: cpuPercentMaxTracked;
const commandMissingDependencyErrors = countMissingDependencyErrors(allResults);
const missingDependencyErrors = combineCommandAndLogCount(
commandMissingDependencyErrors,
countLogMetric(record, "missingDependencyErrors", allResults),
hasSuccessfulLogCommandResult(allResults)
);
const pluginLoadFailures = countLogMetric(record, "pluginLoadFailures", allResults);
const metadataScanMentions = countLogMetric(record, "metadataScanMentions", allResults);
const configNormalizationMentions = countLogMetric(record, "configNormalizationMentions", allResults);
const gatewayRestartCount = countGatewayRestarts(record, allResults);
const providerLoadMentions = countLogMetric(record, "providerLoadMentions", allResults);
const modelCatalogMentions = countLogMetric(record, "modelCatalogMentions", allResults);
const providerTimeoutMentions = countLogMetric(record, "providerTimeoutMentions", allResults);
const eventLoopDelayMentions = countLogMetric(record, "eventLoopDelayMentions", allResults);
const v8DiagnosticMentions = countLogMetric(record, "v8DiagnosticMentions", allResults);
const v8ReportCount = countDiagnosticMetric(record, "v8ReportCount");
const heapSnapshotCount = countDiagnosticMetric(record, "heapSnapshotCount");
const diagnosticArtifactBytes = countDiagnosticMetric(record, "artifactBytes");
const nodeCpuProfileCount = countNodeProfileMetric(record, "cpuProfileCount");
const nodeHeapProfileCount = countNodeProfileMetric(record, "heapProfileCount");
const nodeTraceEventCount = countNodeProfileMetric(record, "traceEventCount");
const nodeProfileArtifactBytes = countNodeProfileMetric(record, "artifactBytes");
const nodeProfileTopFunction = collectNodeProfileTopFunction(record);
const nodeHeapTopFunction = collectNodeHeapTopFunction(record);
const heapSnapshotBytes = countHeapSnapshotBytes(record);
const diagnosticReportCount = countDiagnosticReportMetric(record, "fileCount");
const diagnosticReportBytes = countDiagnosticReportMetric(record, "artifactBytes");
const gatewayExpected = recordExpectsGateway(record);
const openclawDiagnostics = collectOpenClawDiagnostics(record);
const timelineSummary = collectTimelineSummary(record);
const logSummary = collectLogSummary(record);
const runtimeDepsLogEvidence = collectRuntimeDepsLogEvidence(record);
const timelineRequirement = timelineRequirementFor(options);
const requiredOpenSpans = requiredTimelineSpans(options);
const openRequiredSpans = timelineSummary.openSpans.filter((span) => requiredOpenSpans.has(span.name));
const missingRequiredSpans = missingTimelineSpans(timelineSummary, requiredOpenSpans);
const diagnosticContract = diagnosticSpanContractFor(options);
const runtimeDepsStagingMs = maxNullable(
openclawDiagnostics.runtimeDepsStagingMs,
timelineSummary.runtimeDepsStageMaxMs,
runtimeDepsLogEvidence.installMaxMs,
runtimeDepsLogEvidence.postbuildMaxMs
);
const eventLoopDelayMs = maxNullable(
openclawDiagnostics.eventLoopDelayMs,
timelineSummary.eventLoopMaxMs,
logSummary.livenessWarnings.maxEventLoopDelayMaxMs
);
const providerModelTimingMs = maxNullable(openclawDiagnostics.providerModelTimingMs, timelineSummary.providerRequestMaxMs);
const agentTurns = collectAgentTurns(record, record.providerEvidence, scenario, timelineSummary, logSummary);
const coldAgentTurn = selectAgentTurn(agentTurns, "cold") ?? agentTurns[0] ?? null;
const warmAgentTurn = selectAgentTurn(agentTurns, "warm") ?? agentTurns[1] ?? null;
const providerTurn = collectSlowestProviderTurn(agentTurns);
const agentTurnStats = summarizeAgentTurnStats(agentTurns);
const agentTurnDiagnostics = summarizeAgentTurnDiagnostics(agentTurns);
const gatewaySessionPreProviderAttribution = summarizeGatewaySessionPreProviderAttributions(agentTurns);
const agentCliPreProviderAttribution = summarizeAgentCliPreProviderAttributions(agentTurns);
const turnPreProviderAttribution = preferredPreProviderAttributionSummary(
gatewaySessionPreProviderAttribution,
agentCliPreProviderAttribution
);
const agentTurnMs = maxTurnDuration(agentTurns);
const agentResponseOk = agentTurns.length === 0 ? null : agentTurns.every((turn) => turn.responseOk === true);
const health = buildHealthMeasurement(record, scenario);
const agentProviderSimulation = evaluateProviderSimulation({ turns: agentTurns, scenario, record, thresholds, health });
const agentFailureContainment = evaluateAgentFailureContainment({ turns: agentTurns, record, thresholds, gatewayExpected, health });
const agentCleanupDiagnosis = diagnoseAgentCleanup(agentTurns, agentTurnStats, thresholds);
const agentLatencyDiagnosis = diagnoseAgentLatency({
coldAgentTurn,
warmAgentTurn,
providerTurn,
thresholds,
timelineSummary,
authMode: record.auth?.mode ?? null,
expectedProviderMode: scenario.mockProvider?.mode ?? "normal",
providerSimulation: agentProviderSimulation
});
const finalGatewayState = record.finalMetrics?.service?.gatewayState ?? null;
const startupHealthP95Ms = health.startupSamples?.p95Ms ?? null;
const postReadyHealthP95Ms = health.postReadySamples?.p95Ms ?? null;
const startupHealthFailures = health.startupSamples?.failureCount ?? 0;
const postReadyHealthFailures = health.postReadySamples?.failureCount ?? 0;
const finalHealthFailures = health.final?.failureCount ?? 0;
const soakEvidence = collectSoakEvidence(allResults);
const mcpBridgeEvidence = collectMcpBridgeEvidence(allResults);
const browserAutomationEvidence = collectBrowserAutomationEvidence(allResults);
const mediaUnderstandingEvidence = collectMediaUnderstandingEvidence(allResults);
const networkOfflineEvidence = collectNetworkOfflineEvidence(allResults);
const officialPluginEvidence = collectOfficialPluginEvidence(allResults);
const listeningFailures = countListeningFailures(record);
const tcpConnectMaxMs = collectTcpConnectMax(record);
const readinessHealthReadyMs = health.readiness?.healthReadyAtMs ?? null;
const readinessFailures = countReadinessFailures(record);
const readinessClassification = healthReadinessClassification(health);
const coldReadyMs = maxDurationWhere(allResults, (command) => command.startsWith("ocm start "));
const warmReadyMs = maxDurationWhere(allResults, (command) => command.startsWith("ocm service restart "));
const upgradeMs = maxDurationWhere(allResults, (command) => command.startsWith("ocm upgrade "));
const statusMs = maxDurationWhere(allResults, isPostAgentStatusCommand);
const pluginsListMs = maxDurationWhere(allResults, (command) => command.includes(" -- plugins list"));
const pluginInstallMs = maxDurationWhere(allResults, (command) => command.includes("run-official-plugin-install.mjs") || command.includes(" -- plugins install"));
const modelsListMs = maxDurationWhere(allResults, (command) => command.includes(" -- models list"));
const rssGrowthMb = maxNullable(resourceSummary.maxTotalRssGrowthMb);
const gatewayRssGrowthMb = maxNullable(resourceSummary.maxGatewayRssGrowthMb);
checkDuration(violations, allResults, "statusMs", thresholds.statusMs, isPostAgentStatusCommand);
checkDuration(violations, allResults, "pluginsListMs", thresholds.pluginsListMs, (command) => command.includes(" -- plugins list"));
checkDuration(violations, allResults, "pluginUpdateDryRunMs", thresholds.pluginUpdateDryRunMs, (command) =>
command.includes(" -- plugins update") && command.includes("--dry-run")
);
checkDuration(violations, allResults, "modelsListMs", thresholds.modelsListMs, (command) => command.includes(" -- models list"));
checkDuration(violations, allResults, "coldReadyMs", thresholds.coldReadyMs ?? thresholds.gatewayReadyMs, (command) =>
command.startsWith("ocm start ")
);
checkDuration(violations, allResults, "warmReadyMs", thresholds.warmReadyMs ?? thresholds.restartReadyMs, (command) =>
command.startsWith("ocm service restart ")
);
checkDuration(violations, allResults, "upgradeMs", thresholds.upgradeMs, (command) => command.startsWith("ocm upgrade "));
if (typeof thresholds.peakRssMb === "number" && peakRssMb !== null && peakRssMb > thresholds.peakRssMb) {
violations.push({
kind: "threshold",
metric: "peakRssMb",
expected: `<= ${thresholds.peakRssMb}`,
actual: peakRssMb,
message: `${resourceRssLabel(primaryResourceRole, resourceGateKind)} ${peakRssMb} MB exceeded threshold ${thresholds.peakRssMb} MB`
});
}
if (typeof thresholds.cpuPercentMax === "number" && cpuPercentMax !== null && cpuPercentMax > thresholds.cpuPercentMax) {
violations.push({
kind: "threshold",
metric: "cpuPercentMax",
expected: `<= ${thresholds.cpuPercentMax}`,
actual: cpuPercentMax,
message: `max CPU ${cpuPercentMax}% exceeded threshold ${thresholds.cpuPercentMax}%`
});
}
checkRoleThresholds(violations, resourceSummary.byRole, roleThresholds);
const allowedMissingDependencyErrors =
typeof thresholds.missingDependencyErrors === "number" ? thresholds.missingDependencyErrors : 0;
if (missingDependencyErrors > allowedMissingDependencyErrors) {
violations.push({
kind: "log",
metric: "missingDependencyErrors",
expected: `<= ${allowedMissingDependencyErrors}`,
actual: missingDependencyErrors,
message: `${missingDependencyErrors} missing dependency/plugin load error patterns found`
});
}
if (typeof thresholds.pluginLoadFailures === "number" && pluginLoadFailures > thresholds.pluginLoadFailures) {
violations.push({
kind: "log",
metric: "pluginLoadFailures",
expected: `<= ${thresholds.pluginLoadFailures}`,
actual: pluginLoadFailures,
message: `${pluginLoadFailures} plugin load failure patterns found`
});
}
if (gatewayExpected && finalGatewayState && finalGatewayState !== "running") {
violations.push({
kind: "gateway",
metric: "finalGatewayState",
expected: "running",
actual: finalGatewayState,
message: `final gateway state was ${finalGatewayState}`
});
}
if (typeof thresholds.startupHealthFailures === "number" && startupHealthFailures > thresholds.startupHealthFailures) {
violations.push({
kind: "health",
metric: "startupHealthFailures",
expected: `<= ${thresholds.startupHealthFailures}`,
actual: startupHealthFailures,
message: `${startupHealthFailures} startup health check(s) failed, over threshold ${thresholds.startupHealthFailures}`
});
}
if (typeof thresholds.postReadyHealthFailures === "number" && postReadyHealthFailures > thresholds.postReadyHealthFailures) {
violations.push({
kind: "health",
metric: "postReadyHealthFailures",
expected: `<= ${thresholds.postReadyHealthFailures}`,
actual: postReadyHealthFailures,
message: `${postReadyHealthFailures} post-ready liveness check(s) failed, over threshold ${thresholds.postReadyHealthFailures}`
});
}
if (typeof thresholds.finalHealthFailures === "number" && finalHealthFailures > thresholds.finalHealthFailures) {
violations.push({
kind: "health",
metric: "finalHealthFailures",
expected: `<= ${thresholds.finalHealthFailures}`,
actual: finalHealthFailures,
message: `${finalHealthFailures} final health check(s) failed, over threshold ${thresholds.finalHealthFailures}`
});
}
if (typeof thresholds.startupHealthP95Ms === "number" && startupHealthP95Ms !== null && startupHealthP95Ms > thresholds.startupHealthP95Ms) {
violations.push({
kind: "health",
metric: "startupHealthP95Ms",
expected: `<= ${thresholds.startupHealthP95Ms}`,
actual: startupHealthP95Ms,
message: `startup health sample p95 ${startupHealthP95Ms}ms exceeded threshold ${thresholds.startupHealthP95Ms}ms`
});
}
if (typeof thresholds.postReadyHealthP95Ms === "number" && postReadyHealthP95Ms !== null && postReadyHealthP95Ms > thresholds.postReadyHealthP95Ms) {
violations.push({
kind: "health",
metric: "postReadyHealthP95Ms",
expected: `<= ${thresholds.postReadyHealthP95Ms}`,
actual: postReadyHealthP95Ms,
message: `post-ready liveness p95 ${postReadyHealthP95Ms}ms exceeded threshold ${thresholds.postReadyHealthP95Ms}ms`
});
}
if (typeof thresholds.soakMinDurationMs === "number" && soakEvidence.durationMs !== null && soakEvidence.durationMs < thresholds.soakMinDurationMs) {
violations.push({
kind: "soak",
metric: "soakDurationMs",
expected: `>= ${thresholds.soakMinDurationMs}`,
actual: soakEvidence.durationMs,
message: `soak loop ran for ${soakEvidence.durationMs}ms, below required duration ${thresholds.soakMinDurationMs}ms`
});
}
if (typeof thresholds.soakCommandP95Ms === "number" && soakEvidence.commandP95Ms !== null && soakEvidence.commandP95Ms > thresholds.soakCommandP95Ms) {
violations.push({
kind: "soak",
metric: "soakCommandP95Ms",
expected: `<= ${thresholds.soakCommandP95Ms}`,
actual: soakEvidence.commandP95Ms,
message: `soak command p95 ${soakEvidence.commandP95Ms}ms exceeded threshold ${thresholds.soakCommandP95Ms}ms`
});
}
if (typeof thresholds.soakCommandFailures === "number" && soakEvidence.commandFailures !== null && soakEvidence.commandFailures > thresholds.soakCommandFailures) {
violations.push({
kind: "soak",
metric: "soakCommandFailures",
expected: `<= ${thresholds.soakCommandFailures}`,
actual: soakEvidence.commandFailures,
message: `${soakEvidence.commandFailures} soak command(s) failed during repeated OpenClaw usage`
});
}
if (typeof thresholds.soakHealthP95Ms === "number" && soakEvidence.healthP95Ms !== null && soakEvidence.healthP95Ms > thresholds.soakHealthP95Ms) {
violations.push({
kind: "soak",
metric: "soakHealthP95Ms",
expected: `<= ${thresholds.soakHealthP95Ms}`,
actual: soakEvidence.healthP95Ms,
message: `soak health p95 ${soakEvidence.healthP95Ms}ms exceeded threshold ${thresholds.soakHealthP95Ms}ms`
});
}
if (typeof thresholds.soakHealthFailures === "number" && soakEvidence.healthFailures !== null && soakEvidence.healthFailures > thresholds.soakHealthFailures) {
violations.push({
kind: "soak",
metric: "soakHealthFailures",
expected: `<= ${thresholds.soakHealthFailures}`,
actual: soakEvidence.healthFailures,
message: `${soakEvidence.healthFailures} soak health check(s) failed during repeated OpenClaw usage`
});
}
if (mcpBridgeEvidence.available) {
if (typeof thresholds.mcpInitializeMs === "number" && mcpBridgeEvidence.initializeMs !== null && mcpBridgeEvidence.initializeMs > thresholds.mcpInitializeMs) {
violations.push({
kind: "mcp",
metric: "mcpInitializeMs",
expected: `<= ${thresholds.mcpInitializeMs}`,
actual: mcpBridgeEvidence.initializeMs,
message: `MCP bridge initialize took ${mcpBridgeEvidence.initializeMs}ms, over threshold ${thresholds.mcpInitializeMs}ms`
});
}
if (typeof thresholds.mcpToolsListMs === "number" && mcpBridgeEvidence.toolsListMs !== null && mcpBridgeEvidence.toolsListMs > thresholds.mcpToolsListMs) {
violations.push({
kind: "mcp",
metric: "mcpToolsListMs",
expected: `<= ${thresholds.mcpToolsListMs}`,
actual: mcpBridgeEvidence.toolsListMs,
message: `MCP tools/list took ${mcpBridgeEvidence.toolsListMs}ms, over threshold ${thresholds.mcpToolsListMs}ms`
});
}
if (typeof thresholds.mcpShutdownMs === "number" && mcpBridgeEvidence.shutdownMs !== null && mcpBridgeEvidence.shutdownMs > thresholds.mcpShutdownMs) {
violations.push({
kind: "mcp",
metric: "mcpShutdownMs",
expected: `<= ${thresholds.mcpShutdownMs}`,
actual: mcpBridgeEvidence.shutdownMs,
message: `MCP bridge shutdown took ${mcpBridgeEvidence.shutdownMs}ms, over threshold ${thresholds.mcpShutdownMs}ms`
});
}
if (typeof thresholds.mcpToolCountMin === "number" && mcpBridgeEvidence.toolCount !== null && mcpBridgeEvidence.toolCount < thresholds.mcpToolCountMin) {
violations.push({
kind: "mcp",
metric: "mcpToolCountMin",
expected: `>= ${thresholds.mcpToolCountMin}`,
actual: mcpBridgeEvidence.toolCount,
message: `MCP bridge exposed ${mcpBridgeEvidence.toolCount} tool(s), below required ${thresholds.mcpToolCountMin}`
});
}
const leakCount = mcpBridgeEvidence.processExited === false ? 1 : 0;
if (typeof thresholds.mcpProcessLeaks === "number" && leakCount > thresholds.mcpProcessLeaks) {
violations.push({
kind: "mcp",
metric: "mcpProcessLeaks",
expected: `<= ${thresholds.mcpProcessLeaks}`,
actual: leakCount,
message: "MCP bridge process did not exit cleanly after the smoke"
});
}
if (mcpBridgeEvidence.errors.length > 0) {
violations.push({
kind: "mcp",
metric: "mcpBridgeErrors",
expected: "0",
actual: mcpBridgeEvidence.errors.length,
message: `MCP bridge smoke reported ${mcpBridgeEvidence.errors.length} error(s): ${mcpBridgeEvidence.errors[0]}`
});
}
}
if (browserAutomationEvidence.available) {
checkEvidenceThreshold(violations, "browser", "browserDoctorMs", browserAutomationEvidence.browserDoctorMs, thresholds.browserDoctorMs, "Browser doctor");
checkEvidenceThreshold(violations, "browser", "browserStartMs", browserAutomationEvidence.browserStartMs, thresholds.browserStartMs, "Browser start");
checkEvidenceThreshold(violations, "browser", "browserTabsMs", browserAutomationEvidence.browserTabsMs, thresholds.browserTabsMs, "Browser tabs");
checkEvidenceThreshold(violations, "browser", "browserOpenMs", browserAutomationEvidence.browserOpenMs, thresholds.browserOpenMs, "Browser open");
checkEvidenceThreshold(violations, "browser", "browserSnapshotMs", browserAutomationEvidence.browserSnapshotMs, thresholds.browserSnapshotMs, "Browser snapshot");
checkEvidenceThreshold(violations, "browser", "browserStopMs", browserAutomationEvidence.browserStopMs, thresholds.browserStopMs, "Browser stop");
if (typeof thresholds.browserTabCountMin === "number" && browserAutomationEvidence.browserTabCount !== null && browserAutomationEvidence.browserTabCount < thresholds.browserTabCountMin) {
violations.push({
kind: "browser",
metric: "browserTabCountMin",
expected: `>= ${thresholds.browserTabCountMin}`,
actual: browserAutomationEvidence.browserTabCount,
message: `Browser automation saw ${browserAutomationEvidence.browserTabCount} tab(s), below required ${thresholds.browserTabCountMin}`
});
}
if (browserAutomationEvidence.browserSnapshotOk === false) {
violations.push({
kind: "browser",
metric: "browserSnapshotOk",
expected: true,
actual: false,
message: "Browser snapshot command did not complete successfully"
});
}
const leakCount = browserAutomationEvidence.browserStopped === false ? 1 : 0;
if (typeof thresholds.browserProcessLeaks === "number" && leakCount > thresholds.browserProcessLeaks) {
violations.push({
kind: "browser",
metric: "browserProcessLeaks",
expected: `<= ${thresholds.browserProcessLeaks}`,
actual: leakCount,
message: "Browser automation did not stop the managed browser profile cleanly"
});
}
if (browserAutomationEvidence.errors.length > 0) {
violations.push({
kind: "browser",
metric: "browserSmokeErrors",
expected: "0",
actual: browserAutomationEvidence.errors.length,
message: `Browser automation smoke reported ${browserAutomationEvidence.errors.length} error(s): ${browserAutomationEvidence.errors[0]}`
});
}
}
if (mediaUnderstandingEvidence.available) {
checkEvidenceThreshold(violations, "media-understanding", "mediaDescribeMs", mediaUnderstandingEvidence.mediaDescribeMs, thresholds.mediaDescribeMs, "Media understanding image describe");
checkEvidenceThreshold(violations, "media-understanding", "mediaStatusAfterTimeoutMs", mediaUnderstandingEvidence.mediaStatusAfterTimeoutMs, thresholds.mediaStatusAfterTimeoutMs, "Post-media status");
if (typeof thresholds.mediaTimeoutObserved === "number" && mediaUnderstandingEvidence.mediaTimeoutObserved !== true) {
violations.push({
kind: "media-understanding",
metric: "mediaTimeoutObserved",
expected: true,
actual: mediaUnderstandingEvidence.mediaTimeoutObserved,
message: "Media understanding provider timeout was not observed as a bounded command failure"
});
}
if (mediaUnderstandingEvidence.mediaCommandTimedOut === true) {
violations.push({
kind: "media-understanding",
metric: "mediaCommandTimedOut",
expected: false,
actual: true,
message: "Media understanding command hit Kova's outer timeout instead of OpenClaw's provider timeout"
});
}
if (mediaUnderstandingEvidence.gatewayStatusWorks === false) {
violations.push({
kind: "media-understanding",
metric: "mediaGatewayStatusWorks",
expected: true,
actual: false,
message: "Gateway status did not work after media understanding timeout"
});
}
if (mediaUnderstandingEvidence.errors.length > 0) {
violations.push({
kind: "media-understanding",
metric: "mediaUnderstandingErrors",
expected: "0",
actual: mediaUnderstandingEvidence.errors.length,
message: `Media understanding timeout smoke reported ${mediaUnderstandingEvidence.errors.length} error(s): ${mediaUnderstandingEvidence.errors[0]}`
});
}
}
if (networkOfflineEvidence.available) {
checkEvidenceThreshold(violations, "network-offline", "networkTurnMs", networkOfflineEvidence.networkTurnMs, thresholds.networkTurnMs, "Network offline agent turn");
checkEvidenceThreshold(violations, "network-offline", "networkStatusAfterFailureMs", networkOfflineEvidence.networkStatusAfterFailureMs, thresholds.networkStatusAfterFailureMs, "Post-network status");
if (typeof thresholds.networkFailureObserved === "number" && networkOfflineEvidence.networkFailureObserved !== true) {
violations.push({
kind: "network-offline",
metric: "networkFailureObserved",
expected: true,
actual: networkOfflineEvidence.networkFailureObserved,
message: "Network/provider failure was not observed as a bounded command failure"
});
}
if (networkOfflineEvidence.networkCommandTimedOut === true) {
violations.push({
kind: "network-offline",
metric: "networkCommandTimedOut",
expected: false,
actual: true,
message: "Network offline command hit Kova's outer timeout instead of OpenClaw surfacing the provider failure"
});
}
if (networkOfflineEvidence.gatewayStatusWorks === false) {
violations.push({
kind: "network-offline",
metric: "networkGatewayStatusWorks",
expected: true,
actual: false,
message: "Gateway status did not work after network/provider failure"
});
}
if (networkOfflineEvidence.errors.length > 0) {
violations.push({
kind: "network-offline",
metric: "networkOfflineErrors",
expected: "0",
actual: networkOfflineEvidence.errors.length,
message: `Network offline smoke reported ${networkOfflineEvidence.errors.length} error(s): ${networkOfflineEvidence.errors[0]}`
});
}
}
if (officialPluginEvidence.available) {
checkEvidenceThreshold(violations, "plugins", "pluginInstallMs", officialPluginEvidence.durationMs, thresholds.pluginInstallMs, "Official plugin install");
if (typeof thresholds.officialPluginInstallOk === "number" && officialPluginEvidence.ok !== true) {
violations.push({
kind: "plugins",
metric: "officialPluginInstallOk",
expected: true,
actual: false,
message: officialPluginInstallFailureMessage(officialPluginEvidence)
});
}
const securityBlockLimit = typeof thresholds.officialPluginSecurityBlocks === "number" ? thresholds.officialPluginSecurityBlocks : 0;
const securityBlockExceeded = officialPluginEvidence.securityBlockCount > securityBlockLimit;
if (securityBlockExceeded) {
violations.push({
kind: "plugins",
metric: "officialPluginSecurityBlocks",
expected: `<= ${securityBlockLimit}`,
actual: officialPluginEvidence.securityBlockCount,
message: `official plugin security scanner signal observed: ${officialPluginEvidence.securityEvidence ?? "unknown plugin"}`
});
}
}
if (typeof thresholds.providerRequestCountMin === "number") {
const requestCount = record.providerEvidence?.requestCount ?? 0;
if (requestCount < thresholds.providerRequestCountMin) {
violations.push({
kind: "provider",
metric: "providerRequestCountMin",
expected: `>= ${thresholds.providerRequestCountMin}`,
actual: requestCount,
message: `Provider saw ${requestCount} request(s), below required ${thresholds.providerRequestCountMin}`
});
}
}
if (typeof thresholds.rssGrowthMb === "number" && rssGrowthMb !== null && rssGrowthMb > thresholds.rssGrowthMb) {
violations.push({
kind: "soak",
metric: "rssGrowthMb",
expected: `<= ${thresholds.rssGrowthMb}`,
actual: rssGrowthMb,
message: `resource-sampled RSS grew by ${rssGrowthMb} MB, over threshold ${thresholds.rssGrowthMb} MB`
});
}
if (typeof thresholds.gatewayRssGrowthMb === "number" && gatewayRssGrowthMb !== null && gatewayRssGrowthMb > thresholds.gatewayRssGrowthMb) {
violations.push({
kind: "soak",
metric: "gatewayRssGrowthMb",
expected: `<= ${thresholds.gatewayRssGrowthMb}`,
actual: gatewayRssGrowthMb,
message: `gateway RSS grew by ${gatewayRssGrowthMb} MB during sampled execution, over threshold ${thresholds.gatewayRssGrowthMb} MB`
});
}
if (readinessClassification?.state === "hard-failure") {
violations.push({
kind: "gateway",
metric: "readiness.classification",
expected: "ready",
actual: readinessClassification.state,
message: `gateway hard failure: ${readinessClassification.reason}`
});
}
if (readinessClassification?.state === "unhealthy") {
violations.push({
kind: "gateway",
metric: "readiness.classification",
expected: "ready",
actual: readinessClassification.state,
message: `gateway unhealthy: ${readinessClassification.reason}`
});
}
if (readinessClassification?.state === "slow-startup") {
violations.push({
kind: "gateway",
metric: "readiness.classification",
expected: "ready within threshold",
actual: readinessClassification.state,
message: `gateway slow startup: ${readinessClassification.reason}`
});
}
const gatewayReadyThreshold = thresholds.gatewayReadyMs ?? thresholds.coldReadyMs;
if (
readinessClassification?.state !== "slow-startup" &&
typeof gatewayReadyThreshold === "number" &&
readinessHealthReadyMs !== null &&
readinessHealthReadyMs > gatewayReadyThreshold
) {
violations.push({
kind: "gateway",
metric: "readinessHealthReadyMs",
expected: `<= ${gatewayReadyThreshold}`,
actual: readinessHealthReadyMs,
message: `gateway health ready took ${readinessHealthReadyMs}ms, over threshold ${gatewayReadyThreshold}ms`
});
}
if (typeof thresholds.gatewayRestarts === "number" && gatewayRestartCount > thresholds.gatewayRestarts) {
violations.push({
kind: "gateway",
metric: "gatewayRestartCount",
expected: `<= ${thresholds.gatewayRestarts}`,
actual: gatewayRestartCount,
message: `${gatewayRestartCount} gateway restart signals found`
});
}
const allowedProviderTimeouts = typeof thresholds.providerTimeoutMentions === "number" ? thresholds.providerTimeoutMentions : 0;
if (providerTimeoutMentions > allowedProviderTimeouts) {
violations.push({
kind: "provider",
metric: "providerTimeoutMentions",
expected: `<= ${allowedProviderTimeouts}`,
actual: providerTimeoutMentions,
message: `${providerTimeoutMentions} provider/model timeout signals found`
});
}
const allowedEventLoopMentions = typeof thresholds.eventLoopDelayMentions === "number" ? thresholds.eventLoopDelayMentions : 0;
if (eventLoopDelayMentions > allowedEventLoopMentions) {
violations.push({
kind: "performance",
metric: "eventLoopDelayMentions",
expected: `<= ${allowedEventLoopMentions}`,
actual: eventLoopDelayMentions,
message: `${eventLoopDelayMentions} event-loop delay signals found`
});
}
if (typeof thresholds.eventLoopDelayMs === "number" && eventLoopDelayMs !== null && eventLoopDelayMs > thresholds.eventLoopDelayMs) {
violations.push({
kind: "performance",
metric: "eventLoopDelayMs",
expected: `<= ${thresholds.eventLoopDelayMs}`,
actual: eventLoopDelayMs,
message: `structured event-loop delay ${eventLoopDelayMs}ms exceeded threshold ${thresholds.eventLoopDelayMs}ms`
});
}
if (typeof thresholds.runtimeDepsStagingMs === "number" && runtimeDepsStagingMs !== null && runtimeDepsStagingMs > thresholds.runtimeDepsStagingMs) {
violations.push({
kind: "plugins",
metric: "runtimeDepsStagingMs",
expected: `<= ${thresholds.runtimeDepsStagingMs}`,
actual: runtimeDepsStagingMs,
message: `runtime dependency staging took ${runtimeDepsStagingMs}ms, over threshold ${thresholds.runtimeDepsStagingMs}ms`
});
}
if (
typeof thresholds.warmRuntimeDepsRestageCount === "number" &&
runtimeDepsLogEvidence.warmRestart.installCount !== null &&
runtimeDepsLogEvidence.warmRestart.installCount > thresholds.warmRuntimeDepsRestageCount
) {
violations.push({
kind: "plugins",
metric: "warmRuntimeDepsRestageCount",
expected: `<= ${thresholds.warmRuntimeDepsRestageCount}`,
actual: runtimeDepsLogEvidence.warmRestart.installCount,
message: `warm restart reinstalled bundled runtime deps ${runtimeDepsLogEvidence.warmRestart.installCount} time(s); expected staged deps to be reused`
});
}
if (
typeof thresholds.warmRuntimeDepsStagingMs === "number" &&
runtimeDepsLogEvidence.warmRestart.installMaxMs !== null &&
runtimeDepsLogEvidence.warmRestart.installMaxMs > thresholds.warmRuntimeDepsStagingMs
) {
violations.push({
kind: "plugins",
metric: "warmRuntimeDepsStagingMs",
expected: `<= ${thresholds.warmRuntimeDepsStagingMs}`,
actual: runtimeDepsLogEvidence.warmRestart.installMaxMs,
message: `warm restart bundled runtime deps install took ${runtimeDepsLogEvidence.warmRestart.installMaxMs}ms, over threshold ${thresholds.warmRuntimeDepsStagingMs}ms`
});
}
const allowedTimelineParseErrors = typeof thresholds.openclawTimelineParseErrors === "number" ? thresholds.openclawTimelineParseErrors : 0;
if (timelineRequirement.required && !timelineSummary.available) {
violations.push({
kind: "diagnostics",
metric: "openclawTimelineAvailable",
expected: "available",
actual: false,
message: `OpenClaw diagnostics timeline was required for ${timelineRequirement.reason} but was not emitted`
});
}
if (timelineSummary.available && timelineSummary.parseErrorCount > allowedTimelineParseErrors) {
violations.push({
kind: "diagnostics",
metric: "openclawTimelineParseErrors",
expected: `<= ${allowedTimelineParseErrors}`,
actual: timelineSummary.parseErrorCount,
message: `${timelineSummary.parseErrorCount} OpenClaw diagnostics timeline parse errors found`
});
}
if (openRequiredSpans.length > 0) {
const slowestOpen = openRequiredSpans[0];
violations.push({
kind: "diagnostics",
metric: "openclawOpenRequiredSpanCount",
expected: "0",
actual: openRequiredSpans.length,
message: `${openRequiredSpans.length} required OpenClaw diagnostics span(s) were left open; slowest ${slowestOpen.name}${slowestOpen.ageMs !== null ? ` age ${slowestOpen.ageMs}ms` : ""}`
});
}
if (timelineSummary.available && missingRequiredSpans.length > 0 && diagnosticContract.enforceMissingSpans) {
violations.push({
kind: "diagnostics",
metric: "openclawMissingRequiredSpanCount",
expected: "0",
actual: missingRequiredSpans.length,
message: `${missingRequiredSpans.length} required OpenClaw diagnostics span(s) were not observed: ${missingRequiredSpans.slice(0, 5).join(", ")}`
});
}
checkGatewaySessionTransport(violations, agentTurns, scenario);
checkChannelModelTurnCases(violations, agentTurns);
if (agentResponseOk === false) {
violations.push({
kind: "agent",
metric: "agentResponseOk",
expected: "true",
actual: false,
message: "agent message command finished without a usable assistant response"
});
}
checkAgentTurnCorrectness(violations, agentTurns, scenario.agent?.expectedText ?? null);
checkAgentTurnThresholds(violations, agentTurns, { coldAgentTurn, warmAgentTurn, providerTurn, agentLatencyDiagnosis }, thresholds, record);
checkAgentTurnAggregateThresholds(violations, agentTurnStats, thresholds);
checkProviderSimulation(violations, agentProviderSimulation);
checkAgentFailureContainment(violations, agentFailureContainment);
record.measurements = {
peakRssMb,
cpuPercentMax,
measurementScopeSummary,
resourceMeasurementScope: "product",
resourcePrimaryRole: primaryResourceRole,
resourceGateKind,
resourcePeakTrackedRssMb: peakTrackedRssMb,
resourceCpuPercentMaxTracked: cpuPercentMaxTracked,
coldReadyMs,
warmReadyMs,
upgradeMs,
statusMs,
pluginsListMs,
pluginInstallMs,
modelsListMs,
agentTurnMs,
agentResponseOk,
agentTurnCount: agentTurns.length,
agentTurns,
agentTurnStats,
agentTurnMedianMs: agentTurnStats.totalTurnMs.median,
agentTurnP95Ms: agentTurnStats.totalTurnMs.p95,
agentTurnMaxMs: agentTurnStats.totalTurnMs.max,
agentPreProviderMedianMs: agentTurnStats.preProviderMs.median,
agentPreProviderP95Ms: agentTurnStats.preProviderMs.p95,
agentPreProviderMaxMs: agentTurnStats.preProviderMs.max,
agentProviderFinalMedianMs: agentTurnStats.providerFinalMs.median,
agentProviderFinalP95Ms: agentTurnStats.providerFinalMs.p95,
agentProviderFinalMaxMs: agentTurnStats.providerFinalMs.max,
agentCleanupMedianMs: agentTurnStats.cleanupMs.median,
agentCleanupP95Ms: agentTurnStats.cleanupMs.p95,
agentCleanupMaxMs: agentTurnStats.cleanupMs.max,
agentMetadataScanCount: agentTurnDiagnostics.metadataScanCount,
agentMetadataScanTotalMs: agentTurnDiagnostics.metadataScanTotalMs,
agentMetadataScanMaxMs: agentTurnDiagnostics.metadataScanMaxMs,
agentEventLoopMaxMs: agentTurnDiagnostics.eventLoopMaxMs,
agentEventLoopSampleCount: agentTurnDiagnostics.eventLoopSampleCount,
agentSessionPollCount: agentTurnDiagnostics.sessionPollCount,
agentSessionPollErrorCount: agentTurnDiagnostics.sessionPollErrorCount,
gatewaySessionPreProviderAttribution,
agentCliPreProviderAttribution,
coldPreProviderAttributedMs: turnPreProviderAttribution.cold.knownAttributedMs.median,
warmPreProviderAttributedMs: turnPreProviderAttribution.warm.knownAttributedMs.median,
coldPreProviderUnattributedMs: turnPreProviderAttribution.cold.unattributedMs.median,
warmPreProviderUnattributedMs: turnPreProviderAttribution.warm.unattributedMs.median,
coldPreProviderAttributionCoverage: turnPreProviderAttribution.cold.coverageRatio.median,
warmPreProviderAttributionCoverage: turnPreProviderAttribution.warm.coverageRatio.median,
coldAgentTurnMs: coldAgentTurn?.totalTurnMs ?? null,
warmAgentTurnMs: warmAgentTurn?.totalTurnMs ?? null,
agentColdWarmDeltaMs: delta(coldAgentTurn?.totalTurnMs, warmAgentTurn?.totalTurnMs),
coldPreProviderMs: coldAgentTurn?.preProviderMs ?? null,
warmPreProviderMs: warmAgentTurn?.preProviderMs ?? null,
agentColdWarmPreProviderDeltaMs: delta(coldAgentTurn?.preProviderMs, warmAgentTurn?.preProviderMs),
coldProviderFinalMs: coldAgentTurn?.providerFinalMs ?? null,
warmProviderFinalMs: warmAgentTurn?.providerFinalMs ?? null,
coldFirstByteLatencyMs: coldAgentTurn?.firstByteLatencyMs ?? null,
warmFirstByteLatencyMs: warmAgentTurn?.firstByteLatencyMs ?? null,
agentLatencyDiagnosis,
agentCleanupDiagnosis,
agentProviderSimulation,
agentFailureContainment,
agentProcessLeakCount: agentFailureContainment.processLeakCount,
agentLeakedProcesses: agentFailureContainment.leakedProcesses,
agentFailureFixerSummary: buildAgentFailureFixerSummary(agentLatencyDiagnosis, agentCleanupDiagnosis, agentProviderSimulation, agentFailureContainment),
agentProviderMode: agentProviderSimulation.mode,
agentProviderIssue: agentProviderSimulation.observedIssue,
agentProviderContainmentOk: agentProviderSimulation.containmentOk,
agentProviderRecoveryOk: agentProviderSimulation.recoveryOk,
providerRequestCount: record.providerEvidence?.requestCount ?? null,
providerFirstRequestAt: record.providerEvidence?.firstRequestStartAt ?? null,
providerLastResponseAt: record.providerEvidence?.lastResponseEndAt ?? null,
providerDurationMs: record.providerEvidence?.providerDurationMs ?? null,
providerFirstByteLatencyMs: record.providerEvidence?.firstByteLatencyMs ?? null,
providerFirstChunkLatencyMs: record.providerEvidence?.firstChunkLatencyMs ?? null,
agentPreProviderMs: providerTurn?.preProviderMs ?? null,
agentProviderFinalMs: providerTurn?.providerFinalMs ?? null,
agentPostProviderMs: providerTurn?.postProviderMs ?? null,
agentPreProviderDominance: providerTurn?.preProviderDominates ?? null,
agentProviderRequestCount: providerTurn?.requestCount ?? null,
agentProviderRequestMissing: providerTurn?.missingProviderRequest ?? null,
agentProviderAttribution: providerTurn,
health,
tcpConnectMaxMs,
missingDependencyErrors,
finalGatewayState,
soakEvidence,
mcpBridgeEvidence,
mcpInitializeMs: mcpBridgeEvidence.initializeMs,
mcpToolsListMs: mcpBridgeEvidence.toolsListMs,
mcpShutdownMs: mcpBridgeEvidence.shutdownMs,
mcpToolCount: mcpBridgeEvidence.toolCount,
mcpToolNames: mcpBridgeEvidence.toolNames,
mcpProcessExited: mcpBridgeEvidence.processExited,
mcpProcessLeaks: mcpBridgeEvidence.available ? (mcpBridgeEvidence.processExited === false ? 1 : 0) : null,
mcpErrors: mcpBridgeEvidence.errors,
browserAutomationEvidence,
browserDoctorMs: browserAutomationEvidence.browserDoctorMs,
browserStartMs: browserAutomationEvidence.browserStartMs,
browserTabsMs: browserAutomationEvidence.browserTabsMs,
browserOpenMs: browserAutomationEvidence.browserOpenMs,
browserSnapshotMs: browserAutomationEvidence.browserSnapshotMs,
browserStopMs: browserAutomationEvidence.browserStopMs,
browserTabCount: browserAutomationEvidence.browserTabCount,
browserSnapshotOk: browserAutomationEvidence.browserSnapshotOk,
browserStopped: browserAutomationEvidence.browserStopped,
browserProcessLeaks: browserAutomationEvidence.available ? (browserAutomationEvidence.browserStopped === false ? 1 : 0) : null,
browserErrors: browserAutomationEvidence.errors,
mediaUnderstandingEvidence,
mediaDescribeMs: mediaUnderstandingEvidence.mediaDescribeMs,
mediaTimeoutObserved: mediaUnderstandingEvidence.mediaTimeoutObserved,
mediaCommandTimedOut: mediaUnderstandingEvidence.mediaCommandTimedOut,
mediaStatusAfterTimeoutMs: mediaUnderstandingEvidence.mediaStatusAfterTimeoutMs,
mediaGatewayStatusWorks: mediaUnderstandingEvidence.gatewayStatusWorks,
mediaErrors: mediaUnderstandingEvidence.errors,
networkOfflineEvidence,
officialPluginEvidence,
officialPluginInstallOk: officialPluginEvidence.available ? officialPluginEvidence.ok : null,
officialPluginSecurityBlocks: officialPluginEvidence.available ? officialPluginEvidence.securityBlockCount : null,
officialPluginInstallMs: officialPluginEvidence.available ? officialPluginEvidence.durationMs : null,
networkTurnMs: networkOfflineEvidence.networkTurnMs,
networkFailureObserved: networkOfflineEvidence.networkFailureObserved,
networkCommandTimedOut: networkOfflineEvidence.networkCommandTimedOut,
networkStatusAfterFailureMs: networkOfflineEvidence.networkStatusAfterFailureMs,
networkGatewayStatusWorks: networkOfflineEvidence.gatewayStatusWorks,
networkErrors: networkOfflineEvidence.errors,
soakDurationMs: soakEvidence.durationMs,
soakIterations: soakEvidence.iterations,
soakCommandP95Ms: soakEvidence.commandP95Ms,
soakCommandMaxMs: soakEvidence.commandMaxMs,
soakHealthP95Ms: soakEvidence.healthP95Ms,
soakHealthMaxMs: soakEvidence.healthMaxMs,
soakHealthFailures: soakEvidence.healthFailures,
soakCommandFailures: soakEvidence.commandFailures,
rssGrowthMb,
gatewayRssGrowthMb,
listeningFailures,
readinessFailures,
gatewayRestartCount,
pluginLoadFailures,
metadataScanMentions,
configNormalizationMentions,
providerLoadMentions,
modelCatalogMentions,
providerTimeoutMentions,
eventLoopDelayMentions,
v8DiagnosticMentions,
v8ReportCount,
heapSnapshotCount,
diagnosticArtifactBytes,
nodeCpuProfileCount,
nodeHeapProfileCount,
nodeTraceEventCount,
nodeProfileArtifactBytes,
nodeProfileTopFunction: nodeProfileTopFunction?.functionName ?? null,
nodeProfileTopFunctionMs: nodeProfileTopFunction?.selfMs ?? null,
nodeProfileTopFunctionUrl: nodeProfileTopFunction?.url ?? null,
nodeHeapTopFunction: nodeHeapTopFunction?.functionName ?? null,
nodeHeapTopFunctionMb: nodeHeapTopFunction?.selfSizeMb ?? null,
nodeHeapTopFunctionUrl: nodeHeapTopFunction?.url ?? null,
heapSnapshotBytes,
diagnosticReportCount,
diagnosticReportBytes,
profilingEnabled: record.profiling?.enabled === true,
profilingResourceInterpretation: record.profiling?.interpretation ?? null,
profilingBaselineEligible: record.profiling?.baselineEligible ?? null,
profilingAffectsResourceMeasurements: record.profiling?.affectsResourceMeasurements === true,
resourceSampleCount: resourceSummary.sampleCount,
resourceSampleArtifacts: resourceSummary.artifacts,
resourcePeakCommandTreeRssMb: resourceSummary.peakCommandTreeRssMb,
resourcePeakGatewayRssMb: resourceSummary.peakGatewayRssMb,
resourceByRole: resourceSummary.byRole,
resourceTopRolesByRss: resourceSummary.topRolesByRss,
resourceTopRolesByCpu: resourceSummary.topRolesByCpu,
resourcePeakRssAtMs: resourceSummary.peakRssSample?.elapsedMs ?? null,
resourcePeakCpuAtMs: resourceSummary.peakCpuSample?.elapsedMs ?? null,
resourcePeakRssProcess: compactSampleProcess(resourceSummary.peakRssSample?.topProcess),
resourcePeakCpuProcess: compactSampleProcess(resourceSummary.peakCpuSample?.topProcess),
resourceTrend: resourceSummary.trend,
resourceTopByRss: resourceSummary.topByRss,
resourceTopByCpu: resourceSummary.topByCpu,
openclawTimelineAvailable: timelineSummary.available,
openclawTimelineArtifacts: timelineSummary.timelineArtifacts,
openclawTimelineEventCount: timelineSummary.eventCount,
openclawTimelineParseErrors: timelineSummary.parseErrorCount,
openclawSlowestSpanName: timelineSummary.slowestSpanName,
openclawSlowestSpanMs: timelineSummary.slowestSpanMs,
openclawRepeatedSpanCount: timelineSummary.repeatedSpanCount,
openclawOpenSpanCount: timelineSummary.openSpanCount,
openclawOpenRequiredSpanCount: openRequiredSpans.length,
openclawMissingRequiredSpanCount: missingRequiredSpans.length,
openclawMissingRequiredSpans: missingRequiredSpans,
openclawMissingRequiredSpanSeverity: diagnosticContract.missingSpanSeverity,
openclawDiagnosticsContract: diagnosticContract,
openclawOpenSpans: timelineSummary.openSpans,
openclawKeySpans: timelineSummary.keySpans,
openclawEventLoopMaxMs: timelineSummary.eventLoopMaxMs,
openclawLogEventLoopMaxMs: logSummary.livenessWarnings.maxEventLoopDelayMaxMs,
openclawLivenessWarningCount: logSummary.livenessWarnings.count,
embeddedRunTraceCount: logSummary.embeddedRuns.eventCount,
embeddedRunStartupTraceCount: logSummary.embeddedRuns.startupCount,
embeddedRunPrepTraceCount: logSummary.embeddedRuns.prepCount,
embeddedRunTraceMaxMs: logSummary.embeddedRuns.totalMaxMs,
embeddedRunTopStages: logSummary.embeddedRuns.topStages,
openclawProviderRequestMaxMs: timelineSummary.providerRequestMaxMs,
openclawChildProcessFailedCount: timelineSummary.childProcessFailedCount,
runtimeDepsStagingPluginId: timelineSummary.runtimeDepsStagePluginId,
runtimeDepsLogEvidence,
runtimeDepsInstallCount: runtimeDepsLogEvidence.installCount,
runtimeDepsInstallMaxMs: runtimeDepsLogEvidence.installMaxMs,
runtimeDepsPostbuildMaxMs: runtimeDepsLogEvidence.postbuildMaxMs,
coldRuntimeDepsInstallCount: runtimeDepsLogEvidence.coldStart.installCount,
coldRuntimeDepsStagingMs: runtimeDepsLogEvidence.coldStart.installMaxMs,
warmRuntimeDepsRestageCount: runtimeDepsLogEvidence.warmRestart.installCount,
warmRuntimeDepsStagingMs: runtimeDepsLogEvidence.warmRestart.installMaxMs,
runtimeDepsWarmReuseOk: runtimeDepsLogEvidence.warmRestart.installCount === null
? null
: runtimeDepsLogEvidence.warmRestart.installCount === 0,
pluginMetadataScanCount: openclawDiagnostics.pluginMetadataScanCount,
configNormalizationCount: openclawDiagnostics.configNormalizationCount,
runtimeDepsStagingMs,
eventLoopDelayMs,
providerModelTimingMs,
diagnosticCorrelation: buildDiagnosticCorrelation({
resourceSummary,
timelineSummary,
logSummary,