Keep older legacy chat history reachable from initial and explicit numeric pages when native message IDs are unavailable. Use the page’s existing numeric-pagination metadata and reader-owned hasOlder result, preserving hidden-prefix exhaustion, native cursor/source fences, and byte budgets.
Preserve the centered-page cursor metadata contract. Add real legacy CLI-import regressions for limits one and two, with lossless numeric traversal, and retain default/explicit hidden-prefix and byte-limited cursor coverage.
Verification: original Gateway assertions reproduced on the unmodified base; new legacy initial cases fail on the previous implementation. The coherent repair passes 106 actual Bun cases, core production and 29 dependent test type graphs, changed lint/format/ratchets, and fresh independent review. Current-head CI and protected landing are recorded separately in the native receipt.
Work session: https://team.openclaw.ai/chat/roboclaw/~key/dashboard/f2d13397-ed54-4d44-ade1-12b2edc3d0e3
Co-authored-by: vincentkoc [email protected]