Skip to content

Let the assistant see the pictures inside a Word document — today it answers beside a figure with '[Image omitted]', while the same conversation reads image files and PDF pages #239

Open

Description

@bencode

Problem

A reader looking at a Word document sees every embedded picture: the reader's conversion keeps the image blobs and resolves them into the page (ui-packages/web/src/features/reader/docx-reader.ts:22-29, using the images map the converter builds at ui-packages/web/src/formats/docx.ts:148-156). The assistant reading the same file sees none of them. The agent's docx runtime converts with images: false and discards the map (ui-packages/web/src/features/assistant/docx/runtime.ts:23), so every picture reaches the model as [Image omitted] — or [Image: …] when the author wrote alt text (ui-packages/web/src/formats/markdown-text.ts:27,46).

No tool can recover one either: analyze_image accepts only files whose previewKind is image (ui-packages/web/src/features/assistant/image-tools.ts:19-20), and a picture inside a .docx is not a file in the Files tree. The PDF side shows the intended shape — analyze_pdf_page renders any page and hands it to the vision model (ui-packages/web/src/features/assistant/pdf/tools.ts:27-47) — so figures and scanned pages in PDFs get real answers. Ask "what does the diagram in Field notes.docx show?" and the agent, forbidden by its system prompt from pretending (ui-packages/web/src/features/assistant/system-prompt.ts:9), can only report that it sees nothing, in the same run that holds a working vision analyzer.

Proposal

  • Give the agent's docx runtime the images the reader already gets: extract them (lazily on first use, keeping the current cost rationale), cached by id and revision as the text view already is.
  • Let the agent analyze one: extend analyze_image — or add the docx counterpart of analyze_pdf_page — to take a Word document's fileId plus an image number, reusing the existing VisionAnalyzer.
  • Number the placeholders in the agent's text view ([Image 2 omitted]) so the model knows which number to ask for.

Goal

After this, a question about a figure inside a Word document returns the vision model's description whenever one is configured — the same answer a figure in a PDF already gets — and no conversation answers [Image omitted] beside a picture the reader is looking at.

Verification

pnpm --filter @gamma-reader/web test src/features/assistant/docx
grep -n "analyze" ui-packages/web/src/features/assistant/docx/runtime.ts
pnpm check

Refs

Activity

  1. added
    enhancement
    source:scheduled
    on Oct 26, 2026
  2. bencode commented on Oct 26, 2026

    @bencode
    OwnerAuthor

    Review — posted by the scheduled issue-reviewer loop (independent of the authoring session), against main@8814e29.

    Evidence audit: all citations hold to the exact line.

    • ✅ features/assistant/docx/runtime.ts:23 — convertDocxToMarkdown(stored.blob, { images: false }); only markdownText(markdown) is kept, the map is discarded.
    • ✅ formats/markdown-text.ts:27,46 — imagePlaceholder → [Image: alt] / [Image omitted], exactly as cited.
    • ✅ features/assistant/image-tools.ts:19-20 — analyze_image rejects anything whose previewKind !== 'image'.
    • ✅ features/assistant/pdf/tools.ts:27-47 — analyze_pdf_page is the working counterpart.
    • ✅ formats/docx.ts:148-156 — the converter's convertImage builds the blob map, keyed docx-image-N (imageReference, :24); ✅ features/reader/docx-reader.tsx:22-29 — the reader resolves those references.

    Duplicate check: nothing open or closed covers the agent path to a Word picture — #237 is the capability gap, #222/#45/#209 the text side, #169 reader-facing display. Not overlaps.

    Sensor: lint ✓; verify ✗ → not implemented on main (no tests exist under features/assistant/docx yet).

    Verdict: valid, keep open. One sharpening: the first Verification step fails today with "No test files found" and, once green, discriminates only by directory — any test file dropped there satisfies it. Make it name the outcome instead (e.g. --testNamePattern="image" over the docx runtime, or a test asserting a VisionAnalyzer receives a docx-image-N blob); the grep -n "analyze" runtime.ts step is currently the only real discriminator. Environment note: pnpm check (the third step) fails on unmodified main right now — see the #241 review for the failing test.

  3. bencode commented on Oct 30, 2026

    @bencode
    OwnerAuthor

    Independent re-review — posted by the scheduled issue-reviewer loop, independent of the authoring session. Audited against main@d05b6b6 (2026-10-28), two days of commits after the last review (main@8814e29).

    Evidence re-audit: zero drift — no commit since the review touched any anchor file. All six citations still hold to the exact line: assistant/docx/runtime.ts:23 (convertDocxToMarkdown(stored.blob, { images: false }), map discarded), formats/markdown-text.ts:27 ([Image: alt] / [Image omitted]), assistant/image-tools.ts:19-20 (previewKind !== image gate), assistant/pdf/tools.ts:27-47 (analyze_pdf_page), formats/docx.ts:24,148-156 (docx-image-N blob map), reader/docx-reader.tsx:22-29.

    Sensor: lint ✓; verify ✗ on main at step 1 — features/assistant/docx/ still contains only runtime.ts, no test file ("No test files found"). Step 2's grep discriminator fails too: analyze appears nowhere in runtime.ts. Both gates read not-implemented; the anchors stay deliverable-shaped. Environment note from the prior review (failing pnpm check on main): the unit suite runs green as of this beat (478 tests); verify for this issue fails before pnpm check is reached either way.

    Duplicate re-scan (open + closed): none. #249 is the capability/config face, #237/#169/#222/#45/#209 the adjacent faces — nothing covers the agent path to a Word picture.

    Verdict: valid — stays open. Prior sharpening stands unchanged: make Verification step 1 name the outcome (e.g. a test asserting a VisionAnalyzer receives a docx-image-N blob, or --testNamePattern on it) instead of relying on a test file merely existing in the directory.

    --
    Posted by the scheduled issue-reviewer loop, independent of the authoring session.

  4. bencode commented on Nov 8, 2026

    @bencode
    OwnerAuthor

    Posted by the scheduled issue-reviewer loop, independent of the authoring session.

    Re-audit @ d05b6b6 (still HEAD; zero commits since the 10-30 pass) — valid, stays open. The queue moved, the code didn't: #292/#294/#295 (filed after that pass) are unrelated; family members #237 and #222 (both closed since) plus #45/#209 remain adjacent-not-duplicate, as the Refs already state.

    • Evidence re-opened — every anchor exact this pass, zero drift: assistant/docx/runtime.ts:23 still converts with { images: false } and drops the map; formats/markdown-text.ts:27,46 still emits [Image omitted] / [Image: alt]; image-tools.ts:19-20 still rejects anything whose previewKind isn't image; assistant/pdf/tools.ts:27-47 still the working counterpart; formats/docx.ts:148-156 still builds the keyed image map; reader/docx-reader.tsx:22-29 still resolves it.
    • Sensor re-run: lint ✓; verify ✗ at its first step for the right reason — vitest --project unit src/features/assistant/docx finds no test files, i.e. nothing implemented.
    • One sharpening: the Goal's observable is the placeholder numbering — worth a verification test asserting the agent's text view carries numbered placeholders ([Image 2 omitted]) and that a docx figure analysis returns the vision model's output, so an implementation that extracts the images but leaves placeholders unnumbered fails loudly (the model couldn't name which figure to ask for).

    No edits; stays open.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementsource:scheduled

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions