@devries-cameron20 / t3code Mirror · read-only / commits / a2a1f2b50f
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 22, 08:15 UTC

perf(server): stop measuring replay bytes once over budget (#27405)

Narayan Joshi committed Nov 2, 2026 at 03:14 UTC a2a1f2b50f0188e66c353fe7a7e23469cce0491b
1 file changed +5 -1
apps/server/src/orchestration-v2/ThreadStream.ts
+5 -1
@@ -26,11 +26,15 @@ export function isThreadReplayRawPayloadSafe(rawPayloadBytes: number): boolean {
26 return rawPayloadBytes <= THREAD_RESUME_MAX_RAW_PAYLOAD_BYTES;
27 }
28
29 -export function threadReplayEncodedBytes(items: ReadonlyArray<unknown>): number {
29 +export function threadReplayEncodedBytes(
30 + items: ReadonlyArray<unknown>,
31 + limit: number = THREAD_RESUME_MAX_REPLAY_ENCODED_BYTES,
32 +): number {
33 let total = 0;
34 for (const item of items) {
35 const encoded = JSON.stringify(item);
36 total += Buffer.byteLength(encoded ?? "", "utf8");
37 + if (total > limit) break;
38 }
39 return total;
40 }