Skip to content

OPE-244: Open Session Chat without megabyte REST dumps #524

Closed

Description

@ivanfenenko

Opening a long Session Chat after a cache miss waits on REST that downloads megabytes the first paint never shows.

On a cold open over Tailscale, unbounded GET /session/{id}/message took 7-9s. That JSON was 3.6-6.0 MB for 44-90 messages. Chat text plus reasoning was about 17-30k characters. The rest was tool output from read/bash, patch parts, and in one session a 394 KB file part. Client fullReload after the response is ~20-40ms.

Bind also fires GET /session/{id}/diff for the Review Changes pill (2.4 MB, 150 files). The pill only uses file count and +/- totals. The server has no counts-only query.

Web does not do this. First paint is connected + session info + a 20-message tail. Older history is loadMore (200). Catalogs and diffs are off that path.

What the servers already support

v1 GET /session/{id}/message

  • Query: limit (integer, 0 means all), before (opaque cursor). before without limit is 400.
  • Omit limit (what we do): full dump.
  • Paged body is still a JSON array of full {info, parts} including tool dumps.
  • Next page: X-Next-Cursor and Link: rel="next".
  • Live check on the 60-message session: unbounded 3.78 MB; limit=20 410 KB; limit=40 816 KB.

v2 GET /api/session/{id}/message

  • Query: limit (1-200, default 50), order (asc|desc, default desc), cursor.
  • Cursor must not be sent with order (400 InvalidCursorError).
  • Envelope { data, cursor.previous, cursor.next }.
  • We send order=asc and drain every page (maxV2MessageListPages = 500).

Neither protocol strips tool output. Pagination is the available win. Slim parts would need a new server field.

docs/features/message-store/ still lists paginated history (limit / before / x-next-cursor) as out of scope. That has to change for this ticket.

Remaining:

  • Seed MessageSync with a newest-first tail (web uses 20). v1: limit + before from X-Next-Cursor. v2: limit + order=desc + cursor.next. Do not drain all pages on bind.
  • If that page starts mid-turn (assistant without its user/shell), fetch a few older pages so the turn is complete. Web already does this.
  • Load older pages on scroll, not on bind.
  • Do not fetch last-turn patch text on bind. Load GET /session/{id}/diff when Changes opens.
  • Same behavior on iOS and Android.

Docs: docs/features/message-store/, docs/features/session-chat/


Imported from Linear OPE-244. Linear status: Done. Priority: High. Created 2026-09-12. Completed 2026-09-13.
Related: OPE-25, OPE-11.

Activity

  1. self-assigned this
    on Oct 11, 2026
  2. added
    ios
    android
    shared
    improvement
    priority: high
    on Oct 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

androidimprovementiospriority: highshared

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions