Skip to content

fix(wework): keep viewed images out of message artifacts - #2507

Merged
qdaxb merged 1 commit into
mainfrom
fix/view-image-message-artifact
Aug 8, 2026
Merged

qdaxb merged 1 commit into
mainfrom
fix/view-image-message-artifact

Conversation

@qdaxb

@qdaxb qdaxb commented Aug 8, 2026 •

Copy link
Copy Markdown
Contributor

What changed

  • Keep view_image results inside expandable tool details instead of rendering them again in the assistant message's generated-image gallery.
  • Preserve image_generation as the only tool source for final generated-image artifacts.
  • Add component and desktop E2E regression coverage.
  • Document the rendering boundary in the Chinese and English runtime-local-work guides.

Why

MessageList collected both image_generation and view_image blocks as final image artifacts. Since view_image already renders its preview inside the tool details, the same inspected image remained duplicated at the bottom of the assistant turn.

Impact

Images inspected through view_image remain available in tool details, while the bottom-of-message gallery is reserved for images generated as final output.

Validation

  • pnpm --filter wework exec vitest run src/components/chat/MessageList.test.tsx
  • pnpm --filter wework typecheck
  • Prettier and ESLint on changed source, test, E2E, and documentation files
  • pnpm --filter wework exec node e2e/desktop/task-flow.e2e.mjs --view-image-only
  • Full pre-push Wework ESLint, TypeScript, and unit-test checks

Summary by CodeRabbit

  • Bug Fixes

    • Images viewed through the image-viewing tool no longer appear incorrectly in the final generated-image gallery.
    • Final image galleries now include only images produced by image-generation actions.
    • Viewed images remain available in expandable tool details and previews.
  • Tests

    • Added coverage to verify correct image display behavior for viewed images.

@coderabbitai

coderabbitai Bot commented Aug 8, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The chat UI now treats only image_generation results as final generated-image gallery artifacts. view_image results remain available in tool details. Unit tests, end-to-end tests, and bilingual documentation cover this behavior.

Changes

Generated-image gallery filtering

Layer / File(s) Summary
Gallery extraction
wework/src/components/chat/MessageList.tsx
getGeneratedImages now processes only image_generation blocks and no longer extracts images from view_image results.
Regression coverage and documentation
wework/src/components/chat/MessageList.test.tsx, wework/e2e/desktop/task-flow.e2e.mjs, docs/en/wegent/developer-guide/runtime-local-work.md, docs/zh/wegent/developer-guide/runtime-local-work.md
Tests verify that view_image outputs do not render as generated-image artifacts. The English and Chinese guides document the same display behavior.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: preventing viewed images from appearing as message artifacts.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/view-image-message-artifact

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@qdaxb
qdaxb marked this pull request as ready for review August 8, 2026 15:04
@qdaxb
qdaxb enabled auto-merge August 8, 2026 15:04

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
wework/e2e/desktop/task-flow.e2e.mjs (1)

2574-2581: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Scope the negative assertion to the target assistant message.

The selector on Line 2575 counts galleries across the whole document. If another assistant message in this flow contains a valid image_generation result, this test fails for an unrelated gallery. Reuse the stable container for the assistant message that owns viewImageBlockSelector and count only that container’s gallery.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@wework/e2e/desktop/task-flow.e2e.mjs` around lines 2574 - 2581, Update the
generated-image gallery count assertion near viewImageBlockSelector to query
only the stable assistant-message container that owns that selector, rather than
the whole document. Reuse that container when calling getElementCount and
preserve the expected count of zero and existing assertion message.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@wework/e2e/desktop/task-flow.e2e.mjs`:
- Around line 2574-2581: Update the generated-image gallery count assertion near
viewImageBlockSelector to query only the stable assistant-message container that
owns that selector, rather than the whole document. Reuse that container when
calling getElementCount and preserve the expected count of zero and existing
assertion message.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: c89baf18-7977-45b7-b461-274cf97d3524

📥 Commits

Reviewing files that changed from the base of the PR and between c168977 and 0d2ec84.

📒 Files selected for processing (5)
  • docs/en/wegent/developer-guide/runtime-local-work.md
  • docs/zh/wegent/developer-guide/runtime-local-work.md
  • wework/e2e/desktop/task-flow.e2e.mjs
  • wework/src/components/chat/MessageList.test.tsx
  • wework/src/components/chat/MessageList.tsx

@qdaxb
qdaxb added this pull request to the merge queue Aug 8, 2026
Merged via the queue into main with commit a375f7a Aug 8, 2026
62 of 64 checks passed
@qdaxb
qdaxb deleted the fix/view-image-message-artifact branch August 8, 2026 15:25
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