@devries-cameron20 / t3code Mirror · read-only / commits / 0e9677965c
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 25, 16:00 UTC

Spill full buffered assistant text when buffer exceeds cap

- Change provider runtime ingestion to flush the entire buffered assistant text once it crosses the max size - Remove partial-retention logic and its keep-chars constant to simplify memory safety behavior

Julius Marminge committed Feb 26, 2026 at 20:24 UTC 0e9677965cca02d925244e7814a245a194bd42de
1 file changed +3 -7
apps/server/src/orchestration/Layers/ProviderRuntimeIngestion.ts
+3 -7
@@ -31,7 +31,6 @@ const BUFFERED_MESSAGE_TEXT_BY_MESSAGE_ID_TTL = Duration.minutes(120);
31 const BUFFERED_ASSISTANT_MESSAGE_SPILLED_CACHE_CAPACITY = 20_000;
32 const BUFFERED_ASSISTANT_MESSAGE_SPILLED_TTL = Duration.minutes(120);
33 const MAX_BUFFERED_ASSISTANT_CHARS = 24_000;
34 -const BUFFERED_ASSISTANT_KEEP_CHARS = 8_000;
34
35 type TurnStartRequestedDomainEvent = Extract<
36 OrchestrationEvent,
@@ -245,12 +244,9 @@ const make = Effect.gen(function* () {
244 return "";
245 }
246
248 - // Safety valve: spill oldest text as a persisted assistant delta to cap memory.
249 - const spillChars = Math.max(1, nextText.length - BUFFERED_ASSISTANT_KEEP_CHARS);
250 - const spillChunk = nextText.slice(0, spillChars);
251 - const retainedTail = nextText.slice(spillChars);
252 - yield* Cache.set(bufferedAssistantTextByMessageId, messageId, retainedTail);
253 - return spillChunk;
247 + // Safety valve: spill full buffered text as a persisted assistant delta to cap memory.
248 + yield* Cache.invalidate(bufferedAssistantTextByMessageId, messageId);
249 + return nextText;
250 }),
251 ),
252 );