DOCX preview can show stale content after regenerating the same file path
Bug Description
Codex Desktop appears to cache the preview of a generated .docx file by path. After regenerating the same DOCX path with updated content, the file preview still showed the old paragraph, even though the actual DOCX package had been updated.
This caused the user to believe the requested edit had not been applied. Direct inspection of word/document.xml confirmed the old sentence was gone and the new sentence was present, while the visual preview still displayed the old text.
Environment
- Agent Platform: Codex Desktop / Codex CLI
- Codex CLI Version:
codex-cli 0.135.0 - OS: Windows 11 (
Microsoft Windows NT 10.0.22621.0) - Shell: PowerShell 7.6.1
- File type:
.docx
What Happened
- Generated a DOCX file at an existing path using a Python OOXML/template script.
- User opened/previewed the file in Codex Desktop and saw an old paragraph:
- e.g. wording like
贵司方案目前较有可区分价值...创造性风险较高...
- Regenerated the same DOCX path after changing the underlying JSON/template content.
- The preview still displayed the old paragraph.
- Verified the DOCX itself by opening the zip package and reading
word/document.xml; the old sentence was no longer present and the new text was present. - Saving the regenerated document under a new filename such as
-V2.docxavoided the stale preview confusion.
Expected Behavior
When a file is regenerated or overwritten at the same path, Codex Desktop should invalidate the preview cache and show the latest file contents.
At minimum, the preview should have a visible refresh/reload action or an indication that the displayed preview may be stale.
Steps to Reproduce
- Create or open a
.docxfile in a Codex Desktop workspace. - Preview it in Codex Desktop.
- Programmatically overwrite the same
.docxpath with different text inword/document.xml. - Reopen or revisit the preview for that same file path.
- Observe whether the preview updates to the new content or continues showing the old content.
- Separately inspect the DOCX zip contents to confirm
word/document.xmlcontains the new text.
Impact
This is particularly confusing for document-generation workflows, because the agent can correctly update the file while the user sees stale content in the preview and reports that the change was not made.
Workaround
- Save regenerated DOCX files with a new filename/version suffix, e.g.
-V2.docx. - Directly inspect
word/document.xmlto verify the actual file contents.
Additional Context
The issue appeared during a Chinese patent-search feedback document workflow. The generated DOCX was valid and could be verified by reading the internal OOXML, but Codex Desktop preview did not reflect the latest content for the same path.
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗