Show persistent timestamps for operation and teacher messages

This commit is contained in:
鲨鱼辣椒 committed 2026-09-29 18:02:54 +08:00
1 parent 3a175101c9
commit ead3407890
24 files changed
+355 -9

No files matched your search

+15
View File
@@ -37,6 +37,21 @@ function turn(index: number): TeacherRequest {
omittedMessages: 0, status: 'completed', response: '回答 ' + index };
}
describe('continuous conversation persistence', () => {
it('preserves individual completion times and reads older replies without backfilling or rewriting them', async () => {
const dir = await root();
const store = new TeacherConversationStore(dir, 'account', 'agent-a');
const topic = await store.ensure(definition, 1);
const old = turn(1), recent = { ...turn(2), finishedAt: '2026-09-29T08:01:42.000Z' };
topic.requests = [old, recent];
await store.save(topic);
const first = await new TeacherConversationStore(dir, 'account', 'agent-a').read();
expect(first.requests[0]).not.toHaveProperty('finishedAt');
expect(first.requests[1].finishedAt).toBe(recent.finishedAt);
const second = await new TeacherConversationStore(dir, 'account', 'agent-a').read();
expect(second.requests).toEqual(first.requests);
expect(second.requests[0].createdAt).toBe(old.createdAt);
});
it('repairs retained replies on every page without rewriting their files during restart recovery', async () => {
const dir = await root();
const store = new TeacherConversationStore(dir, 'account', 'agent-a');