Skip to content

A run can lose every memory record it wrote and report "Retained 18/18" #10

Open

Description

@krapcys1-maker

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 reports Retained 18/18 eligible records
  • mirrorCanonicalRecordToB(record) still fires, so Memory B gets a record Memory A does not have, and computeSyncStatus reports missingInA — 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, retained does not increment, the mirror does not fire, and the run emits a warning event
  • return { attempted, retained, rejected, rejectionReasons }
  • emit warning when retained < attempted, and error when retained === 0 && attempted > 0
  • move isHindsightIndexSyncEnabled() outside the loop and narrow the catch to WriteGateError

Activity

  1. added
    help wanted
    infrastructure
    silent-failure
    on Aug 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedinfrastructuresilent-failure

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions