[GH-ISSUE #8452] [Issue]: Large /api/chats responses grow with chat history and bypass compression #8359

Closed
opened 2026-11-07 16:42:28 +07:00 by bsakaguchi · 2 comments
Owner

Originally created by @minikkeuen on GitHub (Oct 29, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/8452

Originally assigned to: @SpicyMarinara on GitHub.

Summary

The GET /api/chats response grows as more chats accumulate, resulting in large data transfers when the chat list is fetched.

A personal network usage monitoring extension reported a 5.50 MB resource size for a single /api/chats request.

Expected behavior

Chat list requests should avoid transferring unnecessary data and remain efficient as the number of chats increases.

Actual behavior

  • GET /api/chats retrieves all chat rows, including potentially large metadata and embedding fields.
  • The response normalization spreads the database row into the returned object, potentially exposing fields unnecessary for chat list display.
  • JSON responses larger than 4 MiB bypass the current compression middleware.
  • Chat list refetches can repeatedly transfer the large response.

Steps to reproduce

  1. Accumulate a large number of chats over time.
  2. Open or refresh the chat list.
  3. Inspect the /api/chats request size using network monitoring tools.

Environment

  • Marinara Engine version: 2.5.1 (personal branch)
  • Install type: Source
  • OS + version: macOS
  • Browser or app shell: Marinara web client

Logs, screenshots, or video

A personal network usage monitoring extension reported 5.50 MB for a single /api/chats request.

Image

Additional context

Based on source code inspection:

  • chats.storage.ts selects all columns when listing chats.
  • chats.routes.ts normalizes and returns the chat rows.
  • compress-json.ts only compresses JSON responses between 1 KiB and 4 MiB.

The exact contribution of individual fields to the response size has not been measured.

Potential improvements include reducing unnecessary response fields, optimizing database column selection, or reviewing compression behavior for large JSON responses.

Template check

  • I DID NOT read this template and provide the requested details.
Originally created by @minikkeuen on GitHub (Oct 29, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/8452 Originally assigned to: @SpicyMarinara on GitHub. ## Summary The `GET /api/chats` response grows as more chats accumulate, resulting in large data transfers when the chat list is fetched. A personal network usage monitoring extension reported a 5.50 MB resource size for a single `/api/chats` request. ## Expected behavior Chat list requests should avoid transferring unnecessary data and remain efficient as the number of chats increases. ## Actual behavior - `GET /api/chats` retrieves all chat rows, including potentially large metadata and embedding fields. - The response normalization spreads the database row into the returned object, potentially exposing fields unnecessary for chat list display. - JSON responses larger than 4 MiB bypass the current compression middleware. - Chat list refetches can repeatedly transfer the large response. ## Steps to reproduce 1. Accumulate a large number of chats over time. 2. Open or refresh the chat list. 3. Inspect the `/api/chats` request size using network monitoring tools. ## Environment - Marinara Engine version: 2.5.1 (personal branch) - Install type: Source - OS + version: macOS - Browser or app shell: Marinara web client ## Logs, screenshots, or video A personal network usage monitoring extension reported **5.50 MB** for a single `/api/chats` request. <img width="426" height="63" alt="Image" src="https://github.com/user-attachments/assets/3d86c485-8d72-46fc-8881-7a90fd3b0ce3" /> ## Additional context Based on source code inspection: - `chats.storage.ts` selects all columns when listing chats. - `chats.routes.ts` normalizes and returns the chat rows. - `compress-json.ts` only compresses JSON responses between 1 KiB and 4 MiB. The exact contribution of individual fields to the response size has not been measured. Potential improvements include reducing unnecessary response fields, optimizing database column selection, or reviewing compression behavior for large JSON responses. ## Template check - [ ] I DID NOT read this template and provide the requested details.
bsakaguchi 2026-11-07 16:42:28 +07:00
Author
Owner

@SpicyMarinara commented on GitHub (Oct 30, 2026):

@SpicyMarinara requested an end-to-end sweep of assigned issues. Codex is taking ownership of chat-list payload and compression. I checked the open PRs and issue-linked work before starting; a draft PR will make implementation progress visible. The fix will target staging, pass the repository validation and review gates, and this issue will close only after the resolved behavior is delivered.

<!-- gh-comment-id:6511801600 --> @SpicyMarinara commented on GitHub (Oct 30, 2026): @SpicyMarinara requested an end-to-end sweep of assigned issues. Codex is taking ownership of chat-list payload and compression. I checked the open PRs and issue-linked work before starting; a draft PR will make implementation progress visible. The fix will target staging, pass the repository validation and review gates, and this issue will close only after the resolved behavior is delivered.
Author
Owner

@SpicyMarinara commented on GitHub (Oct 30, 2026):

Resolved on staging by #8486 (merge 1403a98185). GET /api/chats now returns the public Chat fields without internal embeddings/write counters, preserves complete metadata and stored export data, and compresses above-4-MiB lists asynchronously before sending. Real HTTP Brotli/gzip/identity and injection regressions, the existing send-without-return compression safety control, pnpm check, substantive local CodeRabbit review, final-head Dottore review and required PR checks passed. The last commit only changes indentation; full TypeScript AST comparison confirms identical reviewed code. An extra formatting-only review hit capacity and was not counted as passed. Post-merge staging checks are separate.

<!-- gh-comment-id:6513083080 --> @SpicyMarinara commented on GitHub (Oct 30, 2026): Resolved on staging by #8486 (merge 1403a98185060ab2dc18b466299d9b220a838e45). GET /api/chats now returns the public Chat fields without internal embeddings/write counters, preserves complete metadata and stored export data, and compresses above-4-MiB lists asynchronously before sending. Real HTTP Brotli/gzip/identity and injection regressions, the existing send-without-return compression safety control, pnpm check, substantive local CodeRabbit review, final-head Dottore review and required PR checks passed. The last commit only changes indentation; full TypeScript AST comparison confirms identical reviewed code. An extra formatting-only review hit capacity and was not counted as passed. Post-merge staging checks are separate.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#8359
No description provided.