Q144: each message says where the reply it asked for stands

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ZacharyZhang-NYandClaude Opus 5.5 committed 2026-10-09 00:08:32 -04:00
1 parent 075dea725a
commit 2a89d1e883
18 files changed
+211 -5

No files matched your search

@@ -0,0 +1,19 @@
// Every message that asked an agent for a reply, and the wake task answering it; a message folded into a queued wake shares its task.
export const chatReplyRequestsSchema = `
create table if not exists chat_reply_requests (
message_id text not null references chat_messages(id) on delete cascade,
agent_id text not null references agents(id) on delete cascade,
task_id text not null references tasks(id) on delete cascade,
created_at text not null,
primary key (message_id, agent_id)
);
insert or ignore into chat_reply_requests(message_id, agent_id, task_id, created_at)
select json_extract(r.secret_scope_json, '$.sourceMessageId'), r.agent_id, r.task_id, r.created_at
from task_runs r
where r.trigger = 'chat_mention'
and exists (select 1 from chat_messages m where m.id = json_extract(r.secret_scope_json, '$.sourceMessageId'));
insert into schema_migrations(version, name, applied_at)
values (100, 'chat_reply_requests', datetime('now'));
`;
+2
View File
@@ -98,6 +98,7 @@ import { dropChaosDrillsSchema } from "./migrations/096-drop-chaos-drills";
import { dropDrillOnlySloSchema } from "./migrations/097-drop-drill-only-slo";
import { dropAuditReplaysSchema } from "./migrations/098-drop-audit-replays";
import { dropRollbackRecordsSchema } from "./migrations/099-drop-rollback-records";
import { chatReplyRequestsSchema } from "./migrations/100-chat-reply-requests";
interface Migration {
version: number;
@@ -205,6 +206,7 @@ const MIGRATIONS: Migration[] = [
{ version: 97, name: "drop_drill_only_slo", sql: dropDrillOnlySloSchema },
{ version: 98, name: "drop_audit_replays", sql: dropAuditReplaysSchema },
{ version: 99, name: "drop_rollback_records", sql: dropRollbackRecordsSchema },
{ version: 100, name: "chat_reply_requests", sql: chatReplyRequestsSchema },
];
const SCHEMA_VERSION = MIGRATIONS[MIGRATIONS.length - 1].version;