summaryrefslogtreecommitdiffhomepage
path: root/src/features
diff options
context:
space:
mode:
Diffstat (limited to 'src/features')
-rw-r--r--src/features/chat/store.svelte.ts5
-rw-r--r--src/features/chat/store.test.ts8
2 files changed, 5 insertions, 8 deletions
diff --git a/src/features/chat/store.svelte.ts b/src/features/chat/store.svelte.ts
index f6c23fc..9beabfc 100644
--- a/src/features/chat/store.svelte.ts
+++ b/src/features/chat/store.svelte.ts
@@ -284,11 +284,6 @@ export function createChatStore(deps: ChatStoreDependencies): ChatStore {
if (transcript.sealedTurnId !== null) {
void syncTail();
void syncMetrics();
- } else if (msg.event.type === "step-complete") {
- // CR-6: backend persists chunks at step boundaries. Fetch them
- // as committed so trimTranscript can unload oldest chunks
- // uniformly — no unbounded provisional growth during long turns.
- void syncTail();
}
},
diff --git a/src/features/chat/store.test.ts b/src/features/chat/store.test.ts
index 2d75139..c1d62a6 100644
--- a/src/features/chat/store.test.ts
+++ b/src/features/chat/store.test.ts
@@ -1057,8 +1057,9 @@ describe("createChatStore", () => {
}
expect(store.chunks).toHaveLength(15);
- // Reader returns to the bottom — but provisional chunks are never unloaded,
- // so the deferred trim still can't shrink an all-provisional transcript.
+ // Reader returns to the bottom — the deferred trim now catches up.
+ // With no committed chunks, it drops the oldest provisional chunks
+ // (the in-flight turn) to stay within the limit.
atBottom = true;
store.handleDelta(
deltaEvent({
@@ -1071,7 +1072,8 @@ describe("createChatStore", () => {
stepId: "t1#15" as StepId,
}),
);
- expect(store.chunks).toHaveLength(16);
+ // 16 provisional, limit 10, quarter 3 → drop 6 oldest → 10 remain.
+ expect(store.chunks).toHaveLength(10);
store.dispose();
});