Repository navigation
Description
A run can lose every memory record it tried to write and still report success.
Two independent paths
1. The canonical write is swallowed. src/lib/research-memory/hindsight-provider.ts — writeCanonicalMetadata turns every error into a logger.warn and returns normally. retain() therefore returns { id, deduped: false } — success — with no CanonicalMemoryRecord row.
Downstream in pipeline-bridge.ts:
retained++fires, so MetaReview reportsRetained 18/18 eligible recordsmirrorCanonicalRecordToB(record)still fires, so Memory B gets a record Memory A does not have, andcomputeSyncStatusreportsmissingInA— drift blamed on B- on every future recall that record is silently dropped (see the recall-resolution issue)
The warning at the throw site is honest — "recall will drop this record until repaired" — and is the only signal, on no surface the run reports.
2. The write gate rejection is an info event. The per-record catch logs and continues. There is no rejection counter and no rejected field on the return value, and MetaReview emits:
eventType: "info",
message: `Retained ${retention.retained}/${retention.attempted} eligible records.`Retained 0/18 is an info event. Nothing gates run completion on it.
The catch is also bare and labels every exception a write-gate rejection — including a config throw from isHindsightIndexSyncEnabled(), which sits inside the try and after retained++. That path yields: record counted as retained, mirror never fired, and a log line blaming the write gate.
Suggested fix
- make the canonical write authoritative: on failure
retain()returns a failed result,retaineddoes not increment, the mirror does not fire, and the run emits a warning event - return
{ attempted, retained, rejected, rejectionReasons } - emit
warningwhenretained < attempted, anderrorwhenretained === 0 && attempted > 0 - move
isHindsightIndexSyncEnabled()outside the loop and narrow the catch toWriteGateError
Activity