[Bug]: Unsaved queued-message edits are lost when switching projects#23960
[Bug]: Unsaved queued-message edits are lost when switching projects
Before submitting
- I searched existing issues and did not find a duplicate.
- I included enough detail to reproduce or investigate the problem.
Area
apps/web (queued-message composer in the desktop app)
Steps to reproduce
- In project A, start a turn and queue a follow-up message, for example
Original message. - Open the queued message for editing and change its text, for example to
Updated message. - While the edit is still open, without saving or cancelling, switch to project B.
- Switch back to project A and return to the original thread.
- Inspect/reopen the queued message for editing.
Expected behavior
The in-progress edit should remain recoverable when returning to the thread or reopening the queued-message editor. Switching projects should preserve the edit draft until it is explicitly saved or cancelled.
Actual behavior
The queued message is back to its original text, and the unsaved changes are gone. This forces the user to rewrite the edit.
The edit had not been saved before switching projects. This report concerns loss of the in-progress edit draft; it does not imply that unsaved text should automatically replace the queued message on the server.
Impact
Minor bug or occasional failure: loses user-authored text when navigating between projects.
Version or commit
Exact affected running build not captured. Source investigation below references main at 9a6380263b0304494151d297a53210c10b1d07ef.
Environment
Windows, T3 Code desktop app.
Investigation
Reported from actual use; the UI reproduction has not been independently rerun for this report.
editingis component-local React state. Navigating to another thread clears it; the accompanying comment says the edit draft stays for later.- Edit drafts use a per-thread, per-run draft target.
- However,
beginEditunconditionally callsstore.clearComposerContent(target)and thenstore.setPrompt(target, request.text). Reopening an edit therefore replaces any retained edit draft with the original queued text.
This appears consistent with the reported loss after navigating away and back. A potential fix should preserve and restore an existing edit draft and the metadata needed to resume the edit, while retaining explicit Save/Cancel behavior.
Suggested regression coverage: edit queued text, navigate to another project/thread, return and reopen the same queued item, and verify the modified text survives. Also verify Save persists the restored edit and Cancel discards it.
Related issue
Related to #15611, which concerns a queued message dispatching its original text while an edit is open. This report focuses on losing the unsaved edit through project navigation.
Workaround
Save the queued-message edit before switching projects.