Repository navigation
fix(chat): preserve queued attachments after restart - #955
Merged
Merged
Conversation
Editing a restored queue entry must retain the attachments stored by the Host when the original in-memory composer draft is no longer available. Otherwise editing removes the queued copy and silently loses its images. Keep the cached draft path unchanged and verify restored image, file and text-only messages retain their content and attachments when resubmitted.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Queue a message with an image while the agent is running, quit PI-Desktop normally, then reopen the same chat and edit the queued message. The text returns to the composer, but the image disappears. Sending the edited message then omits the image, even though the saved queue entry still contained it.
queue-attachments-restart-before-after-hd.mp4
34-second before/after recording, 1920 × 1440. English steps highlight the normal quit/reopen, edit and resend path.
Fix
When the original in-memory draft is unavailable, restore attachments from the Host queue entry alongside its existing content. Keep the cached-draft path unchanged, and keep restored inline files removable by deleting their visible file reference.
Verification
Candidate and test environment
ea5890b94f88aaabef4631ed83c2ac99880435c00310a5afc622d143709dbc8a7afd09a0356fdc3bnode --test apps/desktop/test/queue-pending-actions.test.mjs apps/desktop/test/composer-send-state.test.mjs(19 passed)pnpm test:e2e:composer-pastepnpm build:js,pnpm --filter @pi-desktop/desktop build,pnpm --filter @pi-desktop/desktop typecheck,pnpm lint,pnpm docs:check,pnpm check:pr-base0b8dda6953c16bca0c69a8f467f210142ac858aahas the same executable tree as the tested candidate.