The best way to control Claude Code, Codex and more from any computer or phone
fix(web): resource monitor no longer claims to sample every 0 ms (#29749)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Julius Marminge <julius0216@outlook.com>
Mokhles elheni committed
Nov 15, 2026 at 06:19 UTC
b8bffc8b350e61c1b6d868a331026839c25ec906
3 files changed
+31
-10
apps/web/src/components/settings/ResourceTelemetryDiagnostics.logic.test.ts
+11
@@ -5,6 +5,7 @@ import * as DateTime from "effect/DateTime";
5
6
import {
7
formatCpuTime,
8
+ formatSamplingStatus,
9
visibleResourceTelemetryProcesses,
10
} from "./ResourceTelemetryDiagnostics.logic";
11
@@ -60,3 +61,13 @@ describe("formatCpuTime", () => {
61
]);
62
});
63
});
64
+
65
+describe("formatSamplingStatus", () => {
66
+ it("reads an idle interval as on demand rather than every 0 ms", () => {
67
+ expect([0, 500, 2_000].map((intervalMs) => formatSamplingStatus(intervalMs))).toEqual([
68
+ "Sampling on demand",
69
+ "Sampling every 500 ms",
70
+ "Sampling every 2 seconds",
71
+ ]);
72
+ });
73
+});
apps/web/src/components/settings/ResourceTelemetryDiagnostics.logic.ts
+10
@@ -68,3 +68,13 @@ export function formatCpuTime(seconds: number): string {
68
if (Number(shortMinutes) < 60) return `${shortMinutes}m`;
69
return `${(seconds / 3_600).toFixed(2).replace(/\.0+$/, "")}h`;
70
}
71
+
72
+export function formatSamplingStatus(intervalMs: number): string {
73
+ // The server reports 0 while the native monitor is idle and samples only on request.
74
+ if (intervalMs <= 0) return "Sampling on demand";
75
+ if (intervalMs < 1_000) return `Sampling every ${Math.round(intervalMs)} ms`;
76
+ const seconds = intervalMs / 1_000;
77
+ return `Sampling every ${seconds.toLocaleString(undefined, { maximumFractionDigits: 1 })} ${
78
+ seconds === 1 ? "second" : "seconds"
79
+ }`;
80
+}
apps/web/src/components/settings/ResourceTelemetryDiagnostics.tsx
+10
-10
@@ -54,6 +54,7 @@ import { Tooltip, TooltipPopup, TooltipTrigger } from "../ui/tooltip";
54
import { toastManager } from "../ui/toast";
55
import {
56
formatCpuTime,
57
+ formatSamplingStatus,
58
processIdentityKey,
59
resourceHistoryBarHeight,
60
resourceHistoryCpuScaleMax,
@@ -79,14 +80,6 @@ function formatDurationMicros(value: number): string {
80
return `${(value / 1_000_000).toFixed(2).replace(/\.0+$/, "")} s`;
81
}
82
82
-function formatSampleInterval(valueMs: number): string {
83
- if (valueMs < 1_000) return `${Math.max(0, Math.round(valueMs))} ms`;
84
- const seconds = valueMs / 1_000;
85
- return `${seconds.toLocaleString(undefined, { maximumFractionDigits: 1 })} ${
86
- seconds === 1 ? "second" : "seconds"
87
- }`;
88
-}
89
-
83
function formatProcessName(process: Pick<ResourceTelemetryProcess, "command" | "name">): string {
84
if (process.name.trim()) return process.name;
85
const firstToken = process.command.trim().split(/\s+/)[0] ?? process.command;
@@ -1001,8 +994,15 @@ function ResourceTelemetryDiagnosticsBody({
994
</p>
995
</div>
996
<div className="flex items-center gap-2 text-3xs text-muted-foreground/65">
1004
- <span className="size-1.5 rounded-full bg-success" />
1005
- Sampling every {snapshot ? formatSampleInterval(snapshot.sampleIntervalMs) : "..."}
997
+ <span
998
+ className={cn(
999
+ "size-1.5 rounded-full",
1000
+ snapshot && snapshot.sampleIntervalMs > 0
1001
+ ? "bg-success"
1002
+ : "bg-muted-foreground/55",
1003
+ )}
1004
+ />
1005
+ {snapshot ? formatSamplingStatus(snapshot.sampleIntervalMs) : "Sampling every ..."}
1006
</div>
1007
</div>
1008
<div className="grid grid-cols-2 divide-x divide-y divide-border/55 md:grid-cols-3">