Skip to content

fix(chat): preserve queued attachments after restart - #955

Merged
vastsa merged 2 commits into
vastsa:mainfrom
yuxino:fix/queued-attachments-after-restart
Sep 23, 2026
Merged

vastsa merged 2 commits into
vastsa:mainfrom
yuxino:fix/queued-attachments-after-restart

Conversation

@yuxino

@yuxino yuxino commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

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

  • Reproduced before and verified after in the real macOS app using normal Quit confirmation and a new app process. The edited message's actual model request changes from zero images to one.
  • Regression coverage includes image + file, image-only and text-only rows, resubmission, existing cached drafts, and deleting a restored file reference while retaining the image.
  • Targeted tests, Composer Electron E2E, desktop build/typecheck, lint and documentation checks passed.
Candidate and test environment
  • Base: ea5890b94f88aaabef4631ed83c2ac99880435c0
  • Candidate: 0310a5afc622d143709dbc8a7afd09a0356fdc3b
  • macOS, Electron 43.6.0; isolated app/data profile; Rust Host built from the base revision.
  • A local vision-capable model fixture holds the first turn so the message can be queued. The UI, queue persistence, normal quit/reopen and attachment submission use the real application. No paid provider is involved.
  • node --test apps/desktop/test/queue-pending-actions.test.mjs apps/desktop/test/composer-send-state.test.mjs (19 passed)
  • pnpm test:e2e:composer-paste
  • pnpm build:js, pnpm --filter @pi-desktop/desktop build, pnpm --filter @pi-desktop/desktop typecheck, pnpm lint, pnpm docs:check, pnpm check:pr-base
  • PR merge candidate 0b8dda6953c16bca0c69a8f467f210142ac858aa has the same executable tree as the tested candidate.
  • Windows/Linux native restart was not tested; no Host, IPC or persisted-format changes.

yuxino and others added 2 commits September 23, 2026 18:59
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.
@vastsa
vastsa merged commit 4d231d7 into vastsa:main Sep 23, 2026
4 checks passed
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.

2 participants