Skip to content

backend-sync logs repeated Firestore No document to update tracebacks during KG extraction #9137

Closed

Description

@Git-on-my-level

Summary

backend-sync is repeatedly logging full tracebacks when KG extraction tries to mark a memory doc as extracted but the Firestore document no longer exists.

This appears to be a stale/deleted document race rather than a broad outage, but the volume is noisy and can hide real failures.

Evidence

Observed during read-only prod health checks on 2026-07-06 UTC:

  • Earlier check: 33 backend-sync tracebacks in the previous 2h.
  • Later check: 72 backend-sync tracebacks in the previous 2h.
  • Representative failure shape:
google.api_core.exceptions.NotFound: 404 No document to update:
projects/based-hardware/databases/(default)/documents/users/<redacted>/memories/<redacted>

File "/app/utils/conversations/process_conversation.py", line 564, in _extract_memories_inner
  set_memory_kg_extracted(uid, memory_db_obj.id)
File "/app/database/memories.py", line 228, in set_memory_kg_extracted
  memory_ref.update({'kg_extracted': True})

User IDs and memory IDs redacted here.

Expected behavior

If the memory was deleted or superseded while KG extraction was in flight, this should be handled as an expected stale-work race, not emitted as a full ERROR traceback.

If it indicates real data loss or ordering bugs, the logs should include compact structured context and a metric rather than repeated unbucketed tracebacks.

Acceptance criteria

  • Classify No document to update during set_memory_kg_extracted as expected stale/deleted-memory race where appropriate.
  • Avoid full traceback spam for expected stale work; use structured warning/info with redacted IDs or counters.
  • Preserve true unexpected Firestore failures as errors.
  • Add a regression test for KG extraction completing after a memory doc has been deleted/superseded.
  • Verify the prod backend-sync traceback bucket drops after deploy.

Priority

P2/P3: not currently outage-shaped, but high-volume prod error noise in the memory pipeline.

Activity

  1. added
    bug
    backend
    memory
    p2
    on Jul 6, 2026
  2. added a commit that references this issue on Jul 7, 2026
    fe5eb49
  3. added a commit that references this issue on Jul 7, 2026
    3852c86
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

    backendbugmemoryp2

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions