[PR #11378] feat(opencode): gzip compress json responses for up to 97% smaller payload #13765

Open
opened 2026-02-16 18:18:36 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/11378

State: open
Merged: No


What does this PR do?

fixes #10475

Large sessions can have 20MB+ JSON payloads which can take 20-30s to transfer over mobile networks. Gzip compression reduces this dramatically, improving mobile load times perceptibly. In one case a 400-message session went from 20-30s (23.9MB) to ~5s (580KB).

I attempted to use hono’s own compression middleware but that seemed to break the client, so I opted to implement a middleware with bun’s gzip compression directly.

How did you verify your code works?

ran the server locally (bun run dev web) and tested a session w 400 messages on my phone against v1.1.47:

before (v1.1.47)

custom client logging:

[sync] fetch complete: 19071ms, size=22.73MB
[sync] processing (filter/sort/clone messages): 29ms, count=400
[sync] batch/reconcile complete: 612ms
[sync] TOTAL: 19712ms

23.9MB for that one session:

IMG_7137

after (this PR)

custom client logging:


[sync] fetch complete: 5096ms, size=22.73MB
[sync] processing (filter/sort/clone messages): 35ms, count=400
[sync] batch/reconcile complete: 402ms
[sync] TOTAL: 5533ms

23.9MB -> 580KB for that one session

IMG_7138
**Original Pull Request:** https://github.com/anomalyco/opencode/pull/11378 **State:** open **Merged:** No --- ### What does this PR do? fixes #10475 Large sessions can have 20MB+ JSON payloads which can take 20-30s to transfer over mobile networks. Gzip compression reduces this dramatically, improving mobile load times perceptibly. In one case a 400-message session went from 20-30s (23.9MB) to ~5s (580KB). I attempted to use hono’s own compression middleware but that seemed to break the client, so I opted to implement a middleware with bun’s gzip compression directly. ### How did you verify your code works? ran the server locally (`bun run dev web`) and tested a session w 400 messages on my phone against v1.1.47: ### before (v1.1.47) custom client logging: ``` [sync] fetch complete: 19071ms, size=22.73MB [sync] processing (filter/sort/clone messages): 29ms, count=400 [sync] batch/reconcile complete: 612ms [sync] TOTAL: 19712ms ``` 23.9MB for that one session: <img width="660" height="1434" alt="IMG_7137" src="https://github.com/user-attachments/assets/4311fc51-b6c1-4b33-8625-078c4d90ceb3" /> ### after (this PR) custom client logging: ``` [sync] fetch complete: 5096ms, size=22.73MB [sync] processing (filter/sort/clone messages): 35ms, count=400 [sync] batch/reconcile complete: 402ms [sync] TOTAL: 5533ms ``` 23.9MB -> 580KB for that one session <img width="660" height="1434" alt="IMG_7138" src="https://github.com/user-attachments/assets/deff1ae1-09f4-4308-a72a-879c20a42aa3" />
yindo added the pull-request label 2026-02-16 18:18:36 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#13765