[Bug] A transient LLM failure in L1 extraction permanently advances the cursor — the failed session's content is silently lost and never retried

Author: 732618078Created Sep 26, 2026Updated Sep 29, 2026

Summary

On MemoryCore 2.0.0-beta.1, when the LLM call inside L1 extraction fails (e.g. provider rate limit), the extraction result is swallowed as a soft {success: false, ...} return, but the pipeline runner never inspects success and unconditionally marks L1 extraction complete. Because the checkpoint cursor is monotonic and the re-trigger path skips "already processed" sessions, the affected session's content is permanently skipped — a transient failure becomes silent data loss for that conversation (until unrelated new messages arrive for the same session).

Source evidence (evidence chain)

  • MemoryCore/src/core/record/l1-extractor.ts:202-205 — the catch around the LLM call logs the error and returns { success: false, extractedCount: 0, storedCount: 0, records: [], sceneNames: [] }; nothing throws.
  • MemoryCore/src/utils/pipeline-factory.ts:589-648 — the L1 runner consumes l1Result only for counters (totalExtracted, totalStored, scene names); l1Result.success is never checked, and checkpoint.markL1ExtractionComplete(sessionKey, totalStored, maxRecordedAtMs, ...) is called unconditionally for the processed slice.
  • MemoryCore/src/utils/checkpoint.ts:616-643 — markL1ExtractionComplete advances last_l1_cursor monotonically (max-wins), so the failed slice's messages are never re-selected.
  • MemoryCore/src/gateway/server.ts:2696-2703 — re-triggering is skipped for processed sessions: L1 skipped: session ... already processed (count=0) (dedup for triggeredBy === "timer_scanner").

Net effect: transient LLM failure → cursor advances → every later trigger skips the session → the conversation's L1 atoms never materialize.

Measured (standalone Gateway, node 22)

Feeding 18 sessions without throttling triggered the LLM provider's rate limit (Failed after 3 attempts — account rate limit reached). 8 of 18 sessions failed L1 extraction, were nevertheless marked processed, and were permanently skipped (L1 skipped: already processed) on every subsequent trigger. Re-running the same corpus with a 12 s/session feed succeeded 18/18 — confirming the losses were transient-failure artifacts, not content or configuration problems. Integration-side workaround we currently carry: throttle the feed, and reconcile after write (verify per-session L1 atom output; re-send a trigger message when missing) — but the engine itself should not advance the cursor on failure.

Suggested fix

Only call markL1ExtractionComplete when the L1 result for the group indicates success (check l1Result.success / per-group success), or dead-letter failed sessions for retry with a retry budget. Regression test: inject a failing llmRunner for the first extraction pass, assert the cursor does not advance and a later trigger re-attempts extraction.

Environment

Found during an integration spike against a throwaway copy of the TAM tree (product tree untouched; Gateway standalone, SQLite default). Happy to open a PR with a fix + regression test if that is preferred.

Source: TencentCloud/TencentDB-Agent-Memory