Skip to content

graph: namespace=null returns stale nodes (deprecated memories, orphaned links) #1189

Closed

Description

@ajianaz

Summary

Store::graph_data(namespace: None) returns GraphStore::all_nodes() unfiltered. Two leakage classes:

  1. Deprecated memories: the namespace-filtered path joins against memories ... AND deprecated = 0, but the unfiltered path (namespace = null) returns nodes whose memory has since been deprecated/forgotten. Orphaned memory nodes never leave the graph.
  2. Stale entity nodes: entity nodes (memory_id IS NULL) are documented as "always included (shared across namespaces)" — that is fine — but memory-linked nodes for memories in other namespaces are also included when no namespace filter is passed, which surprised a consumer expecting namespace=null ≈ "default namespace only".

Observed in sandbox: 320 seeded memories produced a 613-node graph via GET /graph (no namespace) because a second seed run left nodes from the first run in place; nodes had no deprecated-aware cleanup path.

Proposed fix

  • Filter memory-linked nodes by their parent memory's existence and deprecated = 0 in graph_data regardless of the namespace argument
  • Optionally add a GET /graph/{id}/prune or maintenance hook to drop nodes whose memory_id no longer resolves

Found during

Corin web audit (2026-09-06), while verifying graph label enrichment (codecoradev/corin#318).

Scope: core · Priority: medium — graph silently grows stale nodes on every forget/deprecate.

Activity

  1. added
    bug
    on Sep 6, 2026
  2. ajianaz commented on Sep 6, 2026

    @ajianaz
    CollaboratorAuthor

    Fixed in #1190 (merged 8a28aef): graph_data filters memory-linked nodes by liveness (memory exists AND deprecated = 0) in every path, edges touching removed nodes are dropped, and stats counts the filtered graph.

  3. added a commit that references this issue on Sep 6, 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

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions