Repository navigation
Conversation
9a55d77 to
b7447af
Compare
UX Review (Opus 5.5, fork) — ✅ PASSUX-level review of UX-Verdict: PASS Nothing blocks. The committed screenshots show both new notices: the text coming back into the composer (02) and the "delivered after all" warning (03). No first-time reader has seen them, because this fork lane has no blind read. Notes
[UX-REVIEWED] fddd55c Description read[DESCRIPTION-READ] 009a8a9d3f82da33131eaa709b2fba0b94305483d21f57d4d665f382c4531c97 That sha256 names everything this verdict read: the PR description, plus the 6 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
Design Review (Opus 5.5, fork) — ✅ PASSDesign-level review of Design-Verdict: PASS No design-level blocker: the change is aimed at a real data-loss window, retires records only where the in-memory warning already ends, and the screenshots committed with this revision cover the new notices. Notes
[DESIGN-REVIEWED] fddd55c Description read[DESCRIPTION-READ] 079bae5e4b675e4bb81225257530cc551ca3b255f0c258cf89d46aa5ed3d6dbc That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
First Principles Review (Opus 5.5, fork) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing blocks. Two durability layers built after the hand-back go beyond the Goal, and one adds a generic store hook that only one store uses. Notes
What this change shipsInventory (10 items) — 7 justifiedIntent: keep an in-doubt send's text after a page reload or tab crash so the user doesn't retype it. This is an ADDITION (split out of #6825).
[FIRST-PRINCIPLES-REVIEWED] fddd55c Description read[DESCRIPTION-READ] e96cac3e0ddf871a10413eece743f4b5eb41bb2dfbd1de203cce4a00b763a3e9 That sha256 names the PR description this verdict read. Recompute it with |
Opus 5.5 Review (fork) — ✅ no blocking findingsReviewed |
GPT 6.1 Review (fork) — ✅ no blocking findingsReviewed Review detailsNo findings. |
b7447af to
8b4f356
Compare
8b4f356 to
067a94b
Compare
067a94b to
c27e4ef
Compare
c27e4ef to
7b7e5bd
Compare
e4bc46d to
0c962d7
Compare
0c962d7 to
550fa92
Compare
550fa92 to
6d61872
Compare
6d61872 to
e53fe1d
Compare
e53fe1d to
6420636
Compare
|
This changes behaviour users already rely on, so it needs a design sign-off from a maintainer before it can merge. A maintainer will post the decision here. To propose a design, follow the request-for-change process in CONTRIBUTING.md (docs/request-for-change/). The review of this head found no blocking defect. It found the following:
Optional:
|
Code change approver recommendation: A person should decideWhy: the decider thinks the change is probably fine but estimates a 22% chance that this change introduces a defect, above the 12% limit for approving on its own. Adds a saved recovery store in sessionStorage so a send whose delivery is in doubt keeps its text across a reload: records are written while the delivery warning shows and deleted wherever the warning ends. After a reload, each send is checked against the server history before its text goes back into the composer. I checked every reader and writer of the draft stores (all go through sanitize/encode), the record lifecycle (claim, release, adopt; a record is deleted only after a successful save by the composer instance holding the text, and refused saves, instances that close, and chats dropped by the draft cap keep it), the windows-opened-from-another check, the history paging and failure paths, the merged-row selector change, and the parsers that re-check saved data. Tests are extensive and CI test, lint and build jobs passed. No concrete failing path found. Remaining concerns (rollback dropping drafts in the new object shape, a contradictory notice left in the transcript, hidden module state) are not blocking. Tier: 2, held for a person: design-doc-gate: D. An automated recommendation, not a review: a maintainer still decides. It approves on its own only when the estimated chance of a defect is at most 12% and the change has at most 400 changed lines. Decider v3c (217fe607) · commit |
The delivery warning holds a timed-out send's payload in module memory, which a reload or crash destroys after the composer has already been cleared. Mirror each warning into a per-send localStorage record owned by the tab that raised it, and once the chat's history has loaded on the next page load, hand back any send the server never recorded, with a notice.
Problem / Motivation
Goal: A reload or crash while a send's delivery is in doubt no longer loses its text: the next page load puts it back in the composer, unless the server already has it.
Split out of #6825, as its maintainer triage asked: this is the persisted recovery store, the last of the three units named there. It builds on the delivery-warning strip (#22478).
When a send times out, the delivery warning keeps what it consumed (text, pastes, files, quote, session refs, knowledge) in module memory, so Remove can hand it back. The composer has already been cleared and the optimistic bubble lives only in the store. A reload or a renderer crash at that point destroys all three, so the user's words are gone with no trace and no message.
Why it matters
The send most likely to be in doubt is the one sent while the connection was failing, which is also when a user is most likely to reload. Retyping a long prompt from memory is the cost, and nothing tells the user the message may not have gone out.
Not a goal
What changed (motivation → approach → change)
utils/deliveryWarning.tsnow writes each warning throughutils/sendRecoveryStore.tsand retires the saved copy wherever the warning ends: pruned (confirmed, queued, cleared, refetched away) or removed with the strip's exit.utils/windowStorageOwner.ts, now shared withcomposerSendHolds.ts), so every later load of the pop-out, a navigation inside it included, keeps its own records. A write the tab refuses returns false and leaves the saved records as they were.useDeliveryWarningStripclaims the recovered sends andutils/recoveredSendHistory.tsreads the slot's history newest page first. It keeps reading older pages until it has found every send or reached the transcript's start. Row times are not used to stop early, because the gateway's clock and this browser's can disagree. The loaded window alone is not enough, because later output can push a delivered send out of it. A send the server has, as a user row or a queued item, is retired without a word, unless a stored draft already holds its text from an earlier load: then the delivered-after-all notice below is posted before the record is retired. A row a queue drain merged from several sends counts for every id in itsmeta.sendIds, not only the last one inmeta.sendId. The sharedselectSendConfirmed/selectSendAcceptedselectors readmeta.sendIdsthe same way, so the loaded transcript and the late-delivery notice both recognise a send folded into a merged row. If the history cannot be read, or 8 pages do not reach that point, nothing is handed back and every record is kept for the next load. The rest are merged into one call to that surface's existing restore (restoreSentTurnon the page, the pane'srestoreIntoComposer), with a notice: "A message from before the page reloaded was never confirmed, so its text is back in the composer." A crewmate pane, which raises no warning, takes nothing.saveDraftsreports that write once text, files, paste blocks and session refs all stored; a pane, whose live composer is React state, reports it when it parks (switching chats, closing,pagehide). A save retires only the chats whose drafts it actually kept: a chat the 2 MiB draft budget dropped keeps its record until a later save stores it again. Only the composer instance holding the text can retire its record; when that instance closes without a good save, it stops waiting and the record stays for the next page load. Until then, for example on a full storage quota or a renderer crash, the record stays. The draft's own stored entry records which recovered sends its text already holds, in the same write as the text. So a later reload never appends that text again, even when a paste or session-ref write failed and the record had to stay; it puts back only what the draft lacks.parseSentTurnandparsePaneSentkeep only well-formed fields, reusing the paste-block and session-ref sanitizers the draft stores already use, and the transcript's ownreadMessageQuote, which caps the quote's text. A payload is restorable on the same termsisEmptyTurnallows a send: typed text, a quote, session refs (page) or files (pane). A quote comes back inside the text rather than on the stage, because the stage is not saved and a second reload would lose it.Two
delivery_recovered_*keys are added to all 13 catalogs.Backwards compatibility
Compatible: additive storage, plus two narrow behaviour changes.
mc-chat-send-recovery(the records) andmc-chat-send-recovery-window(this window's id, for the pop-out check).selectSendConfirmed/selectSendAcceptednow readrowSendIds, so every existing caller counts a send folded into a merged queue-drain row as confirmed.Removes nothing: no record or capability is taken away. A saved copy is retired only where its in-memory warning already ends.
Tests
sendRecoveryStore.durability.test.ts: two sends on one chat both survive; forgetting one leaves the other; a prefix-sharing slot is not read; nothing is written to localStorage and a sibling tab (empty sessionStorage) sees nothing; a malformed value is dropped; a refused write returns false and keeps what was saved; and the TTL applies.useDeliveryWarningStrip.test.tsx, against the real store with the history read stubbed: recovered sends come back merged with one notice only once the transcript is ready, and their records are then gone; a later load does not hand the same send back again; a send whose text reached the draft while its paste write failed is not appended again on reload, and only its paste comes back; a record whose draft was not yet written stays until the composer instance holding it reports the write, only for that surface and chat, and a save by any other instance leaves it; a send the transcript already has is retired silently; so is one the server history holds a page beyond the loaded window, one a queue drain merged into another send's row, and one whose echo lands while the history is read; a send the history holds a page back is retired even when the browser clock runs ahead of the gateway; an unreadable history hands nothing back and keeps the record, and so does one that reaches the page cap, which is read exactlyRECOVERY_HISTORY_MAX_PAGEStimes; a later echo posts the recovered-delivered notice, not the removed one, and so does a later load whose history has a send the stored draft already holds; the other surface and a disabled host take nothing; raising a warning saves it and Remove or a prune retires it.useChatPaneDraft.recovery.test.tsandcomposerDrafts.recovery.test.ts: a pane keeps a waiting record while the text is only on screen or when storage refuses the park, and retires it when it parks (rebind, unmount,pagehide); a pane restore reports saved only when the text went to storage and no other pane took it; a page save that drops an awaiting chat's draft to fit the budget keeps its record, and a later save that stores it retires it; a closed page or pane instance whose last save was refused leaves the record for the next load, and a later instance's save does not retire it; the page retires waiting records only when text, files, paste blocks and session refs all stored, and keeps them when any of those writes is refused.recoveredSendParse.test.ts: both parsers keep every field their restore takes, drop malformed members, accept a quote-only, session-ref-only or files-only payload, cap the quote throughreadMessageQuote, and refuse an empty payload.Sweep (
src/i18nwith the diff-scoped style gates on,src/components,src/store,src/utils,src/chat-core,src/pages/chat,src/test/ChatPane*,src/test/ChatPage*,src/test/ChatInput*,src/test/recoveredSendParse.test.ts) passes: 10598 of 10598.tsc -p tsconfig.app.jsonandeslint --max-warnings 0on every changed source and test file are clean.Manual verification
Run on the real built app with a local Playwright capture script (kept out of this PR to stay under the size cap; it can land on its own). Every
/apicall is answered from fixtures, storage is kept across the reload, and the harness holds the dashboard socket open.POST /api/chatis never answered, so the client's 10s deadline raises the warning. The script asserts each state before it shoots and exits non-zero on any mismatch:Last run at the previous revision, against the sessionStorage store; it passed every assertion. This revision changes only what happens to the record after the hand-back, which none of the three steps observes. The re-run frames add one toast outside this feature ("Couldn't load your starred mates."), so the committed frames, from the previous base, were kept.
Not covered by this run: a real gateway process, and the split-view pane (covered by the hook's unit tests through the same shared hook).
Screenshots / video
Chat page, dark: in doubt before the reload, recovered after it, delivered after all.
Related Issues
Part of #6825.
Checklist