diff --git a/src/shared/components/RequestLoggerDetail.tsx b/src/shared/components/RequestLoggerDetail.tsx
index 9e4d74bae5..4cf4bf00c8 100644
--- a/src/shared/components/RequestLoggerDetail.tsx
+++ b/src/shared/components/RequestLoggerDetail.tsx
@@ -519,16 +519,12 @@ export default function RequestLoggerDetail({
Total In: {formatTokenValue(tokenStats.totalIn)}
- {tokenStats.cacheRead != null && tokenStats.cacheRead > 0 && (
-
- Cache Read: {formatTokenValue(tokenStats.cacheRead)}
-
- )}
- {tokenStats.cacheWrite != null && tokenStats.cacheWrite > 0 && (
-
- Cache Write: {formatTokenValue(tokenStats.cacheWrite)}
-
- )}
+
+ Cache Read: {formatTokenValue(tokenStats.cacheRead)}
+
+
+ Cache Write: {formatTokenValue(tokenStats.cacheWrite)}
+
{tokenStats.compressed != null &&
tokenStats.compressed > 0 &&
(() => {
diff --git a/tests/unit/request-log-detail-layout.test.ts b/tests/unit/request-log-detail-layout.test.ts
index b35afb4d5f..4e2a035ed1 100644
--- a/tests/unit/request-log-detail-layout.test.ts
+++ b/tests/unit/request-log-detail-layout.test.ts
@@ -116,9 +116,8 @@ test("request log detail splits token badges into input and output groups", () =
assert.match(
html,
- /data-testid="token-group-input"[\s\S]*Total In: 21[\s\S]*818[\s\S]*Cache Read: 21[\s\S]*632/
+ /data-testid="token-group-input"[\s\S]*Total In: 21[\s\S]*818[\s\S]*Cache Read: 21[\s\S]*632[\s\S]*Cache Write: N\/A/
);
- assert.equal(html.includes("Cache Write:"), false);
assert.match(html, /data-testid="token-group-output"[\s\S]*Total Out: 42[\s\S]*Reasoning: N\/A/);
});
diff --git a/tests/unit/ui/request-logger-cache-tokens.test.tsx b/tests/unit/ui/request-logger-cache-tokens.test.tsx
index bdba7d771a..21f2797fa6 100644
--- a/tests/unit/ui/request-logger-cache-tokens.test.tsx
+++ b/tests/unit/ui/request-logger-cache-tokens.test.tsx
@@ -132,7 +132,7 @@ describe("request log cache token metrics (#9620)", () => {
expect(outputGroup?.textContent).toContain("Reasoning: 50");
});
- it("omits cache metrics when historical logs contain zero or null values", async () => {
+ it("handles historical null and zero cache values without inventing usage", async () => {
const emptyCacheLog = {
...populatedLog,
id: "log-no-cache",
@@ -151,8 +151,8 @@ describe("request log cache token metrics (#9620)", () => {
);
const inputGroup = container.querySelector('[data-testid="token-group-input"]');
- expect(inputGroup?.textContent).not.toContain("Cache Read");
- expect(inputGroup?.textContent).not.toContain("Cache Write");
+ expect(inputGroup?.textContent).toContain("Cache Read: N/A");
+ expect(inputGroup?.textContent).toContain("Cache Write: 0");
expect(inputGroup?.textContent).toContain("Total In: 1,000");
});
});