Repository navigation
fix(claude): wait for a short image prompt's text before sampling the image baseline - #1226
Merged
Merged
Conversation
… image baseline
A short (non-paste-like) prompt with images was written raw, and the image
baseline was sampled immediately, before the text repainted. A prompt that
literally names an image ('why does [Image #1] look wrong') raised the
placeholder count when it painted, the image poll took that for the
attachment, and Enter went out with no image.
Both prompt shapes now wait until their text visibly entered the composer
(the same pollPasteAbsorbed rule the text-only path applies to every
prompt, with the same rollback on timeout) before the image paths are
pasted, so the baseline already counts any literal the text carries.
Test: the recorded Claude 2.1.278 frames from the #1113 fixture, with the
text painting one sample after the write (the race the issue describes)
and the pill never rendering. Old code writes Enter; new code does not.
A second case renders a real pill after the literal and still submits,
so the fix does not work by refusing prompts that name an image.
Fixes #1119
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…t wait Review of #1226: a " " + image send has no visible tail and never collapses into a placeholder, so the new text wait could only time out and the rollback could never see the bytes, a permanent do-not-retry where main delivered. Whitespace cannot carry an [Image #N] literal, so skipping the wait keeps the #1119 guarantee. Adds coverage for the image-path text timeout (rollback + retry-same- session), the trailing-whitespace separator and the raw short write. Mutations killed: guard removed, rollback removed, failure branch dead, separator always written, short prompt bracketed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Juliusolsson05
added a commit
that referenced
this pull request
Sep 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem (#1119, class C1)
A short (non-paste-like) prompt with an image attachment was written raw, and the image baseline was sampled immediately, before the text repainted. A prompt that literally names an image (
why does [Image #1] look wrong) raised the placeholder count when it painted. The image poll took that for the attachment, and Enter went out with no image.Change
deliverClaudeImagePrompt: both prompt shapes now write their text (bracketed for paste-like, raw for short) and wait for it to visibly enter the composer before pasting the image paths. This is the samepollPasteAbsorbedrule, with the same rollback on timeout, that the text-only path applies to every prompt. The image baseline therefore already counts any literal the text carries, so only a real pill can move it.Tests (fail-first, recorded frames)
They use the recorded Claude Code 2.1.278 composer from the #1113 fixture:
The existing #1113 recorded tests still pass (
src/providers/claude+src/shared/claude: 212 tests).Verification
npx tsc -bclean.Not verified here: a live Claude pane. A short image prompt now waits for its text to paint first, which normally takes tens of milliseconds.
Fixes #1119
🤖 Generated with Claude Code
Review disposition (A, B, C all Pi; 2 rounds)
c6496dba): a null tail needle skips the wait. Whitespace cannot carry an[Image #N]literal, so #1119 still holds. Tested, and the mutant is killedretry-same-session, with no image and no Enter"\n"plus an image) may merge two pastesRound 2: A, B and C all MERGE-READY.