GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — feat(session): bi-directional cursor-based pagination (#6548) by CasualDeveloper · Pull Request #8535 · anomalyco/opencode Conversation
|
|
The following comment was made by an LLM, it may be inaccurate: Potential Duplicate FoundPR #6656: "session: paginate message loading"
This is not a duplicate in the traditional sense—it's a more complete implementation that builds upon and replaces the earlier approach. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@rekram1-node hi Aiden, would appreciate your feedback on how I implemented pagination, per your suggestion! :) |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Glad I could help kickstart this, I have been a little busy to continue my OSS journey right now. I haven't personally looked through the code in depth (just did a skim) but 1k line changes seems like a lot for one PR (might be better to split it if you can) but once again maybe the code is super clean and simple -- I just haven't sifted through deeply lol. Great work & good luck closing this! |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
4f57718 to
afe9c53
Compare
4bd8bf6 to
34eea60
Compare
34eea60 to
2c70c15
Compare
2c70c15 to
adec748
Compare
adec748 to
01e84ef
Compare
01e84ef to
ea25515
Compare
ea25515 to
4cb0df1
Compare
2f40327 to
686e602
Compare
686e602 to
d12668b
Compare
|
Is there any update on this PR? Where is it hanging? I use it daily. Thank you, @CasualDeveloper, for this super useful extension. So often, I need to fork from the first message.. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
d12668b to
fb9cc15
Compare
|
Hi @alberti42, I think this one has been hanging because it's a big change and unfortunately I haven't had an opportunity to sit down with the maintainers to follow up and go over the work in this feature (I got swamped with real job stuff lol) |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Yeah, I totally understand. Same here; sometimes there is really no time for fun projects like this one. Thank you a lot for the super important contribution. The current implementation is no longer compatible with the main branch, right? I tried to rebase, but there were several conflicts. So, I stopped updating while waiting for this feature to be properly handled. I think some of the maintainers should help you or take over because this is a central must-have feature. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
1c805dd to
a86cd02
Compare
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Adds robust bi-directional, cursor-based pagination for session messages across the server/API, SDK, app, and TUI to make long sessions navigable while keeping message memory bounded.
Changes:
before / after / oldest cursor pagination for session messages and emit RFC 8288 Link headers.Copilot reviewed 18 out of 18 changed files in this pull request and generated 10 comments.
| File | Description |
|---|---|
| packages/sdk/openapi.json | Adds after/oldest query params and documents Link pagination response header. |
| packages/sdk/js/src/v2/gen/types.gen.ts | Regenerates request types to include after/oldest for session messages. |
| packages/sdk/js/src/v2/gen/sdk.gen.ts | Regenerates SDK client to send after/oldest query params. |
| packages/opencode/src/util/link-header.ts | Adds RFC 8288 Link header parsing utilities for rel URLs + query param extraction. |
| packages/opencode/src/session/message-v2.ts | Implements bidirectional cursor pagination in storage layer (before/after/oldest) and updates streaming to use new cursors. |
| packages/opencode/src/session/index.ts | Adjusts DB import set (minor refactor). |
| packages/opencode/src/server/routes/session.ts | Extends /session/:sessionID/message to validate new params and return RFC 8288 Link headers for prev/next pages. |
| packages/opencode/src/cli/cmd/tui/util/pagination.ts | Adds TUI pagination helper utilities (ordering, insertion, eviction, edge hints, error normalization). |
| packages/opencode/src/cli/cmd/tui/routes/session/index.tsx | Updates TUI session view to support boundary-aware loading and new scroll behavior, plus minor UI tweaks. |
| packages/opencode/src/cli/cmd/tui/context/sync.tsx | Implements cursor-based message paging state, capped message windowing (500), and load older/newer/jump behaviors using Link headers. |
| packages/opencode/src/cli/cmd/tui/context/keybind.tsx | Hardens keybind parsing for non-string config values. |
| packages/opencode/test/util/parse-link-header.test.ts | Adds unit tests for new Link header parsing utilities. |
| packages/opencode/test/cli/tui/pagination-helpers.test.ts | Adds unit tests for TUI pagination helper/edge-state logic. |
| packages/opencode/test/session/messages-pagination.test.ts | Reworks session pagination regression tests for new cursor semantics and ordering rules. |
| packages/opencode/test/server/session-messages.test.ts | Updates server API tests to validate Link header pagination (prev/next), param validation, and limit boundary behavior. |
| packages/opencode/test/server/session-select.test.ts | Refactors request/auth helper usage for endpoint tests. |
| packages/app/src/pages/layout.tsx | Switches app-side prefetch cursor extraction from X-Next-Cursor to parsing Link header (rel=prev). |
| packages/app/src/context/sync.tsx | Switches app-side sync cursor extraction from X-Next-Cursor to parsing Link header (rel=prev). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
Fork updated to sync with dev (as of cb1a500). |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Hi, thank you very much for building this feature. It is very important for long context works. Is there any update on the progress of this feature? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
for now i've just been keeping updated in my local fork of opencode, regularly rebasing and refactoring as needed to make it work on dev you might need to manually set up my fork as a source and pull the same way if you really needed it |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@Davids048 I am doing exactly this, and I am very thankful that @CasualDeveloper keeps rebasing. I have a few other branches of mine with fixes, and usually I rebase them every time there is an update from this feature. I am not sure why OpenCode does not help here to push it through. It is nearly a dealbreaker for me not being able to get back to the beginning of a given chat. They probably have many other projects they are currently following. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@alberti42 thanks for the compliment! :D i think it's probably because the feature is so huge and the team is busy with refactoring a lot of stuff everywhere else lol |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Fork updated to sync with dev (as of 77429f5). |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Rework V2 message pagination onto durable sequence cursors that only advertise real older/newer pages, returning bounded projection context and a revert preview with the first page. Extend the V1 messages endpoint with after/oldest paging and a bounded revert preview endpoint. Move app revert, restore, and undo flows onto server-backed previews so they stay correct beyond the loaded window, and give the TUI bidirectional history windows with revert-aware hydration and live-tail reconciliation.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
[FEATURE]: TUI scroll buffer should not truncate old messages — breaks fork from history /Undo command does not work if last user message gets out of visible session history [FEATURE]: Paginated message loading for long sessions
There was an error while loading. Please reload this page.