Skip to content

A picture still being written draws nothing, not an <img> with no source - #205

Open
Jing-yilin wants to merge 1 commit into
mainfrom
fix/incomplete-image-placeholder
Open

Jing-yilin wants to merge 1 commit into
mainfrom
fix/incomplete-image-placeholder

Conversation

@Jing-yilin

@Jing-yilin Jing-yilin commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

What this changes

Fixes a regression from #204, raised in its review and reproduced here.

While an agent's reply is streaming, a Markdown image that is not finished yet (![shot](https://x.dev/a) showed in the chat as a broken picture until its closing bracket arrived.

  • Cause: remend 1.3.1 dropped a half-written image. remend 1.4.0 rewrites it to ![shot](streamdown:incomplete-image), a source only Streamdown draws. renderMarkdown goes through marked and DOMPurify, which strips that source and leaves <img alt="shot">.
  • Fix: marked's image renderer in canvas/src/markdown.ts returns nothing for an image whose source is remend's INCOMPLETE_IMAGE_PLACEHOLDER, and falls through to the default for every other image. That is what 1.3.1 showed.
  • remend's own images: false option does not help: the output is the same <img> with no source.
  • Half-written links are unchanged between the two versions, so only images needed this.

Tested: a new case in markdown.test.ts fails on main (expected '<p>see <img alt="shot"></p>' not to contain '<img') and passes here, and a finished image still renders with its src. tsc -b, oxlint and bun run test (236 passed, 1 skipped) are clean, and vite build passes. I did not run the full bun run build locally; CI's Canvas job does.

Checklist

  • No ref-*.html, assets/refs/ or other third-party captures are in this PR.
  • If a canvas folder changed: n/a
  • If a canvas folder changed: n/a
  • Every new canvas folder has a README.md and no folder has its own .gitignore. (n/a)
  • If a user would see this change: no release note. remend 1.4 reached main after v1.7.0, so no install ever showed the broken picture.
  • If canvas/ changed: bun test and bun run build pass in canvas/. Tests pass locally; the build passes in CI's Canvas job.

🤖 Generated with Claude Code


Devin Review

remend 1.4 (#204) rewrites a half-written image to `![alt](streamdown:incomplete-image)`
where 1.3 dropped it. DOMPurify strips that source, so the chat showed a broken
picture until the closing bracket arrived.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 potential issue.

Devin Review

Comment thread canvas/src/markdown.ts
// A picture a delta cut open comes out of remend under a source only Streamdown draws, which
// DOMPurify drops, leaving an `<img>` with none. Nothing is drawn until the rest arrives.
renderer: {
image: ({ href }) => (href === INCOMPLETE_IMAGE_PLACEHOLDER ? "" : false),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔍 Streaming image change lacks release note

The renderer changes what users see, but ## Unreleased has no entry. Contributing rules require one for user-visible changes; the author says no released install had the regression.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying super-prototyping with  Cloudflare Pages  Cloudflare Pages

Latest commit: 9fb3038
Status: ✅  Deploy successful!
Preview URL: https://a0ebce16.super-prototyping.pages.dev
Branch Preview URL: https://fix-incomplete-image-placeho.super-prototyping.pages.dev

View logs

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant