Skip to content

fix(wework): restore historical message images - #2147

Merged
qdaxb merged 2 commits into
mainfrom
fix/wework-history-image
Jul 23, 2026
Merged

qdaxb merged 2 commits into
mainfrom
fix/wework-history-image

Conversation

@qdaxb

@qdaxb qdaxb commented Jul 23, 2026 •

Copy link
Copy Markdown
Contributor

What changed

  • preserve a durable local image path when transient composer blob URLs are removed
  • restore image previews and downloads from local_path for existing historical messages
  • add unit coverage for persisted local-path previews
  • extend the real desktop attachment E2E flow to reopen Wework and verify both historical conversations still render their images
  • document historical local-image preview behavior in Chinese and English

Root cause

Local images used a transient blob: URL while composing. Session persistence removed that URL but did not replace it with the attachment's durable local_path. After reopening a conversation, the preview attempted the remote attachment download path with a local negative attachment ID and rendered only a file placeholder.

User impact

Images sent from the local Wework runtime remain visible after switching conversations or reopening Wework, provided the original local attachment file still exists.

Validation

  • pnpm --filter wework test --run src/lib/attachments.test.ts src/components/chat/MessageList.test.tsx (123 tests passed)
  • Prettier and ESLint on all changed Wework source, test, and E2E files
  • pnpm --filter wework e2e:desktop:attachment-only-sidebar
  • pre-push Wework ESLint, TypeScript, and full unit-test suite

Final desktop E2E evidence was generated under:

wework/test-results/desktop-e2e/2026-07-23T05-34-22-644Z-31538/

The screenshot chain covers the first image submission and completion, second image submission and completion, reopening Wework and restoring the second conversation image, then switching to and restoring the first conversation image.

Summary by CodeRabbit

  • Bug Fixes

    • Improved persistence of locally attached image previews when reopening the app or returning to a conversation.
    • Restored image previews using the original local file when available.
    • Preserved previews across attachment processing instead of losing them.
  • Tests

    • Expanded coverage for restoring image previews and attachment-only task history across navigation and reopening.

@coderabbitai

coderabbitai Bot commented Jul 23, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: d1f7dd6b-7d0a-4ef2-a6f3-9937a2b4aeae

📥 Commits

Reviewing files that changed from the base of the PR and between ab7b5ec and 4767fac.

📒 Files selected for processing (7)
  • docs/en/wework/tasks.md
  • docs/zh/wework/tasks.md
  • wework/e2e/desktop/task-flow.e2e.mjs
  • wework/src/components/chat/AttachmentImagePreview.tsx
  • wework/src/components/chat/MessageList.test.tsx
  • wework/src/lib/attachments.test.ts
  • wework/src/lib/attachments.ts

📝 Walkthrough

Walkthrough

Attachment persistence now retains local filesystem paths for image previews. Preview rendering falls back to those paths, historical message restoration is tested, task lifecycle E2E coverage verifies reopened previews, and English and Chinese documentation describe the behavior.

Changes

Local image preview persistence

Layer / File(s) Summary
Persist local attachment paths
wework/src/lib/attachments.ts, wework/src/lib/attachments.test.ts
Object URL previews are persisted as attachment local paths, with updated helper tests.
Restore previews from local paths
wework/src/components/chat/AttachmentImagePreview.tsx, wework/src/components/chat/MessageList.test.tsx
Preview loading, failure tracking, downloads, and identity handling fall back to local_path; historical restoration is tested without network requests.
Verify reopened task previews
wework/e2e/desktop/task-flow.e2e.mjs, docs/en/wework/tasks.md, docs/zh/wework/tasks.md
The attachment-only flow verifies both reopened task previews, and documentation describes preview persistence and file-deletion behavior.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

Suggested reviewers: ficohu

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/wework-history-image

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 July 23, 2026 06:02
@qdaxb
qdaxb merged commit 996cb2c into main Jul 23, 2026
31 of 34 checks passed
@qdaxb
qdaxb deleted the fix/wework-history-image branch July 23, 2026 06:02
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