Repository navigation
feat(chat): show pictures Claude Code reads, and a picture-only prompt as a turn - #1935
Conversation
…t as a turn Part of #992, for Claude Code. - A picture a tool returned (Claude Code's Read of an image file keeps it inline in tool_result.content[]) is named in the tool row's images as <entry uuid>:<block>:<place in the result>, and the image endpoint reads it back by that ref. Bytes are fetched only when the row opens. - A prompt that is only a picture opens a turn for paging and for the rewind fork detection, so an image-only prompt sent after a rewind hides the abandoned turns. A record over the chain reader's 1 MiB is read with its picture bytes cut, so a real screenshot is not too long for it, and the cold history scan carries such a record whole across its 16 MiB windows. A picture beside a tool result opens nothing. - One check, claudeImageType, decides what is a picture for the page and the endpoint alike: PNG/JPEG/GIF/WebP by declared type and leading bytes, at most 8 MiB decoded. - The endpoint reads Claude pictures as the page does: after the last /clear, on the branch a rewind left, from entries the parser draws. - scripts/claude-image-browser-qa.ts runs it end to end on an owned pane in the CI browser lane.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 1 minute. View limit details
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Image recognition and references server/claude-transcript.ts, server/codex-images.ts, server/claude-incremental.test.ts |
Shared helpers validate image types, sizes, and references. Parsing attaches tool-result images to their tools and uses the same validation for prompt images. |
Turn handling and image retrieval server/transcript-turns.ts, server/conversation.ts, server/conversation.test.ts |
Image-only prompts open turns, and branch scanning removes picture bytes before applying its parse limit. Image retrieval resolves prompt and tool-result images from history after clear and branch boundaries. Tests cover turn detection, paging, rewind, and retrieval limits. |
Browser QA and behavior descriptions scripts/claude-image-browser-qa.ts, scripts/ci-browser.sh, tsconfig.tools.json, docs/guide.md, changelog.d/claude-chat-images.md |
Browser QA checks rewind visibility, image-only turns, and image loading when rows open. CI includes the script, and the guide and changelog describe the behavior. |
Priority:
Estimated code review effort: 3 (Moderate) | ~25 minutes
Change: Feature
Suggested reviewers: kilhyeonjun
Merge Risk: 
Minimal · up to b2ebd
-
No actionable merge-blocking risk remains from the reviewed change. Image-heavy sessions may incur repeated transcript reads, but that behavior predates this PR.
Pre-merge checks: 
4 · 
1
-
Failed checks: 1 warning Passed checks: 4 passed-
Full details: Description check
-
Explanation
The PR description follows the template: it has a Change section describing the problem (Claude Code tool-returned pictures and picture-only prompts being dropped) and the resulting behavior, and a Validation section listing unit tests, real-transcript checks, browser QA, reviews, and the check run. It gives context on scope and what is excluded. Minor gap: the Change section does not link a maintainer-agreed issue for the feature, though it references
#992as the parent effort and#951for the existing gallery pattern; the template asks for an issue link on features.
-
Full details: Docstring Coverage
-
Explanation
Docstring coverage is 64.29% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 14 functions across 8 files. (3 skipped: 3 unsupported.)
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
-
Finishing Touches: 💡 1
-
📝 Generate docstrings: 💡
-
- Commit to this branch
- Create a new PR
🧪 Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands.
|
Merge pass gate review (Astra, gpt-6-astra) of b2ebd26: changes requested. The verdict is REJECT, on 2 findings, both reproduced. This goes with the maintainer's own review, which the PR is still waiting for. The full report, with reproduction code, is What holds (checked directly):
1. The endpoint serves a picture the page never draws (
2. Image lookup reads the whole transcript into memory (
Gate note: the locked review worktree had no dependencies, so the focused suites couldn't load there. The 163-test pass from the lane's log was not reproduced independently. |
…aws, reading its record alone The merge pass gate review of #1935 found two gaps in the image endpoint: - A tool result that answers no call the page shows (an orphan, a second answer to the same call, or one answering a call in a hidden entry) draws nothing, yet its nested ref was served. A tool's picture is now served only when its result answers a call an assistant entry the parser draws made, and no result before it answered that call. - The endpoint read the whole transcript after the last /clear into one buffer to find a ref's entry. It now searches it a 1 MiB window at a time and reads only the records a ref can name, up to the size the history scan follows.
|
Both findings are fixed in 03d6129, with a test each that fails on b2ebd26:
On 03d6129: |
|
Merge pass gate re-check of 03d6129 (Astra, changed range only). Still REJECT, on 2 findings. Both earlier findings are fixed. The full report is Fixed:
Holds:
1. No memory bound per record (
2. False 404 for a drawn result (
Note: a call more than 33 MiB before its result can still be reached. That is acceptable. The merge pass will recheck only the new commits. |
…however JSON writes them The merge pass gate re-check of #1935 found two gaps left in the image endpoint: - A matching record was still read whole: a result or a call padded to 33 MiB took one 33 MiB allocation. A record is now read a 1 MiB window at a time for its shape, every string past 1 KiB cut and marked with where it lies, and only the picture's own base64 is read whole, up to the largest picture the chat shows. So a record of any size costs a window, its shape and the picture, and the endpoint still judges every record the page parses (no size cap that would refuse a picture the page names). - The search for a ref's entry and a call's id took one serialisation: a call id written as "toolu_\u0061" matched the result "toolu_a" in the parser, so the page named the picture and the endpoint answered 404. The search now matches the text however JSON may write it (as itself, as a \u escape in either case, or its short escape), and compares the parsed values. A Codex review of the first version found the shape read could still judge a record differently from the page; it now holds to JSON's rules: the bytes it does not keep are checked as JSON.parse checks them (an invalid record is skipped, as the page skips it), a cut string's mark carries a nonce made for that read so no record's own text can match it, a cut string is decoded a window at a time (a leading BOM kept, as the page keeps it) and limited by the text it decodes to (not by how it is written), a line that is JSON but no object is skipped, and a call id taken from a number is found in any of its spellings (1e3 for "1000", 1e400 for "Infinity"). A record whose shape alone is past 4 MiB is not judged, and nothing it could decide is served: a 404, never a picture the page does not draw.
|
Both re-check findings are fixed in 0ba6e03. Each has test cases that fail on 03d6129 and again when their part of the fix is undone:
On 0ba6e03: |
|
@coderabbitai review |
|
|
CodeRabbit reviewed b2ebd26 (no actionable comments) but was rate-limited for the two fix commits, 03d6129 and 0ba6e03. As AGENTS.md asks for a PR that changes an HTTP contract, here are the code-review agent's reviews that stand in for them: Codex on Sol 6.1 (
Every test case named above fails before its fix and with its part of the fix reverted. On 0ba6e03: |
|
Merge pass gate re-check of 0ba6e03 (Astra, changed range only): APPROVE. Both round-2 blockers are resolved.
The PR body asks for the maintainer's own review before merge, so the merge pass holds it until the maintainer approves. |
|
Merge pass review-work report. Overall: PASSED the merge pass gate. This PR changes the HTTP contract of
Holds on the final head:
The maintainer reviewed it as the PR body asks, and approved the merge (relayed by Dori). CodeRabbit did not review this PR (rate-limited or skipped). The reviews above stand in for it. |
…turn (#1945) Part of #992, the pi part. It follows #1935 (Claude Code), and uses the same check and the same endpoint rules. ## Change In a pi pane, Chat dropped the pictures sent to pi: a screenshot pasted into a prompt was in the session file and never shown, and a prompt that was only a picture opened no turn, so it vanished. Tool pictures were shown, but checked only by declared type. What it does now: - **Prompt pictures:** a picture in a pi prompt, alone or beside words, is named in the turn's image parts as `pi-prompt:<entry id>:<place among its pictures>`, and `GET /api/pane/conversation/image` reads it back by that ref. Only refs reach the page, never base64; the bytes are fetched when the prompt is shown. - **Picture-only prompts** are drawn as a turn and open one for paging (`turnStarts`), as a prompt with words does. - **One check:** `inlineImageType` (moved next to the Codex image code) decides what is a picture for Claude and pi alike, for the parser and the endpoint: PNG, JPEG, GIF or WebP by declared type and leading bytes, at most 8 MiB decoded. pi tool pictures now pass it too, so a page never names a picture the endpoint refuses. - **Same history as the page:** the endpoint reads a pi picture on the active `/tree` branch after the last clear, and as the parser draws it: a tool's picture only from the first result that answers a call the page shows (not an orphan result, a second answer, or a later block for the same call), a prompt's only from a prompt the page shows. A clear or an id is matched however JSON writes it. Records are read one at a time (`piBranchRecords`, per-record cap), never the whole transcript. - `scripts/pi-image-browser-qa.ts` now runs in the CI browser lane and covers a picture-only prompt. **HTTP contract:** `/api/pane/conversation/image` accepts one more ref shape (`pi-prompt:`). No new endpoint, no new wire field. **Design:** no new UI: the prompt thumbnails and the viewer pasted pictures already use (#951). ## Validation - **Unit tests** (`server/pi.test.ts`), each failing on the code before its fix: - prompt pictures named by entry and place, decoded on request; an svg or non-raster bytes take no place; refs that name nothing are 404; - a picture-only prompt opens a page's turn; - a picture a `/tree` or a clear left behind is out of the chat and out of reach; - a tool's picture only from the result the page draws: a call answered twice, an answer with no picture before a duplicate, two result blocks in one entry, a result answering no call, a call made again after an answer with no picture; - an escaped `context_clear` and an escaped prompt id, read as the parser reads them. - `server/pi-large-history.test.ts`: its tool-picture fixture now includes the call its result answers (it relied on the endpoint serving an orphan result's picture, which the page never names); fake image bytes in `server/omp-incremental.test.ts` are real raster headers now. - **Browser** (`scripts/pi-image-browser-qa.ts`, real Chrome): the picture-only prompt is its own turn with its thumbnail decoded from the served bytes and no empty bubble; the tool row fetches nothing while folded and decodes both pictures once opened; a result whose pictures vanish leaves no stranded <img>. Its stub server now answers `/api/pane/commands` as its siblings do. - **Reviews:** Codex (Sol 6.1) reviewed the change three times: three MEDIUMs (escaped clear, a picture from a result the page ignores, escaped prompt id), then one (a call made again after an answer with no picture). All fixed with tests. The last review approved with no findings. One known limit it noted: if a pi session reused a call id and both results carried a picture, the page would name the same ref twice and the endpoint serves the first; pi writes unique call ids. - `bun run check fast`: passes on this head (workflow syntax, generated types and themes, typecheck, build, 6797 unit tests). Co-authored-by: mp <mp@local>
Pictures a tool returned (a Read of a screenshot, a browser screenshot) were drawn only inside an opened work row, and a settled turn's block starts folded, so what the agent saw was two clicks away. Since devswha#1935 the conversation carries image refs only and Claude refs are served immutable, so the load-on-open guard from devswha#262 no longer has to hold for a few small thumbnails. Following the Claude app's folded "Read 2 files" line: - a folded block's line ends in small thumbnails of every picture its tools returned; opened, each row's line carries its own, and an opened row keeps its larger gallery - hover or keyboard focus shows a larger preview with the tool's id and "n of m", placed above, below or on the roomier side inside the viewport, and following the thumbnail as the chat scrolls; a touch opens the viewer at once - a click opens the existing image viewer on all of the line's pictures at that one - the latest four show (three on a coarse pointer, where each is a --touch-target square), the rest are one "+N" tile, so the line never wraps - a picture that fails to load leaves the line, its count and the viewer Client only: no endpoint, wire or server change. The pi and Claude image browser QA now expect the thumbnails on the folded line instead of nothing before the row opens. Refs devswha#1951, devswha#992
Pictures a tool returned (a Read of a screenshot, a browser screenshot) were drawn only inside an opened work row, and a settled turn's block starts folded, so what the agent saw was two clicks away. Since devswha#1935 the conversation carries image refs only and Claude refs are served immutable, so the load-on-open guard from devswha#262 no longer has to hold for a few small thumbnails. Following the Claude app's folded "Read 2 files" line: - a folded block's line ends in small thumbnails of every picture its tools returned; opened, each row's line carries its own, and an opened row keeps its larger gallery - hover or keyboard focus shows a larger preview with the tool's id and "n of m", placed above, below or on the roomier side inside the viewport, and following the thumbnail as the chat scrolls; a touch opens the viewer at once - a click opens the existing image viewer on all of the line's pictures at that one - the latest four show (three on a coarse pointer, where each is a --touch-target square), the rest are one "+N" tile, so the line never wraps - a picture that fails to load leaves the line, its count and the viewer Client only: no endpoint, wire or server change. The pi and Claude image browser QA now expect the thumbnails on the folded line instead of nothing before the row opens. Refs devswha#1951, devswha#992
…ne (#1952) ## Change Closes #1951 (a UI follow-up to #992). #1951 has no maintainer reply yet; I'm happy to change the approach or close this if the direction isn't wanted. Pictures a tool returned (a `Read` of a screenshot, a browser screenshot) were drawn only inside an opened work row, and a settled turn's work block starts folded, so what the agent saw was two clicks away. Since #1935 the conversation carries image refs only, and Claude refs are served `private, max-age=86400, immutable`, so the load-on-open guard from #262 (keeping base64 out of every poll) no longer has to hold for a few small thumbnails. This follows the Claude desktop app's folded `Read 2 files` line, in three steps: - **On the line:** a folded block's header line ends in small thumbnails (2.5rem x 1.5rem) of the pictures its tools returned that the browser caches: Claude's and pi's. Codex and OpenCode pictures are served `no-store`, so they stay off the line and load only when their row is opened, as on main. Opened, each row's line carries its own, and an opened row keeps its existing larger gallery. The thumbnails sit beside the header button, not inside it. - **On hover or keyboard focus:** a larger preview (20rem, 16:9) with the tool's id and its place (`4 of 6`), above the thumbnail where it fits, else below, else on the roomier side, always inside the viewport. It follows the thumbnail when the chat scrolls under it. A touch has no hover: a tap opens the viewer. - **On click:** the existing image viewer on all of the line's pictures, at the one clicked. Edge cases: - The latest 4 show (3 on a coarse pointer, where each thumbnail is a `--touch-target` square), and the rest are one `+N` tile that opens the viewer at the first, so the line never wraps. - A picture that fails to load leaves the line, its count and the viewer instead of showing a broken icon. - Thumbnails use `loading="lazy"` and only rows the virtualized timeline mounts draw them. Client only: no endpoint, wire or server change. The pure parts (which pictures a line shows, where the preview goes) are in `src/lib/workImages.ts`. Behaviour change to note: a folded block now fetches up to 4 Claude or pi pictures without a click. Each is fetched at full size, since there is no server-side thumbnail, and only once per browser, since those refs are served `private, max-age=86400, immutable`. Which refs a line may fetch is an allowlist (`cachedImageRef` in `src/lib/workImages.ts`, mirroring the cache rule in `server/pane-routes.ts`): Codex and OpenCode refs (`no-store`) and any agent not on it load only when their row is opened. A downscaled variant would be a contract change, so I left it out. The `DESIGN.md` entry is under Work block, and the changelog fragment is `changelog.d/chat-work-line-images.md`. ## Validation - `bun run typecheck`, `bun run build`, `bun run generate:types --check` and `bun run generate:themes --check` pass. - New unit tests in `src/lib/workImages.test.ts` (11 tests: picture order, which refs a line may fetch with one sample ref per agent, the line's shown and hidden pictures, preview placement including a viewport too short for either side) pass, as does `src/lib/i18n.test.ts` with the two new strings in ko, ja and zh. - `scripts/pi-image-browser-qa.ts`, updated to the new behaviour, passes in Chrome. It covers: six pictures giving four thumbnails and `+2` with only those four fetched, the hover preview and its label, a click and the tile opening the viewer at the right picture, an opened block and row handing their pictures down, a picture whose fetch fails leaving the line, the phone line (three 44px squares, a tap opening the viewer with no preview) and a keyboard Enter then Escape. - `scripts/claude-image-browser-qa.ts` is updated to expect the thumbnail on the folded line, but I could not run it: it needs a Unix process table and I worked on Windows. It still needs a run in the browser lane. - Checked by hand against a live Claude Code session in a preview server: Read results of real screenshots show on the folded line, hover and the viewer work. - `bun run check fast` on the branch rebased onto main, in a Linux `oven/bun:1.4.2` container: workflow syntax, generated types and themes, typecheck, build and 7,020 unit tests pass. 61 tests in 6 files (`server/codex-processes`, `server/copilot`, `server/shell-agent`, `scripts/self-hosted-runner`, `scripts/ci-runner-route`, `scripts/install-node-fallback`) fail there with ENOENT or "Executable not found in $PATH". The same 61 fail identically on unchanged main in that container, so they come from the bare image, not this PR; CI's Fast checks run them on the real runner.
… a Codex tool returns (#1998) Part of #992, the omp and Codex part. It follows #1935 (Claude Code) and #1945 (pi), with the same picture check and the same endpoint rules. ## Change In an omp pane, Chat dropped every picture: a screenshot sent with a prompt, a prompt that was only a picture, and the picture a `read` returned. omp moves a picture's bytes out of the transcript into its blob store and writes `blob:sha256:<digest>` in their place, so there was nothing to decode. In a Codex pane, a picture a tool returned (`view_image`, an image generation, a screenshot a command read) was dropped too: only prompt pictures were read. What it does now: - **omp prompt pictures** are named as pi's are, `pi-prompt:<entry id>:<place>`, and a prompt that is only a picture is a turn of its own and opens one for paging (`turnStarts`). - **omp tool pictures** are named `pi:<call id>:<place>` on the tool's row. omp's call ids hold a `|` (`call_…|fc_…`), which the ref shape now takes. - **omp's blob store:** omp 18.8.7 keeps a session store at `<data>/sessions` and its blobs at `<data>/blobs` (`getBlobsDir`, the same `data` base), so `ompBlobStore` names the store beside the transcript's real session store (the default agent directory, a profile's, `PI_CODING_AGENT_DIR`'s or the XDG one), by layout alone, whether omp has made it yet or not. A blob is read only by omp's own 64-hex digest and only when its bytes hash to that digest. The image endpoint takes the store's identity from the objects that authorized the pane's transcript (`ompAuthorizedTranscript`): the ownership check returns the store's real root and the dev:ino of the transcript file it opened, and the agent data directory is then opened once, without following a link and held to the path named, and `sessions`, the path down to that same transcript file (each component without following a link) and `blobs` are all reached from that one held descriptor. It reads a blob only from that very directory: the store is opened as a directory without following a link, its descriptor must have that identity (`fstat` dev:ino) and be the directory the path names (`/proc/self/fd`), and the blob is opened through that descriptor (`O_NOFOLLOW`). So no directory or link swapped in afterwards, at the store or above it, can stand in for it. A store that is missing, a link, or not a directory answers nothing. **Platform limit:** Node has no descriptor-relative open on macOS or Windows (checked on macOS), and a blob opened by name there follows whatever a directory above it is swapped to for that moment, so there no omp blob is read: blob-backed omp pictures are not shown on those PCs, while omp's inline pictures and every Codex picture are (follow-up #2004). A session in a `--session-dir` of its own names no data directory: its blob pictures stay unnamed, and inline ones still show. - **Codex tool pictures:** the `input_image` data URLs in a `custom_tool_call_output` or `function_call_output` are named `codex-tool:<call id>:<place>` on the tool's row, for any tool. The `ImageView` and image-generation events that repeat them are not read, so each picture shows once. They are served `no-store` like Codex's other refs, so they load only when their row is opened (as #1952's work line requires). - **One check, both sides:** a blob or a data URL is a picture only as PNG, JPEG, GIF or WebP by declared type and leading bytes, at most 8 MiB, and the parser and the endpoint ask the same question (`inlineImageType`, `ompBlobPicture`), so the page never names a picture the endpoint refuses. - **Same history as the page:** the endpoint reads an omp picture after the last clear (also one JSON writes with escapes), a tool's picture only from the first result answering a call the page draws, a prompt's only from a prompt it draws; a Codex tool's picture only from the first output answering a call the page draws, in the rollouts the page reads (`codexHistorySegments`, without the bytes a backtrack left). Ids are matched however JSON writes them. Like Claude's, it searches a window at a time and reads a record's shape a window at a time (`recordShape`, which Claude's reader now shares), holding only the served picture whole; a picture only counted on the way to the served one is checked by a streaming scan that answers exactly as the whole-string check. The omp and Codex readers run in steps a 1 MiB window apart, and every 32 records, and give the event loop its turn between them; the scan for clears runs in steps too, on its own copy of what it keeps. So a lookup never holds the bridge for more than a window's work (Claude's reader and page reads run the same steps straight through, unchanged). **HTTP contract:** `/api/pane/conversation/image` accepts one more ref shape (`codex-tool:`) and answers omp's `pi:`/`pi-prompt:` refs. No new endpoint, no new wire field (`tool.images` and image parts already exist). **Remote bundle:** the server files are in the remote PC bundle. `REMOTE_BUNDLE_VERSION` is not raised here; the release does that (0.4.18 raised it to 37 and its Release run has finished). **Design:** no new UI: the prompt thumbnails, the work line, the row gallery and the viewer that Claude and pi pictures already use. **Not in this PR:** omo and gjc (no recorded sessions with pictures here; they name none, as before), omp's `xd://generate_image` pictures that live only in `details`, and local Markdown images in answers. ## Validation - **Recorded fixtures** from real CLIs on this PC, picture bytes kept as recorded: - `server/fixtures/omp-pictures-18.8.7-session.jsonl` and its blob `omp-pictures-18.8.7-blob.webp`: omp 18.8.7 (`omp -p --model openai-codex/gpt-6-luna:medium`) with `@shot.png` and a question, a `read` of shot.png (call id `call_…|fc_…`), and `@shot.png` alone. omp turned the PNG into a WebP and moved it to its blob store. - `server/fixtures/codex-pictures-0.163.0-rollout.jsonl`: codex-cli 0.163.0, `codex exec -i shot.png` then `codex exec resume` calling `view_image` through the exec tool. Only the records the chat reads are kept (no account ids, instructions, environment or encrypted reasoning). - **Unit tests** (`server/omp-images.test.ts`, new; `server/codex-images.test.ts`), each shown failing with its fix undone (21 mutations, every one fails its test): - the recorded sessions name their pictures by ref only (no base64, no blob ref in the page) and the endpoint serves their exact bytes; - refused, at the parser and the endpoint alike: an svg, non-raster bytes under a raster type, a picture past 8 MiB (exactly 8 MiB passes), a remote URL, a blob ref that is no digest omp writes, a missing blob, bytes that do not hash to their name, a blob that is a link, malformed refs; - a blob that goes or changes while the bridge runs keeps its place: its ref is a 404 and the next picture keeps its own ref; - a tool's picture only from the result or output the page draws: an orphan, a second answer, a call made again after an answer with no picture, a `function_call` output as well as a custom tool's; - a picture from before a clear (also an escaped `context_clear`) is out of the chat and out of reach; - call ids and entry ids written with JSON escapes (omp's `|` among them) are named and served as the parser reads them; - a picture-only omp prompt is its own turn and opens a page there (`turnStarts`); a growing session names the same refs as a cold read; - memory: a call and a result each padded with 20 MiB, two 3 MiB blobs, and a 2 MiB escaped inline picture before the served one: no allocation past a 1 MiB window except the served picture; - the streaming checks answer exactly as `inlineImageType` and the data URL check do, for every two-piece and many three-piece cuts, including a cut inside the padding at exactly 8 MiB. - `server/pi.test.ts`: the omp case of the picture-only `turnStarts` test now expects a turn (omp draws its prompt pictures now). - **HTTP contract** (`server/omp.contract.test.ts`, `server/codex.contract.test.ts`, on an isolated herdr via `bun run check run`): the recorded omp session's three refs answer `image/webp` with the blob's exact bytes and `private, max-age=86400, immutable`; the Codex `codex-tool:` ref answers `image/png` with the viewed PNG's bytes and `no-store`, and 404 once the rollout no longer holds it; unnamed and malformed refs are 404. 8/8 pass. - **Real transcripts on this PC** (shapes only, nothing printed): 36 omp sessions with 652 blob pictures name 650 refs (1 prompt, 649 tool) and the endpoint serves all 650; 7 Codex rollouts name 23 tool-picture refs and the endpoint serves all 23. No page carries base64 or a blob ref. - **Browser** (`scripts/omp-codex-image-browser-qa.ts`, real Chrome, added to the CI browser lane), served by the endpoint's own readers from the recorded files: omp's three prompt pictures decode from the blob store (200x200 WebP), the picture-only prompt is its own turn with no empty bubble, the `read` picture shows on its folded work line, is fetched by its `|` call id and opens the viewer; a Codex tool's picture stays off the folded line with no element requesting it, and decodes (32x32) once its row is opened, beside the prompt's own attachment; at 390 px nothing spills past the screen. Desktop and phone screenshots checked. - **Merge pass gate** (Astra), two rounds, every blocker fixed and reviewed again (see the gate follow-up comments): - On ae860b0: C1, a symlinked blobs directory served another store's picture; C5, the readers blocked the event loop (225 ms on a warm 64 MiB lookup). - On 5c1bc56: B1, an agent directory swapped for a link after the ownership check still moved the read (the store was found again from `realpath`); B2, the macOS/Windows by-name open is racy on an intermediate path; C5, 30,000 short records still held the loop 211 ms, and the scan for clears was synchronous. - On 64c8527: C1a, a directory swapped between the ownership check and the anchor lent another store (the anchor walked the path again); then, raised by Codex, the store's sessions reparented under another agent directory. Fixed by the one-held-descriptor anchor above; tests swap the agent directory, move another real sessions in, and reparent, through a hook right after the data directory's open. On a947a19, round 4: moves before the data directory's open adopt another data directory. Decided trust boundary (a): write access to the user's own omp data directory; the directory at that path when the anchor opens it is trusted, and the transcript and blob store always come from that one held descriptor (tests before and after the open, 1ef6bf8). - Fixes, as described above: the descriptor-relative open held to the identity taken at authorization; no blob read off Linux; yields every 32 records and per clear-scan window. Tests: through a test seam that acts at each open, a link or another real store swapped in for the store, or for the agent directory above it, at the store's or the blob's open; the agent directory swapped after authorization; the non-Linux branch forced; the longest stretch between loop turns bounded in buffers taken (no clocks) over 30,000 records and 40 MiB, cold. Each defence is shown failing its test when removed. - Measured: 30,000 short records over 30.5 MB, longest event-loop stall 3.9 ms warm (omp), 33.5 ms cold (one 16 MiB window of the clear scan), Codex 2.1 ms; a warm 64 MiB lookup 2.1 ms. - On the way, the code reviewer found the store named null before omp made it, so a live page missed pictures a cold read names (fixed: named by layout), and Codex found a link, then another real directory, swapped in at the open, and the anchor taken only after the async resolve (all fixed as above). Both approve the final commits. One gap left as a known one: the scan for clears working on its own copy has no test of its own (without it, a page read in the middle of an image read redoes the scan). - **Reviews:** - `omo-native-code-reviewer`: APPROVE on 4a9a574 (then 7005452d, before the rebase), with one MEDIUM (a blob deleted while the bridge runs could move the next picture into its ref) and four LOWs (refusals re-read every poll, the blob cache surviving a reset, weak spots in the browser QA, earlier inline pictures read whole to count them). - Codex (Sol 6.1): REQUEST CHANGES on 4a9a574 (then 7005452d, before the rebase): the same MEDIUM, a MEDIUM that a picture only counted on the way to the served one was read whole (a blob hashed whole to name it, a data URL rebuilt to count it), and a LOW that the browser QA could pass on an undecoded picture. - All fixed in ae860b0 (fcc0187a before the rebase) with tests: the place model, a per-file blob cache that keeps refusals, streaming checks, the QA's decode and error checks. Both reviewed the delta again: APPROVE, every finding FIXED, no new finding from Codex. The code reviewer's one new LOW is left as is: the served inline picture is read from the file twice (once checked, once held), up to about 11 MB of extra reading and no extra memory; holding it during the check would mean holding a picture before it passes, which the memory rule forbids for any picture not served. - `bun run check fast` on 1ef6bf8: workflow syntax, generated types and themes, typecheck and build pass, and 7265 of 7266 unit tests pass. The one failure is the known slot-admission flake in `scripts/check.test.ts` (`slots > gives its place up when it stops waiting`: ticket ports taken on a busy host), in a file this PR does not touch, which passes 66/0 alone. The run before it had only an untouched load-timing failure (`scripts/install-node-fallback.test.ts`, hung-host kill, 10/0 alone). Counted as passed per the lane's rule for known slot-admission flakes; GitHub CI runs the full suite. --------- Co-authored-by: mp <mp@local>
## Change Part of #992 (pictures in Chat). Chat showed transcript pictures for Claude, Codex, omp, pi and OpenCode, but not for GitHub Copilot CLI, though Copilot keeps them in its own session file. Copilot CLI 1.0.105 interns each picture once, as a root `session.binary_asset` record (base64, `assetId: "sha256:<digest of the bytes>"`). A prompt's `attachments[].assetId` and a tool's `result.binaryResultsForLlm[].assetId` name it by that id (checked against the SDK's `session-events.d.ts` and a real recording). - **Parser** (`server/copilot.ts`): a prompt's attached pictures become image parts and a tool's become its `images`, each named `copilot:<digest>`. Only refs reach the page. A picture-only prompt opens a turn, and `transcript-turns.ts` agrees for paging. - **Endpoint** (`GET /api/pane/conversation/image`, no new route): reads only the pane's own pinned Copilot session file (`openCopilotFile`). It serves a root record only (no sub-agent), a raster within `MAX_IMAGE_BYTES` (`inlineImageType` + magic bytes), and only bytes whose sha256 equals the ref. It reads in 1 MiB windows and skips any line longer than the largest picture record without holding it. Served immutable because the ref is the content digest; `workImages` keeps `copilot:` refs like Claude's and pi's. Design: same image part, ref route and viewer as the pi/Claude pictures (#1935, #1945); no new UI. ## Validation - Real fixture: `server/fixtures/copilot-pictures-1.0.105-events.jsonl`, recorded on this PC with `copilot -p ... --attachment red.png` plus the `view` tool reading `blue.png` (redacted; reasoning blobs and usage records dropped). - Failing first: the new `server/copilot.test.ts` case failed on the parser (`[]` instead of the image part), then passed. - `bun run check fast`: all steps ok, unit **9828 pass, 0 fail, 41 skip** (on 946a6e6). - `bun scripts/copilot-image-browser-qa.ts` (added to the CI browser lane): desktop + phone, both pictures decoded at 48x48. - `server/copilot.contract.test.ts` (new end-to-end case: pane-scoped 404, cache header) could not run locally. Its `beforeAll` fails with "isolated Copilot stand-in not detected" on unchanged `origin/main` too (herdr 0.9.5 here); CI runs it. ## Reviews - omo-native-code-reviewer: **PASS / APPROVE**. Escape from the pinned file, sub-agent records, SVG, symlink and fd swap were all probed and refused. MEDIUM: whole-line memory in the lookup, fixed in 946a6e6. - Codex Terra 6.1 fast xhigh, round 1: two MEDIUMs. (1) Unbounded line memory: fixed, RSS for a 64 MiB junk line went from 173 MB to 33 MB, and a test covers it. (2) A 16 MiB page window splits a turn holding big tool pictures: this reproduces identically on `origin/main`, so it is filed as #2478. Delta round: MEDIUM, a final record without a newline was dropped. Fixed, with a test.
## Change Part of #992 (pictures in Chat), after #2479 (Copilot). Grok CLI 1.0.67 logs a session's pictures inline in its own `updates.jsonl`: - a prompt's `user_message_chunk` with `content: { type: "image", data, mimeType }`, and - a tool update's `content: [{ type: "content", content: { type: "image", ... } }]` (here `read_file` reading a PNG). What changes: - **Parser** (`server/grok.ts`): prompt pictures become image parts and tool pictures become the tool's `images`, each named `grok-image:<sha256 of the bytes>`. Hidden prompt chunks are skipped, ACP's replace-the-whole-`content` rule is honoured, and only refs reach the page. - **Endpoint** (`GET /api/pane/conversation/image`, no new route): reads only the pane's own Grok update log (`resolveGrokStore`), over the history `grokProjection` keeps active. A prompt that was rewound away serves nothing, including one rewound while the lookup reads. - It checks that the file it opened is still the one the path names. - It reads 1 MiB windows with the event loop running between them. - It serves a raster within `MAX_IMAGE_BYTES` whose sha256 matches the ref, so the response is immutable. - `workImages` keeps `grok-image:` refs, like Claude's, pi's and Copilot's. Design: same image part, ref route and viewer as the other agents' pictures (#1935, #1945, #2479); no new UI. ## Validation - Real fixture: `server/fixtures/grok/pictures-1.0.67.jsonl`, recorded on this PC: `grok --prompt-json` with a red PNG, then `read_file ./blue.png`, through the owner's CLIProxy (`gpt-5.6-luna`, isolated `GROK_HOME`). Paths are redacted. - Failing first: the new `server/grok.test.ts` case failed on the parser (`[]` instead of the image part), then passed. Added cases cover a rewind before and during a lookup, a file swapped into the path during a lookup (mutation-checked: fails without the identity pin), an escaped `"im\u0061ge"`, and a missing digest. - `bun run check fast` on 3a9858c: all steps ok, unit **9828 pass, 0 fail, 41 skip**. - `bun scripts/grok-image-browser-qa.ts` (added to the CI browser lane): desktop + phone, both pictures decode at 48x48. - Lookup cost: a 6.6 MB text-only log with a missing digest takes 50 ms, and a 10 ms timer keeps firing. The first version took 4 s or more on 2.4-4.8 MB logs. ## Reviews - Codex Terra 6.1 fast xhigh: - Round 1: HIGH (quadratic read with no yield), MEDIUM (a prompt rewound during the lookup was still served), LOW (escaped type). All fixed in 3a9858c. - Delta round: MEDIUM (a file swapped into the path during the lookup). Fixed, with a test. MEDIUM (the final revalidation may catch up up to 32 MiB of new records synchronously): this is the same `SCAN_BYTES` bound every Grok page poll already pays, so it is not new here. - omo-native-code-reviewer: REQUEST_CHANGES on the same HIGH, now fixed. L2 (open, then check the path still names it) is fixed too. - L1 (a picture a later update replaced is still served from the active history) is left as is: it is the pane's own history, so nothing leaks. - L4: the parser hashes each picture on every parse; not measured.
Waiting for the maintainer's own review before merge.
Part of #992, the Claude Code part. pi, the omp family and Codex follow as separate PRs, one at a time.
Change
In a Claude Code pane, Chat dropped two kinds of picture:
Readof a screenshot keeps the picture inline intool_result.content[]. The parser kept only the result's text, so the row showed nothing./rewind(opensTurninserver/transcript-turns.ts) needed text to see a prompt. So after a rewind, a screenshot sent as the next prompt left the abandoned turns on screen, and a page could not start at such a prompt.What it does now:
tool.imagesas<entry uuid>:<block>:<place in the result>, andGET /api/pane/conversation/imagereads it back by that ref. The row loads it only once it is opened, like pi's. The conversation response carries refs only, never base64.claudeImageTypedecides what is a picture for the parser and the endpoint alike: PNG, JPEG, GIF or WebP by declared type and by leading bytes, at most 8 MiB decoded (the cap Codex images already have). So the page never names a picture the endpoint refuses. This now also applies to pasted prompt pictures, which had no size cap or byte check before./clear, on the branch a rewind left, and only from an entry the parser draws (notisMetaor a compaction under the same uuid), and a tool's picture only from a result the page draws: one that answers a call it shows, which no result before it answered. It searches the transcript a window at a time, reads a candidate record's shape a window at a time, and reads back whole only the picture it serves: never a record or the transcript whole.HTTP contract:
/api/pane/conversation/imageaccepts a third ref shape. There is no new endpoint and no new wire field (tool.imagesalready exists). Since it changes what that endpoint answers, this needs a real review.Remote bundle: the server files are in the remote PC bundle.
REMOTE_BUNDLE_VERSIONis not raised here; the release does that.Design: no new UI. It uses the row's picture gallery and viewer that pi's tool pictures and pasted pictures already use (#951). It follows the Claude and Codex apps, which show a picture a tool read inline with that tool call.
Not in this PR: pi and omp-family user pictures, omp blob tool pictures, Codex tool-output pictures (separate PRs), and local Markdown images in answers.
Validation
server/conversation.test.ts,server/claude-incremental.test.ts), each new one shown failing without its fix:Readresult's PNG is named<uuid>:<block>:<place>with no base64 in the page, andtranscriptImagereturns its exact bytes;turnStarts), and after a recorded/rewind(Claude Code 2.1.304 fixture) a picture-only next prompt hides the abandoned turns, warm and cold, for a 16 B picture, a 900 KiB one, and a 2 MB one whose record crosses the cold scan's 16 MiB window;image/png, a picture past 8 MiB (exactly 8 MiB passes), a ref to the result's text, a ref with no picture, malformed refs, a picture from before/clear, one from a turn a rewind abandoned, and anisMetarecord carrying the same uuid;<uuid>:<index>prompt pictures parse and serve as before.Readpictures (PNG and JPEG, one from a subagent): every picture passes the check, each is named once (Claude Code'sapi-request-blobcopies are not), and no base64 reaches the page. 69 of 434 Claude picture prompts here are over 1 MiB, which is why the large-record path exists.scripts/claude-image-browser-qa.ts, added to the CI browser lane): a Claude stand-in on an owned herdr pane, the real server and Chrome. A picture-only prompt sent after a rewind is its own turn with its thumbnail decoded and no empty bubble, the rewound turns stay hidden; theReadrow fetches nothing while folded and decodes its picture once opened; a ref the transcript does not hold is 404. Desktop and phone (390 px, fresh mobile context) screenshots checked: the tool picture in the opened Read row, the picture-only prompt as its own turn with no empty bubble.omo-native-code-reviewer(one HIGH: a tools-typecheck error in the script; fixed) and Codex on Sol 6.1 (no HIGH; four MEDIUM and one LOW, all fixed with tests); a delta review of the fixes approved, and its one MEDIUM (the 16 MiB window case) is fixed with a test.server/conversation.ts(main'sclaudeAttachSession). After the rebase: the touched suites pass (server/conversation.test.ts,server/claude-incremental.test.ts,scripts/ci-browser.test.ts: 163 pass),scripts/claude-image-browser-qa.tspasses all three checks, and a Codex (Sol 6.1) review of the rebase delta found nothing.bun run check fast: passes on this head (workflow syntax, generated types and themes, typecheck, build, unit tests).Readof a chart screenshot, a turn taken back with/rewind, then a prompt that is only a screenshot. On main the Read row has no picture and the rewound turn is still shown; on this branch the chart shows in the opened row (and opens in the viewer) and the rewound turn is hidden.