Skip to content

[Feature] Strip unused per-message fields from the session API response #307

Closed

Description

@Whz829

Problem / motivation
Opening a long session is slow over a remote link because GET /api/sessions/[id] sends large per-message fields the UI never reads:

  • inputTransformations: each assistant message carries its own list of up to ~220 entries like {"type":"thinking_dropped","path":"messages.N.content.M","reason":"prefix_binding_mismatch"}
  • thinkingSignature: still sent with deferThinking=1, even though thinking itself is blanked; it is opaque base64 and barely compresses
  • requestControls
  • contextSnapshot

On a long session (597 messages, with the client's own ?deferThinking=1&deferMedia=1):

Raw gzip
Current 3.7 MB 881 KB
Without these 4 fields 1.6 MB 530 KB

inputTransformations alone is 53% of the response.

Proposed solution
Drop these four fields in buildSessionContext() (lib/session-reader.ts) when building the response, at least when deferThinking is set. Nothing in components/, hooks/, lib/ or app/ reads them.

Alternatives considered

  • Compressing at a reverse proxy: this helps, but the payload is still about 0.9 MB after gzip, and thinkingSignature barely compresses.
  • Paginating the session context: this would help more, but it is a much larger change. Removing unused fields is small and independent of it.

Activity

  1. added
    enhancement
    on Oct 26, 2026
  2. anhnt256 commented on Nov 11, 2026

    @anhnt256
    Contributor

    I'll fix this — the four unused per-message fields will be dropped from the display context in entryToUiMessage (next to the existing stripToolResultDetails), so both the session context route and the history page stop sending them. I verified no code in components/, hooks/, lib/ or app/ reads them, and the on-disk session file keeps the full message. Opening a PR with the fix plus a test pinning the fields absent.

  3. added a commit that references this issue on Nov 23, 2026
    f1a49cc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions