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:
1 parent
31ab919334
commit
22632a4695
8 files changed
+91
-28
No files matched your search
@@ -328,7 +328,8 @@ describe("chat governance", () => {
|
||||
expect(slashByMessage.get(fileMessageId)).toMatchObject({ command: "file", resultRef: fileId });
|
||||
expect(slashByMessage.get(runbookMessageId)).toMatchObject({ command: "runbook", resultRef: runbookMessageId });
|
||||
expect(slashByMessage.get(handoffMessageId)).toMatchObject({ command: "handoff", resultRef: fileId });
|
||||
const agentTask = state.tasks.find((item) => item.assigneeAgentId === agentId && item.title === "Chat mention: review the gate");
|
||||
const wakeTaskId = (connection.db.prepare("select id from tasks where assignee_agent_id = ? and origin = 'chat_wake'").get(agentId) as { id: string }).id;
|
||||
const agentTask = state.tasks.find((item) => item.id === wakeTaskId);
|
||||
expect(agentTask).toMatchObject({
|
||||
orgId,
|
||||
assigneeAgentId: agentId,
|
||||
@@ -337,7 +338,9 @@ describe("chat governance", () => {
|
||||
priority: "high",
|
||||
requiresFilesystem: false,
|
||||
});
|
||||
expect(agentTask?.description).toContain(`Source message: ${agentMessageId}`);
|
||||
expect(agentTask?.title).toMatch(/^Reply to /);
|
||||
expect(agentTask?.description).toContain("their full message is in the thread below");
|
||||
expect(agentTask?.description).not.toContain("review the gate");
|
||||
const agentRun = state.taskRuns.find((item) => item.taskId === agentTask?.id);
|
||||
expect(agentRun).toMatchObject({
|
||||
orgId,
|
||||
|
||||
@@ -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();
|
||||
});
|
||||
});
|
||||
@@ -24,7 +24,7 @@ describe("domain services", () => {
|
||||
const connection = createConnection();
|
||||
|
||||
const rows = connection.db.prepare("select version from schema_migrations order by version asc").all() as Array<{ version: number }>;
|
||||
expect(rows.map((row) => row.version)).toEqual([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59]);
|
||||
expect(rows.map((row) => row.version)).toEqual([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60]);
|
||||
connection.close();
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user