[Bounty proposal] fix(notion-app): get_page reads only the first 50 blocks and never follows next_cursor
Description
In plugins/omi-notion-app/main.py, tool_get_page reads a page's content with a single GET /blocks/{page_id}/children?page_size=50 and never looks at has_more / next_cursor. Notion pages block children (max 100 per page) and signals the remainder through next_cursor.
The rendered content is separately capped at 1,000 characters — but the two limits are unrelated, and the block limit wins far more often than the character cap:
- only blocks with
rich_textrender to text (extract_text_content), so dividers, images, embeds, child pages, tables and the empty paragraphs people use as spacing all count toward the 50 while producing nothing; - to-do, bulleted and numbered lists render a handful of characters per block.
So an ordinary page with a few spacers/media, or any list-style page longer than 50 items, has everything after its 50th block silently dropped even though it would have fit in the 1,000-character budget — and the tool reports success with no sign anything is missing.
Evidence (current main): tool_get_page → notion_api_request(uid, "GET", f"/blocks/{page_id}/children", params={"page_size": 50}), then content[:1000]. No cursor handling anywhere on the read path (append_content_batches is the write path).
Proposed Fix
fetch_page_blocks(uid, page_id): follownext_cursor(page size 100, Notion's maximum) untilhas_moreis false or the rendered text reaches the content cap — so the cap is the only thing that truncates and no page beyond it is fetched. Page ceiling + repeated-cursor detection guard against a malformed cursor.- A failure on a later page returns that page's error, so the existing fail-closed path from #13181 reports it — a read that failed halfway is never a shorter successful page.
- Regression tests in the existing
test_main.pysuite (already registered asnotion-page-content-tests): the 51st block must appear, budget-met stops fetching, later-page HTTP/transport failure is an error, repeated cursor stops, page ceiling.
Same class as #13545 (github-app labels), #13810 (dropbox list_folder) and #13913 (ms365 calendarView).
Proposed Bounty Reward: $50.00 USD
Bounty Payout Destination (PayPal): [email protected]
cc @josancamon19 @kodjima33
PR up: https://github.com/BasedHardware/omi/pull/13916
Happy to adjust anything — I'll turn review comments around the same day.