Skip to content

fix(executor): restore original image attachment paths - #2255

Merged
qdaxb merged 1 commit into
mainfrom
fix/restore-image-attachment-previews
Jul 27, 2026
Merged

qdaxb merged 1 commit into
mainfrom
fix/restore-image-attachment-previews

Conversation

@qdaxb

@qdaxb qdaxb commented Jul 27, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • restore original image paths from the Codex file-mention wrapper when rebuilding user-message attachments
  • prefer the cached UI attachment metadata over transient *.model-input.* artifacts
  • document the attachment persistence contract in Chinese and English
  • add regression coverage for transcript reconstruction and cached-message merging

Root cause

Image preprocessing creates a temporary *.model-input.* file for model consumption. The Codex transcript exposed that transient path as the user-message attachment, and the file was removed after the turn. Wework therefore rendered a missing image when reopening or switching back to the task even though the original attachment still existed.

Validation

  • cargo test --lib — 420 passed, 0 failed, 1 ignored (requires an external model)
  • cargo test --lib transcript_ — 36 passed
  • cargo fmt --all -- --check
  • git diff --check
  • pre-push cargo test --all-features --lib
  • pre-push cargo clippy
  • pnpm --filter wework exec node e2e/desktop/task-flow.e2e.mjs --attachment-only — real Tauri attachment persistence/reopen flow passed

Summary by CodeRabbit

  • Bug Fixes

    • Improved image attachment handling during message restoration.
    • Original attachment paths are now preserved instead of temporary converted files.
    • Historical messages, reopened tasks, and switched tasks continue to display image previews after temporary processing files are removed.
    • Restored messages now prioritize images explicitly referenced in the original user message.
  • Documentation

    • Clarified attachment handling and temporary image file behavior in the architecture guide.

@coderabbitai

coderabbitai Bot commented Jul 27, 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: 7cb2ba4b-5f76-4bd9-8d85-a1479f0236ef

📥 Commits

Reviewing files that changed from the base of the PR and between aa74cfc and 03adaca.

📒 Files selected for processing (4)
  • docs/en/wegent/developer-guide/architecture.md
  • docs/zh/wegent/developer-guide/architecture.md
  • executor/src/runtime_work/handler/tests.rs
  • executor/src/runtime_work/transcript.rs

📝 Walkthrough

Walkthrough

Transcript restoration now preserves original image attachment paths instead of transient .model-input files. Attachment metadata merging, mentioned-image parsing, tests, and English and Chinese architecture documentation were updated.

Changes

Attachment restoration

Layer / File(s) Summary
Transcript attachment precedence
executor/src/runtime_work/transcript.rs
Restored messages merge non-empty attachment metadata and prioritize image references from the “Files mentioned by the user” section over structured transient image fields.
Validation and restoration contract
executor/src/runtime_work/handler/tests.rs, docs/en/wegent/developer-guide/architecture.md, docs/zh/wegent/developer-guide/architecture.md
Tests validate the restored local attachment path, and architecture documentation defines temporary model-input files as inference-only.

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

Possibly related PRs

  • wecode-ai/Wegent#1968: Also preserves original Codex image attachment paths instead of transient model-input paths.
✨ 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/restore-image-attachment-previews

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 27, 2026 15:33
@qdaxb
qdaxb merged commit 1d12a58 into main Jul 27, 2026
31 of 33 checks passed
@qdaxb
qdaxb deleted the fix/restore-image-attachment-previews branch July 27, 2026 15:34
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