Skip to content

[Fix] Discover pages inside shared Notion databases - #1825

Merged
mrubens merged 2 commits into
developfrom
fix/notion-database-pages
Aug 29, 2026
Merged

[Fix] Discover pages inside shared Notion databases#1825
mrubens merged 2 commits into
developfrom
fix/notion-database-pages

Conversation

@mrubens

@mrubens mrubens commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

Problem

Pages that live inside Notion databases (database rows) were missing from both the Memory (gbrain) collector and the deployment Notion MCP.

Root cause: Notion's search API only guarantees content directly shared with an integration — rows inherit access through their database but rarely appear in the search index (documented limitation). The collector's sweep searches object: page only, and the traversal phase (#1726) could only discover databases embedded as child_database blocks inside already-inventoried pages. A database shared directly with the integration (e.g. a top-level database) was therefore invisible: its rows never entered Memory. The MCP proxied the same search index, and a database ID couldn't be fetched at all (pages/{id} and data_sources/{id} both 404 for it).

Changes

Collector (apps/bullmq/.../notion-pages.ts)

  • The traversal phase now first enumerates every shared data source via search with filter: data_source, feeding each into the existing data_source query path so their rows ingest like any other discovered page.
  • The enumeration is durable across passes (dataSourceCursor/dataSourcesDone in the traverse state) and backward-compatible with in-flight cursors; an expired search cursor restarts the enumeration instead of wedging the collector.

MCP (apps/api/.../notion/tools.ts)

  • notion-fetch gains object_type: "database" (GET databases/{id}), so agents can resolve a database ID to its data sources.
  • notion-search's description now steers agents around the index gap: find the data source, then list rows with notion-query-data-sources.

Docs: apps/docs/integrations/notion.mdx describes the database-row discovery.

Tests

  • New: directly-shared data-source discovery; stale-cursor restart of the enumeration.
  • Existing traversal tests pinned to dataSourcesDone: true to keep their original focus.
  • All 23 collector tests and 7 MCP tests pass; lint, types, and knip clean.

Note: verified against Notion's API docs and unit tests (no live Notion connection in local dev). After deploy, missing rows are picked up on the next daily sweep → traverse cycle.

@roomote-community

roomote-community Bot commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

No code issues found. See task

Reviewed f56c39f

@mrubens
mrubens merged commit d55de21 into develop Aug 29, 2026
19 checks passed
@mrubens
mrubens deleted the fix/notion-database-pages branch August 29, 2026 02:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant