fix(mobile): size a chat image's frame before its bytes arrive #10199
media-dims/contract fromrefs/pull/10199/head·merged by juliusmarminge View on GitHubStack 2/3 (#10201). Depends on #10198.
Problem#
An assistant image on mobile went through three sizes: full width on first render, the measured width after its own onLayout, then the decoded size (up to 480px tall for a portrait screenshot). Each step changed the row's height after LegendList had already placed the rows below it. That's the "scroll area cut off under the composer" and "tool calls render under the media" reports.
Fix#
ThreadFeedhands markdown its content width throughMarkdownImageAvailableWidthContext, so the placeholder is the right width on the first render instead of afteronLayout. The context is an upper bound: a list item or blockquote indents its column, and the measured width takes over once known.ThreadMarkdownImageuses the server'simageDimensions(#10198) to size the frame exactly before the first byte arrives. The decoded size still wins once it exists, so a wrong hint can never stick. An image the server couldn't measure keeps the 16:9 slot.- Padding constants use the mobile 14px rem (
px-3.5on the bubble,px-1on assistant rows).
Evidence#
iPhone 17 Pro simulator on macmini, seeded thread with landscape/portrait/wide screenshots, asset responses delayed 2.5 s through a proxy so the loading phase is observable. Frames captured every ~100 ms during thread open.
Before (main): portrait placeholder is 16:9; when the image decodes the row grows ~250px and everything below reflows. After: the frame is portrait from first paint; rows below never move.

Verification#
apps/mobiletypecheck clean; lint on changed files clean (pre-existing effect warnings unchanged).- Simulator pass above.
Model: Claude Fable 5 · Harness: Claude Code in T3 Code
🤖 Generated with Claude Code
Note
Size chat image frames before bytes arrive in mobile thread feed#
ThreadFeedderives a markdown content width from the centered content width and row padding, then passes it torenderFeedEntryso user and assistant markdown rows have a width estimate before their ownonLayoutfires.ThreadMarkdownImagecombines the feed-provided width with a server-supplied image size to render an aspect-ratio frame before decode; after decode, decoded dimensions take precedence and the measured layout width constrains the estimate.readJpegnow skips later APP1 segments once a rotated EXIF orientation is detected, andIMAGE_DIMENSIONS_HEADER_BYTESis raised from 64 KiB to 256 KiB to reach JPEG frame headers after multiple metadata segments.- Risk: in ThreadMarkdownImageView the frame resolves only when both a source size and a positive available width exist, otherwise it falls back to the placeholder frame; rows lacking a width context or unknown image size may keep the placeholder longer.
- 1
github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:M
juliusmarminge changed the title
Approvability#
Verdict: Approved at
a68cf3bMacroscope's review found this PR approvable — This is a focused mobile layout bug fix that stabilizes existing markdown image frames using the feed width and already-supported image metadata. Its runtime impact is confined to image sizing and row layout, with no new capability, schema change, deployment change, or static-analysis override.
No code changes detected at
You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).cced7aa. Prior analysis still applies.macroscopeapp[bot](GitHub profile, opens in a new tab) approved these changes
Bugbot is paused — on-demand spend limit reached
Bugbot uses usage-based billing for this team and has hit its on-demand spend limit.
A team admin can raise the spend limit in the Cursor dashboard, or wait for the next billing cycle to continue.
juliusmarminge merged this7451d17
juliusmarminge closed this
Sign in to join this conversation.
Thread transfer impact#
✅ Thread transfer remains within every enforced ceiling.
Baseline: unavailable · PR result:
cced7aa· Source CI: successScenario and decoded snapshot size
10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.
Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.