Repository navigation
fix(api): skip unsupported block-children errors instead of aborting sync - #60
Conversation
…sync
GET /blocks/{id}/children returns a 400 validation_error when a page
contains a block type the integration cannot receive (seen with Notion
AI blocks: "Block type ai_block is not supported via the API for your
bot type."). This aborted the entire sync --source api run, regardless
of how many other pages were left to sync.
Classify this specific 400 as non-fatal: skip the unfetchable children
batch, record a warning, and continue. The page_blocks "complete" sync
marker and RetireSourcePageBlocksNotSyncedAt are both now gated on zero
warnings, so a page that synced cleanly before does not have its
previously-synced blocks retired the next time it also contains one
unfetchable block.
Adds isUnsupportedBlockChildrenError and threads a []string warnings
return through walkBlocksAt -> walkBlocks -> ingestPage -> Sync,
reusing the existing Summary.Warnings / writeAPIWarnings stderr path
already used for the forbidden-/users and restricted-resource cases.
Covered by three new tests:
- TestWalkBlocksSkipsUnsupportedBlockChildren
- TestIngestPageLeavesIncompleteWhenBlockChildrenUnsupported
- TestWalkBlocksDoesNotRetirePreviousBlocksOnPartialWalk
Fixes openclaw#59
|
Codex review: needs maintainer review before merge. Reviewed July 14, 2026, 2:15 PM ET / 18:15 UTC. Summary Reproducibility: no. fresh live reproduction was established on current main SHA d9540fd, but the exact pre-fix request, response, propagation path, and production failure are documented well enough to reproduce from source and a suitable Notion workspace. Review metrics: 3 noteworthy metrics.
Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Land the narrow warning-based recovery while retaining prior blocks whenever traversal is incomplete, after refreshing the focused tests and full Go validation against current main. Do we have a high-confidence way to reproduce the issue? No fresh live reproduction was established on current main SHA d9540fd, but the exact pre-fix request, response, propagation path, and production failure are documented well enough to reproduce from source and a suitable Notion workspace. Is this the best way to solve the issue? Yes. Narrowly classifying the known unsupported response as a warning while withholding completion and retirement on partial traversal is safer than aborting the workspace sync or pretending the page was fully synchronized. AGENTS.md: unclear because the file could not be read completely. Codex review notes: model internal, reasoning high; reviewed against d9540fd763f9. Label changesLabel changes:
Label justifications:
Evidence reviewedWhat I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
Review history (1 earlier review cycle)
|
|
Maintainer refresh on exact head
The exact ai-block live clause could not be rerun locally because the existing environment reports Hosted CI did not emit for this fork update; only autolabel passed and release-draft skipped. No merge performed. |
Summary
GET /blocks/{id}/childrenreturns a 400validation_errorwhen a page contains a block type the API cannot return to this integration (seen with Notion AI blocks: "Block type ai_block is not supported via the API for your bot type."). That error propagated unhandled and aborted the entiresync --source apirun, the same failure shape as #37 and #39 but a different Notion block type triggering it.This classifies that specific 400 as non-fatal: skip the unfetchable children batch, record a warning (surfaced the same way existing warnings already are, via
Summary.Warnings/writeAPIWarningson stderr), and keep syncing the rest of the workspace. It also gates thepage_blocks"complete" marker andRetireSourcePageBlocksNotSyncedAton zero warnings: without that gate, a page that synced cleanly before would have its already-synced blocks retired the next run it also happens to contain one unfetchable block. An independent review pass (Claude Opus 4.8) caught that specific regression before this PR was opened, see Model used below.Linked issue
Fixes #59
Type of change
How to test
GOWORK=off go test ./...,go vet ./...,gofmt -l .all clean, including the 3 new tests (TestWalkBlocksSkipsUnsupportedBlockChildren,TestIngestPageLeavesIncompleteWhenBlockChildrenUnsupported,TestWalkBlocksDoesNotRetirePreviousBlocksOnPartialWalk).go build ./cmd/notcrawl, then runnotcrawl sync --source apiagainst a workspace with anai_blockpresent. I ran this against my own production workspace (7,573 pages, one page with anai_block) and confirmed the patched binary gets past the exact page the unpatched binary aborted on, printingwarning: Skipped children of block ... on page ...to stderr instead of dying.Checklist
Model used
Claude Sonnet 5 implemented this. A separate Claude Opus 4.8 pass independently reviewed the diff and caught a real bug: the first version only gated
SetSyncState(..., "complete")on the warnings, missing thatRetireSourcePageBlocksNotSyncedAtneeded the same gate, or a previously-clean page would lose its valid blocks the next time it also hit one unfetchable block. That fix is included here.🤖 Generated with Claude Code (Claude Sonnet 5)
🧑💻 Ideated, directed and reviewed by a human, @Omee11