Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(web): Compact chip follows Claude's real prompt cache TTL #17945

Mergedt3dotgg(GitHub profile, opens in a new tab)merged 1 commit intomain fromrefs/pull/17945/headmerged by t3dotgg(GitHub profile, opens in a new tab) View on GitHub

Showing 9 changed files with 58 additions and 0 deletions (loading 6).

x
0 of 9 viewed, 9 left
25 additions and 0 deletionsapps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.test.tsModified
View file
@@ -900,6 +900,31 @@
updatedAt: "2026-08-29T00:00:00.000Z",
});
});
+​
+ it("reports the prompt cache TTL the response wrote", () => {
+ const ttlFor = (cache_creation: {
+ ephemeral_1h_input_tokens: number;
+ ephemeral_5m_input_tokens: number;
+ }) =>
+ ClaudeAdapterV2.claudeProviderTurnTokenUsage(
+ { input_tokens: 1, output_tokens: 1, cache_creation },
+ CLAUDE_TEST_MODEL_SELECTION,
+ "2026-08-29T00:00:00.000Z",
+ ).promptCacheTtlMs;
+​
+ assert.strictEqual(
+ ttlFor({ ephemeral_1h_input_tokens: 2_000, ephemeral_5m_input_tokens: 300 }),
+ 60 * 60_000,
+ );
+ assert.strictEqual(
+ ttlFor({ ephemeral_1h_input_tokens: 0, ephemeral_5m_input_tokens: 300 }),
+ 5 * 60_000,
+ );
+ assert.strictEqual(
+ ttlFor({ ephemeral_1h_input_tokens: 0, ephemeral_5m_input_tokens: 0 }),
+ undefined,
+ );
+ });
});