Repository navigation
FEAT GUI: Preserve chat drafts when exploring datasets (#2750) - #3334
Conversation
cf4976b to
e7ac5fd
Compare
|
Thanks Roman Lutz (@romanlutz) for the thorough review and guidance! I have resolved all merge conflicts, rebased onto
|
|
Thanks for the update, RohithPariki. I checked These two issues still reproduce and their comments remain open:
Could you address these two as well? |
e7ac5fd to
92e3234
Compare
|
Thank you for the review and catching those subtle edge cases! I have addressed both issues in the latest push:
All checks ( |
Preserves chat input text, media attachments, system prompts, target configuration, and converters across navigation between Chat and Datasets. Implements single-use handoff consumption, context-switch protection, bidirectional route restoration, and explicit blob URL revocation.
92e3234 to
4acdae8
Compare
Roman Lutz (romanlutz)
left a comment
There was a problem hiding this comment.
Rechecked 4acdae8. The four earlier findings are fixed. The three remaining issues below still reproduce with the real App and composer.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 6192834b-f355-4da6-8cca-3f21ee95fc77
Restore the full composer only after its destination is ready. Preserve target and converter setup, text metadata, and attachment ownership. Guard stale asynchronous work and dirty-draft imports, and cover actual App navigation and recovery. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 6192834b-f355-4da6-8cca-3f21ee95fc77
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 6192834b-f355-4da6-8cca-3f21ee95fc77
Use a complete draft attachment list in the isolated App mock, and assert the loading gate while a revisited attack is unresolved. This lets the target revalidation complete without leaking a deferred mock into the next test. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 6192834b-f355-4da6-8cca-3f21ee95fc77
Separate routed draft identity from hydrated attack metadata and gate only handoff restoration. Retain the mounted composer through created-attack transitions and cover historical loading and failed-prompt recovery with the real App. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 6192834b-f355-4da6-8cca-3f21ee95fc77
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 6192834b-f355-4da6-8cca-3f21ee95fc77
Description
Resolves #2750 (Item 6 of 17 in dataset epic #2744).
Navigating from Chat to Datasets to browse or inspect seed datasets previously caused unsubmitted chat drafts (including prompt text, media attachments, system prompts, active target selection, and converter configurations) to be lost upon leaving the chat route.
This PR implements robust chat draft preservation across navigation:
ChatDraftProvider&useChatDraftHandoff: Pure React context and custom hook managing preserved chat draft state and pending import payloads across client-side route transitions without storing drafts in URLs or databases.ChatWindowunmounts or navigates away, dirty drafts (containing user input, attachments, system prompt, or converter settings) are preserved alongside originating route metadata (distinguishing unsaved attacksnullfrom persisted attacksattackId).blob:) are explicitly revoked viaURL.revokeObjectURLwhile preserving non-blob assets (/api/media).lastDatasetsLocation).Tests and Documentation
frontend/src/hooks/useChatDraftHandoff.test.tsx(22 tests) covering:new_attack,current_conversation,new_conversation).frontend/src/utils/routeParams.test.tsforisDatasetsPathandisChatPath.frontend/src/App.test.tsx(92/92 passed):npm run type-check(tsc --noEmitpassed with 0 errors)npm run lint(ESLint passed with 0 warnings, max-warnings 0)Browser evidence
Recorded the actual, unmodified production frontend at commit
cf4976b0b7b8f87222300f9724f470dfd45989fdin an isolated Chromium browser. All API responses, draft text, media, and datasets are synthetic fixtures. No live backend, credentials, or model calls were used. The dark captions are recording annotations, not application UI.The 23-second walkthrough shows the current behavior:
These are observed regressions, not a claim that the feature passes end-to-end validation. This production recording does not exercise the separate development
StrictModecleanup-loop finding.Walkthrough
pr3334-browser-walkthrough.webm
Restored draft snapshot
Additional validation:
npm run buildpassed. The Playwright browser walkthrough passed its observation assertions, confirming the successful restoration and the regressions described above. The uploaded WebM was decoded and seeked successfully in Chromium before attachment.