mirror of
https://github.com/HKUDS/DeepTutor.git
synced 2026-12-02 05:20:33 +08:00
* fix(chat): keep unsent drafts safe when restore fails When the workspace-draft restore fails, the composer stays out of sync with the stored draft. Saving on workspace switch then clobbers the unseen stored draft with the composer content (or empties it), and sending clears the stored draft although its text was never shown. Track the restore failure and, on workspace switch, skip the save when the composer has no new content; otherwise merge the newly typed input on top of the stored draft, re-reading it once per mount so a retried switch merges the original draft instead of re-appending. If the re-read also fails, reject the switch so no text is lost. Sending no longer clears the stored draft after a failed restore. Add tests that cover the restore-failure switch and send paths. * fix(chat): keep typed text when stored draft text is empty The failed-restore merge used a ternary that fell back to `stored?.text ?? draft.text`, so an empty-string stored draft dropped newly typed input (deleted the draft on save). Merge with filter(Boolean) so any non-empty side survives, matching transferWorkspaceDraft. * test(codebuddy): make credential fixture expiry relative to now test_load_credentials_parses_session wrote a hard-coded expiresAt of 1791055241000 (2026-10-03 15:40:41 UTC) and asserted is_expired() is False. Once that instant passed the assertion flipped, so the test now fails on every Python version for every branch. Derive expiresAt / refreshExpiresAt from time.time() so the fixture always describes a live session, and assert against the value written. --------- Co-authored-by: XZH <cto@xzh.ai>