#5110·cognee

schema/provenance scopes datasets by ownership while brains scopes by ACL — multi-user UI brain dropdown renders empty for ACL-shared datasets

Author: AdamClaassensCreated Sep 18, 2026Updated Sep 30, 2026

Describe the bug

GET /api/v1/schema/provenance/json (and the HTML /schema/provenance) scopes datasets by ownership (Dataset.owner_id == caller, or Dataset.tenant_id when the caller has a tenant), while every other read surface the multi-user UI relies on — GET /api/v1/visualize/brains, GET /api/v1/datasets — scopes by ACL grants (get_all_user_permission_datasets).

The consequence: a user who was granted read on other users' datasets (the documented POST /api/v1/permissions/datasets/{user_id} flow, or parent_user_id auto-share) sees them in /visualize/brains and /datasets, but gets zero Dataset nodes from provenance when they own no datasets themselves and have no tenant.

This breaks the frontend's Knowledge-Graph/Mindmap page: useGovernanceIndex builds the brain dropdown from the provenance payload's Dataset nodes, and BusinessView's auto-select of the first brain is deliberately driven by the governance list (not /visualize/brains, per the in-code comment about the 10s GET budget). With 0 Dataset nodes: the switcher dropdown is empty, no brain is auto-selected, the canvas stays empty — while /visualize/brains next to it returns 200 with every graph the user can read. The two endpoints disagree about what "readable" means, and the UI trusts the wrong one for listing.

Steps to reproduce (1.5.4, multi-user mode)

  1. ENABLE_BACKEND_ACCESS_CONTROL=true. User A owns dataset X; user B owns dataset Y. Neither has a tenant.
  2. As A, grant user C read on X; as B, grant C read on Y.
  3. GET /api/v1/visualize/brains as C → 200, both datasets with graphs.
  4. GET /api/v1/schema/provenance/json as C → 200, nodes contains no type: "Dataset" node at all (C owns nothing).
  5. Open the UI's Knowledge Graph page as C → empty brain dropdown, empty canvas.

Expected behavior

Provenance should project the same readable set the rest of the multi-user API does — scope datasets via get_all_user_permission_datasets(user, "read") (or at minimum union owned + ACL-readable), so an ACL-shared dataset appears as a Dataset node with its can_read-style edges (the ACL edge machinery in _read_roles_and_grants/_ACL_EDGE_RELATIONS already exists; it only ever sees datasets that survived the ownership filter).

Where

cognee/api/v1/visualize/memory_provenance.py, get_memory_provenance_graph:

python
dataset_stmt = select(Dataset).options(joinedload(Dataset.data))
if scope_tenant_ids is not None:
    dataset_stmt = dataset_stmt.where(Dataset.tenant_id.in_(scope_tenant_ids))
elif scope_user_ids is not None:
    dataset_stmt = dataset_stmt.where(Dataset.owner_id.in_(scope_user_ids))

Same code on dev as of filing. Frontend consumers: useGovernanceIndex (index.datasets feeds BrainSwitcher) and BusinessView auto-select.

Environment

  • cognee/cognee:1.5.4 (docker), Kubernetes, gunicorn 1 uvicorn worker
  • Multi-user mode on, EBAC true, graph kuzu, vector pgvector

Workaround

Put every user and dataset in one shared tenant (then scope_tenant_ids matches and all of the tenant's datasets appear). Not desirable for genuinely multi-tenant deployments, and it widens the governance view for every member.