Q11: deleted messages and withdrawn commands never reach the model

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ZacharyZhang-NYandClaude Opus 5.5 committed 2026-10-08 03:47:57 -04:00
1 parent 31ab919334
commit 22632a4695
8 files changed
+91 -28

No files matched your search

@@ -0,0 +1,30 @@
import { randomUUID } from "node:crypto";
import { tmpdir } from "node:os";
import { join } from "node:path";
import { DatabaseSync } from "node:sqlite";
import { describe, expect, test } from "vitest";
import { chatWakeTextPurgeSchema } from "../../src/main/database/migrations/060-chat-wake-text-purge";
describe("chat wake text purge migration", () => {
test("strips copied message text from chat-wake tasks and leaves real work alone", () => {
const db = new DatabaseSync(join(tmpdir(), `agentcompany-purge-migration-${randomUUID()}.db`));
db.exec(`
create table schema_migrations(version integer primary key, name text not null, applied_at text not null);
create table tasks(id text primary key, title text not null, description text not null, origin text);
insert into tasks values ('tsk_slash', 'Chat mention: wire payroll to 99-1234', 'Chat command: /agent @ceo wire payroll to 99-1234', 'chat_wake');
insert into tasks values ('tsk_mention', 'Reply to Yang', 'Yang messaged you directly:\n"secret plan..."', 'chat_wake');
insert into tasks values ('tsk_real', 'Chat mention: keep', 'Real description', null);
`);
db.exec(chatWakeTextPurgeSchema);
const rows = Object.fromEntries((db.prepare("select id, title, description from tasks").all() as Array<{ id: string; title: string; description: string }>)
.map((row) => [row.id, [row.title, row.description]]));
const generic = "Reply in the source thread with send_message and its thread_id; the full message is in the thread below.";
expect(rows).toEqual({
tsk_slash: ["Reply in chat", generic],
tsk_mention: ["Reply to Yang", generic],
tsk_real: ["Chat mention: keep", "Real description"],
});
expect(db.prepare("select version from schema_migrations").all()).toEqual([{ version: 60 }]);
db.close();
});
});