Skip to content

fix(session): page v1 message history with a before cursor - #13

Closed
e-n-0 wants to merge 1 commit into
mainfrom
flavien.darche/message-history-paging
Closed

e-n-0 wants to merge 1 commit into
mainfrom
flavien.darche/message-history-paging

Conversation

@e-n-0

@e-n-0 e-n-0 commented Oct 15, 2026

Copy link
Copy Markdown
Collaborator

What

GET /session/{id}/message now accepts before=<messageID> and returns an x-next-cursor header (the oldest message ID in the page) while older messages remain.

Why

OpenChamber loads history with limit=50 and only asks for older pages when it gets an x-next-cursor back. Antechamber never sent one, so the UI took the newest 50 messages as the whole history. In a long session where those 50 are all assistant replies from one turn, there is no user message to group them under, and the session opens blank.

How to verify

npm run typecheck     # passes
npx tsx --test --import ./test/setup.ts test/protocol-v124-sessions-history.test.ts   # 3/3 pass
npm run build         # succeeds
npm run format:check  # clean

V124-006 now also checks that the cursor header is set, that before returns the older page, and that the last page has no cursor. I also checked a real 396-message OmO session by hand: paging with limit=50 returned all of it in 8 pages. No smoke script was run.

Checklist

  • npm run typecheck passes
  • npm test passes (session-history file)
  • npm run build succeeds
  • New/changed behavior has a test; no fixed sleeps were added
  • Commit messages follow Conventional Commits
  • docs/api-surface.md updated if routes/events changed
  • docs/configuration.md updated if an environment variable was added, renamed, or had its default changed (n/a)
  • No personal paths, hostnames, or credentials in the diff

@e-n-0
e-n-0 marked this pull request as ready for review October 15, 2026 22:35
OpenChamber loads history with limit=50 and follows x-next-cursor via before=. Without the header it treated the newest 50 messages as the whole history, so long sessions whose last page held only assistant replies opened blank.
@e-n-0
e-n-0 requested a review from eliottness October 15, 2026 22:41
@e-n-0
e-n-0 force-pushed the flavien.darche/message-history-paging branch from 6c8090d to fd7c912 Compare October 15, 2026 22:43
@e-n-0

e-n-0 commented Oct 16, 2026

Copy link
Copy Markdown
Collaborator Author

already merged on main: close #13

@e-n-0 e-n-0 closed this Oct 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant