Skip to content

Commit 66c621d

Browse files
saphidclaude
authored andcommitted
fix(server): carry saved Grok usage keys into the time-keyed form
Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent e3e79e1 commit 66c621d

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

‎apps/server/src/usage/usageScanCache.test.ts‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,9 @@ describe("scan cache round trip", () => {
269269
expect(v11.get("/grok/updates.jsonl")).toEqual({
270270
...original.get("/grok/updates.jsonl"),
271271
...reparse,
272+
records: [
273+
record({ provider: "grok", model: "grok-4.5", dedupeKey: "s:p:1786000000000:grok-4.5" }),
274+
],
272275
});
273276
});
274277

‎apps/server/src/usage/usageScanCache.ts‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,13 @@ export function decodeScanCache(
258258
...(version >= 7 && unresolvedServiceTierTurnId !== undefined
259259
? { unresolvedServiceTierTurnId }
260260
: {}),
261-
dedupeKey: typeof dedupeKey === "string" ? dedupeKey : null,
261+
dedupeKey:
262+
typeof dedupeKey !== "string"
263+
? null
264+
: // Saved copies of moved transcripts must still match the re-parsed v12 key.
265+
provider === "grok" && version < 12 && dedupeKey.endsWith(`:${model}`)
266+
? `${dedupeKey.slice(0, -model.length)}${timestampMs}:${model}`
267+
: dedupeKey,
262268
});
263269
}
264270
return records;

0 commit comments

Comments
 (0)