Drop unused agent_messages.read_at column via migration v49 (M1)

The `agent_messages.read_at` column has had no production writer since
v12 moved read tracking into the per-viewer `agent_message_reads`
receipts table. It survived anyway, carrying a NULL through every SELECT
list and begging the next maintainer to accidentally read stale data
from it.

- v49 migration: `ALTER TABLE agent_messages DROP COLUMN read_at`
  (idempotent: skips if absent).
- messages.ts: SELECTs no longer fetch the column; per-viewer `readAt`
  is computed from `agent_message_reads` as before, with `null` for
  call-sites that have no viewer context (getAgentMessage /
  searchMessages / listAgentInboxUnread).
- runtime-bridge.ts / runtime-message-injector.ts: comments referencing
  the dropped column updated to name the read-receipts table instead.
This commit is contained in:
ZacharyZhang-NY committed 2026-04-20 12:20:32 -04:00
1 parent dade5eb333
commit d7e267031f
6 files changed
+90 -36

No files matched your search

+2
View File
@@ -14,6 +14,7 @@ import { createMigrationsV45V45 } from "./migrations/v45-v45";
import { createMigrationsV46V46 } from "./migrations/v46-v46";
import { createMigrationsV47V47 } from "./migrations/v47-v47";
import { createMigrationsV48V48 } from "./migrations/v48-v48";
import { createMigrationsV49V49 } from "./migrations/v49-v49";
import {
columnExists,
nowIso,
@@ -208,6 +209,7 @@ export function runMigrations(
...createMigrationsV46V46(deps),
...createMigrationsV47V47(deps),
...createMigrationsV48V48(deps),
...createMigrationsV49V49(deps),
];
// Pre-migration snapshot. If any migration is pending we take a full