feat: stable image generation artifact display with dedup and multi-i…#86
feat: stable image generation artifact display with dedup and multi-i…#86DivXPro wants to merge 1 commit into
Conversation
…mage support Replace single artifactRef with generatedImages data model to handle multiple images per image_generate call without overwriting. Images render via GeneratedImageGroup in the assistant turn path, with markdown suppression via suppressedArtifactKeys to prevent duplicates. Fix: when hasAssistantTurn=true, skip passing generatedImages to MessageBubble to avoid double rendering in both segment and bubble paths. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a187271450
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| ): GeneratedImageItem[] { | ||
| const seen = new Set(prev.map((item) => item.artifact.key)) | ||
| const additions: GeneratedImageItem[] = [] | ||
| let order = 0 |
There was a problem hiding this comment.
Keep generated image ordering monotonic across appends
appendGeneratedImages resets order to 0 on every call, but the final list is sorted by (toolCallIndex, order). When multiple image_generate results share the same toolCallIndex (for example, repeated/continued tool phases that reuse indices), later images can be reinserted ahead of earlier ones (e.g., 0,1 then 0 sorts as 0,0,1), which breaks the intended stable display order. Use a monotonic base order (or include event sequence) so newly appended images always stay after previously accepted images within the same index bucket.
Useful? React with 👍 / 👎.
…mage support
Replace single artifactRef with generatedImages data model to handle multiple images per image_generate call without overwriting. Images render via GeneratedImageGroup in the assistant turn path, with markdown suppression via suppressedArtifactKeys to prevent duplicates.
Fix: when hasAssistantTurn=true, skip passing generatedImages to MessageBubble to avoid double rendering in both segment and bubble paths.