Repository navigation
feat(app): hydrate user attachments on demand - #57729
kitlangton wants to merge 4 commits into
Conversation
|
Final head:
With all four improvements combined on a separate measurement branch, 21 interleaved pairs still show no reliable newest-paint effect from changing the server projection: 925.9→933.8 ms. Median after-sample: 1.2 ms initiation, 210.8 wait (including 180 ms simulated RTT), 7.5 server, 17.8 body transfer, 0.3 JSON decode, 1.4 store insertion, 232.2 store-to-DOM and 462.5 DOM-to-visible paint. The remaining 695 ms render/settling slice belongs to timeline/UI. Separate opt-in Chrome profiling attributes 118 ms sampled CPU to markdown and 106 ms to virtualizer stacks, with overlapping native style/layout work. Those CPU figures are not additive wall-time slices. The combined build is held fixed between variants; this is not an all-four-before/after app comparison. No further optimization attempted. |
31876e3 to
976943f
Compare
|
Closing: this was a memory optimization only. |

What it does
Opening a session with many pasted images downloads every image's bytes up front. The desktop/web timeline now loads them from a new experimental route,
GET /api/experimental/session/:sessionID/timeline(experimental.session.timeline, SDKclient.experimental.session.timeline;client.messageis unchanged). It returns user attachments asopencode-attachment:references, and the app loads the originals near the viewport or on click.The stable API is unchanged.
GET /api/session/:sessionID/messagehas no new parameter, and its OpenAPI entry matches beta byte for byte.How it works
opencode-attachment:<sessionID>/<messageID>/<index>and empty data. The response schema marks that format as experimental.AGENTS.mdgets one line: new or uncertain API surface goes under/api/experimental/first.#56989 is stacked on this PR and adds read-tool media omission to the same route.
Risk
Desktop/web timeline only. If hydration fails, an image shows a sized placeholder and retries on its next intersection. Explicit clicks surface the error. Other clients never see references.
Proof
200-prompt page on a HOME-shaped fixture: 9,920,082 → 145,676 B. No reliable newest-paint improvement is claimed.
bun test test/message.test.ts(server): 3 pass. The stable list returns inline bytes; the timeline returns references and pages correctly.tsc -bin core, server, protocol, client, app and session-ui, plus the full typecheck in the pre-push hook: pass.SessionMessagesResponseare identical toorigin/beta.