Primary finding
Telemetry ‘global updated_at’ logic does nothing when metrics table is empty (watchers never see changes)
- src/providers/telemetry.ts:161-165
When there are no rows in provider_metrics, the UPDATE affects 0 rows. The intent (comment) is to bump a global heartbeat so UI watch mode sees a change via MAX(updated_at), but with an empty table nothing changes, so getLastUpdatedTime continues to return 0 and watchers never update despite decisions/failures being recorded.
Recommendation
Implement a real heartbeat separate from per-provider metrics. Options: - Add a small meta table: CREATE TABLE IF NOT EXISTS meta (k TEXT PRIMARY KEY, v INTEGER NOT NULL); and upsert meta('last_updated', now) on every flush. - Or insert/update a dedicated sentinel row in provider_metrics (e.g., id='__heartbeat__') with ON CONFLICT(id) DO UPDATE SET updated_at=excluded.updated_at to guarantee at least one row exists. Prefer the meta table to avoid corrupting per-provider updated_at semantics.