-
Notifications
You must be signed in to change notification settings - Fork 7k
session: paginate message loading #6656
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ry2009
wants to merge
1
commit into
anomalyco:dev
Choose a base branch
from
ry2009:feat/session-message-pagination
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
+200
−9
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Contributor
Author
|
maybe a separate pr ab implementing real windowing for true virtualization |
CasualDeveloper
added a commit
to CasualDeveloper/opencode
that referenced
this pull request
Jan 14, 2026
Implements Issue anomalyco#6548: Cursor-based pagination to support long session histories without performance degradation. This builds on the approach from PR anomalyco#6656 by @ry2009, addressing the feedback from that review and adding additional features. Backend: - Add `before` and `after` cursor support to Session.messages and API - Add Binary.lowerBound to util for efficient cursor lookup on ULIDs - Use Promise.allSettled for graceful handling of deleted messages - Add LRU cache for Storage.list (100 entries, 30s TTL) with invalidation - Return RFC 5005 compliant Link headers (rel="prev"/rel="next") - Return 400 when both cursors specified (mutual exclusion) - Validate cursors via Zod schema with graceful fallback TUI: - Track message_page state with hasOlder/hasNewer flags - Implement loadOlder/loadNewer with scroll position restoration - Memory-bound to 500 messages with 50-message eviction chunks - Skip live SSE inserts when detached from head (hasNewer=true) - Add error state handling for failed pagination requests Improvements over PR anomalyco#6656: - Bi-directional pagination (before + after cursors) - Proper parseLinkHeader utility with comprehensive tests - Memory bounding to prevent unbounded growth - LRU caching to reduce Storage.list calls - Error state feedback instead of silent failures - RFC 5005 compliant Link header semantics Other fixes: - Add cache invalidation to import command Tests: - messages-pagination.test.ts: cursor, boundary, deletion tests (5 tests) - session-messages.test.ts: API validation, Link header tests (4 tests) - cache.test.ts: LRU eviction, TTL, invalidation tests (7 tests) - parse-link-header.test.ts: RFC 8288 parser tests (9 tests) Closes anomalyco#6548
CasualDeveloper
added a commit
to CasualDeveloper/opencode
that referenced
this pull request
Jan 14, 2026
Implements Issue anomalyco#6548: Cursor-based pagination to support long session histories without performance degradation. This builds on the approach from PR anomalyco#6656 by @ry2009, addressing the feedback from that review and adding additional features. Backend: - Add `before` and `after` cursor support to Session.messages and API - Add Binary.lowerBound to util for efficient cursor lookup on ULIDs - Use Promise.allSettled for graceful handling of deleted messages - Add LRU cache for Storage.list (100 entries, 30s TTL) with invalidation - Return RFC 5005 compliant Link headers (rel="prev"/rel="next") - Return 400 when both cursors specified (mutual exclusion) - Validate cursors via Zod schema with graceful fallback TUI: - Track message_page state with hasOlder/hasNewer flags - Implement loadOlder/loadNewer with scroll position restoration - Memory-bound to 500 messages with 50-message eviction chunks - Skip live SSE inserts when detached from head (hasNewer=true) - Add error state handling for failed pagination requests Improvements over PR anomalyco#6656: - Bi-directional pagination (before + after cursors) - Proper parseLinkHeader utility with comprehensive tests - Memory bounding to prevent unbounded growth - LRU caching to reduce Storage.list calls - Error state feedback instead of silent failures - RFC 5005 compliant Link header semantics Other fixes: - Add cache invalidation to import command Tests: - messages-pagination.test.ts: cursor, boundary, deletion tests (5 tests) - session-messages.test.ts: API validation, Link header tests (4 tests) - cache.test.ts: LRU eviction, TTL, invalidation tests (7 tests) - parse-link-header.test.ts: RFC 8288 parser tests (9 tests) Closes anomalyco#6548
CasualDeveloper
added a commit
to CasualDeveloper/opencode
that referenced
this pull request
Jan 14, 2026
Implements Issue anomalyco#6548: Cursor-based pagination to support long session histories without performance degradation. This builds on the approach from PR anomalyco#6656 by @ry2009, addressing the feedback from that review and adding additional features. Backend: - Add `before` and `after` cursor support to Session.messages and API - Add Binary.lowerBound to util for efficient cursor lookup on ULIDs - Use Promise.allSettled for graceful handling of deleted messages - Add LRU cache for Storage.list (100 entries, 30s TTL) with invalidation - Return RFC 5005 compliant Link headers (rel="prev"/rel="next") - Return 400 when both cursors specified (mutual exclusion) - Validate cursors via Zod schema with graceful fallback TUI: - Track message_page state with hasOlder/hasNewer flags - Implement loadOlder/loadNewer with scroll position restoration - Memory-bound to 500 messages with 50-message eviction chunks - Skip live SSE inserts when detached from head (hasNewer=true) - Add error state handling for failed pagination requests Improvements over PR anomalyco#6656: - Bi-directional pagination (before + after cursors) - Proper parseLinkHeader utility with comprehensive tests - Memory bounding to prevent unbounded growth - LRU caching to reduce Storage.list calls - Error state feedback instead of silent failures - RFC 5005 compliant Link header semantics Other fixes: - Add cache invalidation to import command Tests: - messages-pagination.test.ts: cursor, boundary, deletion tests (5 tests) - session-messages.test.ts: API validation, Link header tests (4 tests) - cache.test.ts: LRU eviction, TTL, invalidation tests (7 tests) - parse-link-header.test.ts: RFC 8288 parser tests (9 tests) Closes anomalyco#6548
CasualDeveloper
added a commit
to CasualDeveloper/opencode
that referenced
this pull request
Jan 14, 2026
Implements Issue anomalyco#6548: Cursor-based pagination to support long session histories without performance degradation. This builds on the approach from PR anomalyco#6656 by @ry2009, addressing the feedback from that review and adding additional features. Backend: - Add `before` and `after` cursor support to Session.messages and API - Add Binary.lowerBound to util for efficient cursor lookup on ULIDs - Use Promise.allSettled for graceful handling of deleted messages - Add LRU cache for Storage.list (100 entries, 30s TTL) with invalidation - Return RFC 5005 compliant Link headers (rel="prev"/rel="next") - Return 400 when both cursors specified (mutual exclusion) - Validate cursors via Zod schema with graceful fallback TUI: - Track message_page state with hasOlder/hasNewer flags - Implement loadOlder/loadNewer with scroll position restoration - Memory-bound to 500 messages with 50-message eviction chunks - Skip live SSE inserts when detached from head (hasNewer=true) - Add error state handling for failed pagination requests Improvements over PR anomalyco#6656: - Bi-directional pagination (before + after cursors) - Proper parseLinkHeader utility with comprehensive tests - Memory bounding to prevent unbounded growth - LRU caching to reduce Storage.list calls - Error state feedback instead of silent failures - RFC 5005 compliant Link header semantics Other fixes: - Add cache invalidation to import command Tests: - messages-pagination.test.ts: cursor, boundary, deletion tests (5 tests) - session-messages.test.ts: API validation, Link header tests (4 tests) - cache.test.ts: LRU eviction, TTL, invalidation tests (7 tests) - parse-link-header.test.ts: RFC 8288 parser tests (9 tests) Closes anomalyco#6548
CasualDeveloper
added a commit
to CasualDeveloper/opencode
that referenced
this pull request
Jan 14, 2026
Implements Issue anomalyco#6548: Cursor-based pagination to support long session histories without performance degradation. This supersedes PR anomalyco#6656 by @ry2009, addressing the feedback from that review and adding additional features. Backend: - Add `before` and `after` cursor support to Session.messages and API - Add Binary.lowerBound to util for efficient cursor lookup on ULIDs - Use Promise.allSettled for graceful handling of deleted messages - Return RFC 5005 compliant Link headers (rel="prev"/rel="next") - Return 400 when both cursors specified (mutual exclusion) - Validate cursors via Zod schema with graceful fallback TUI: - Track message_page state with hasOlder/hasNewer flags - Implement loadOlder/loadNewer with scroll position restoration - Memory-bound to 500 messages with 50-message eviction chunks - Skip live SSE inserts when detached from head (hasNewer=true) - Add error state handling for failed pagination requests Improvements over PR anomalyco#6656: - Bi-directional pagination (before + after cursors) - Proper parseLinkHeader utility with comprehensive tests - Memory bounding to prevent unbounded growth - Error state feedback instead of silent failures - RFC 5005 compliant Link header semantics Tests: - messages-pagination.test.ts: cursor, boundary, deletion tests (5 tests) - session-messages.test.ts: API validation, Link header tests (4 tests) - parse-link-header.test.ts: RFC 8288 parser tests (9 tests) Closes anomalyco#6548
CasualDeveloper
added a commit
to CasualDeveloper/opencode
that referenced
this pull request
Jan 14, 2026
Implements Issue anomalyco#6548: Cursor-based pagination to support long session histories without performance degradation. This supersedes PR anomalyco#6656 by @ry2009, addressing the feedback from that review and adding additional features. Backend: - Add `before` and `after` cursor support to Session.messages and API - Add Binary.lowerBound to util for efficient cursor lookup on ULIDs - Use Promise.allSettled for graceful handling of deleted messages - Return RFC 5005 compliant Link headers (rel="prev"/rel="next") - Return 400 when both cursors specified (mutual exclusion) - Validate cursors via Zod schema with graceful fallback TUI: - Track message_page state with hasOlder/hasNewer flags - Implement loadOlder/loadNewer with scroll position restoration - Memory-bound to 500 messages with 50-message eviction chunks - Skip live SSE inserts when detached from head (hasNewer=true) - Add error state handling for failed pagination requests Improvements over PR anomalyco#6656: - Bi-directional pagination (before + after cursors) - Proper parseLinkHeader utility with comprehensive tests - Memory bounding to prevent unbounded growth - Error state feedback instead of silent failures - RFC 5005 compliant Link header semantics Tests: - messages-pagination.test.ts: cursor, boundary, deletion tests (5 tests) - session-messages.test.ts: API validation, Link header tests (4 tests) - parse-link-header.test.ts: RFC 8288 parser tests (9 tests) Closes anomalyco#6548
CasualDeveloper
added a commit
to CasualDeveloper/opencode
that referenced
this pull request
Jan 15, 2026
Implements Issue anomalyco#6548: Cursor-based pagination to support long session histories without performance degradation. This supersedes PR anomalyco#6656 by @ry2009, addressing the feedback from that review and adding additional features. Backend: - Add `before` and `after` cursor support to Session.messages and API - Add Binary.lowerBound to util for efficient cursor lookup on ULIDs - Use Promise.allSettled for graceful handling of deleted messages - Return RFC 5005 compliant Link headers (rel="prev"/rel="next") - Return 400 when both cursors specified (mutual exclusion) - Validate cursors via Zod schema with graceful fallback TUI: - Track message_page state with hasOlder/hasNewer flags - Implement loadOlder/loadNewer with scroll position restoration - Memory-bound to 500 messages with 50-message eviction chunks - Skip live SSE inserts when detached from head (hasNewer=true) - Add error state handling for failed pagination requests Improvements over PR anomalyco#6656: - Bi-directional pagination (before + after cursors) - Proper parseLinkHeader utility with comprehensive tests - Memory bounding to prevent unbounded growth - Error state feedback instead of silent failures - RFC 5005 compliant Link header semantics Tests: - messages-pagination.test.ts: cursor, boundary, deletion tests (5 tests) - session-messages.test.ts: API validation, Link header tests (4 tests) - parse-link-header.test.ts: RFC 8288 parser tests (9 tests) Closes anomalyco#6548
CasualDeveloper
added a commit
to CasualDeveloper/opencode
that referenced
this pull request
Jan 15, 2026
Implements Issue anomalyco#6548: Cursor-based pagination to support long session histories without performance degradation. This supersedes PR anomalyco#6656 by @ry2009, addressing the feedback from that review and adding additional features. Backend: - Add `before` and `after` cursor support to Session.messages and API - Add Binary.lowerBound to util for efficient cursor lookup on ULIDs - Use Promise.allSettled for graceful handling of deleted messages - Return RFC 5005 compliant Link headers (rel="prev"/rel="next") - Return 400 when both cursors specified (mutual exclusion) - Validate cursors via Zod schema with graceful fallback TUI: - Track message_page state with hasOlder/hasNewer flags - Implement loadOlder/loadNewer with scroll position restoration - Memory-bound to 500 messages with 50-message eviction chunks - Skip live SSE inserts when detached from head (hasNewer=true) - Add error state handling for failed pagination requests Improvements over PR anomalyco#6656: - Bi-directional pagination (before + after cursors) - Proper parseLinkHeader utility with comprehensive tests - Memory bounding to prevent unbounded growth - Error state feedback instead of silent failures - RFC 5005 compliant Link header semantics Tests: - messages-pagination.test.ts: cursor, boundary, deletion tests (5 tests) - session-messages.test.ts: API validation, Link header tests (4 tests) - parse-link-header.test.ts: RFC 8288 parser tests (9 tests) Closes anomalyco#6548
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
…; rel="next" when older pages exist.
pagination.test.ts.