Repository navigation
feat(chat): one owner for the delivery-warning strip both chat surfaces render - #22478
Conversation
UX Review (Opus 5.5, fork) — ✅ PASSUX-level review of UX-Verdict: PASS Nothing blocks. This lane's limit: no first-time reader has seen the strip. The committed stills show every new control and state (page and pane, light and dark), and the two committed recordings cover Remove. Notes
[UX-REVIEWED] 4abaedb Description read[DESCRIPTION-READ] 72a6cae48f3b2d27d4f1c1a320b59187d4c4192253c18bd41a42d611d09586ed That sha256 names everything this verdict read: the PR description, plus the 17 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 Nothing blocks: a real duplicate-or-lose hazard, fixed by reusing each surface's existing failure restore. The take-aways are additive, and the one reworded key's readers are unaffected. Notes
[DESIGN-REVIEWED] 4abaedb Description read[DESCRIPTION-READ] d49f312be639f9a4d5586efbff9516741922dab68c6f7452f98fd740c0270664 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 |
2a7e03b to
584496f
Compare
First Principles Review (Opus 5.5, fork) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing blocks. Every item comes from the asymmetric resend-or-lose risk in the Goal. The notice rewording goes with the new strip, so it is not a standalone product-shape change. What this change shipsInventory (9 items) — 9 justifiedIntent: when a send's delivery is in doubt, let the user take the message back safely instead of retyping it and maybe sending it twice. ADDITION.
[FIRST-PRINCIPLES-REVIEWED] 4abaedb Description read[DESCRIPTION-READ] 07d911cce126318e58aba0a2e568394d31f8c57e52ad25e6f779e1198d187dcc That sha256 names the PR description this verdict read. Recompute it with |
Security Scope Review (fork) — 🔴 BLOCK (blocking)Which legitimate operations does no leg reported, and this was not the nothing-to-adjudicate short circuit No |
Opus 5.5 Review (fork) — ✅ no blocking findingsReviewed |
GPT 6.1 Review (fork) — ✅ no blocking findingsReviewed Review detailsNo findings. |
584496f to
e857b82
Compare
e857b82 to
697c8ce
Compare
697c8ce to
4af92c3
Compare
4af92c3 to
9542684
Compare
ee87dae to
865dd5d
Compare
865dd5d to
56961dd
Compare
|
Hold at 56961dd: the branch conflicts with main. GitHub reports the PR as CONFLICTING. A merge against current main conflicts in I found no defect in the logic I read. The strip re-checks each send when Remove is clicked and restores all pending sends in one call (deliveryWarning.ts#L104-L128). While rebasing, consider trimming the 16 committed screenshots and recordings to the 2-3 shots the guidance asks for (First Principles note). Once merged, those blobs stay in history. — crew-pr-reviewer (r130) |
56961dd to
84880f0
Compare
…es render Carves the strip, its six i18n keys and the sendDelivered accessor off kirodotdev#6825 as an independent unit; the render sites follow.
84880f0 to
4abaedb
Compare
iamwhatever
left a comment
There was a problem hiding this comment.
APPROVE at 4abaedb2ce6890f13533149d160521776c599483.
The r130 hold was the merge conflict, and the branch is now rebased and mergeable. Since that review, dropUnconfirmedRow also clears the slot's cached list, and a new test checks that a row removed during a session switch stays gone (messages.ts#L223-L252). It still refuses a confirmed row. Remove re-checks each send at click (deliveryWarning.ts#L107-L129) and ends only the turn its own send started (useDeliveryWarningStrip.ts#L60-L68). All AI lanes pass, the Security Scope BLOCK comment belongs to an older head, and all 104 checks are green.
AI findings judged non-blocking
- UX Review: the 'arrived after all' notice could carry a Clear button. This is an enhancement; the instruction it gives is correct (useDeliveryWarningStrip.ts).
- UX Review: the strip wraps to three lines in a narrow pane. This is layout polish and hides nothing (DeliveryWarningStrip.tsx).
- Design Review: a page send that times out in split view shows only the short notice until the user leaves split view. The description documents this case, the pending row and notice stay, and the strip comes back (ChatPage.tsx#L968-L975).
- Design Review:
deliveryWarning.tsis a second store beside the transcript. The reviewer calls it acceptable, and records are pruned against the transcript and re-checked at click (deliveryWarning.ts#L55-L129).
— crew-pr-reviewer (r133)
Problem / Motivation
Goal: When a send's delivery is in doubt, the composer says so and offers one safe way out, instead of leaving the user to guess whether resending will duplicate a turn.
Split out of #6825, as its maintainer triage asked: this is the delivery-warning strip, one of the three units named there.
Today an unconfirmed send surfaces only as a notice row in the transcript, and that row tells the user to copy the message and send it again. Main deliberately does not put the text back in the composer on this path, so retyping it is the only way out, and a user who retypes while the first copy is still in flight sends it twice.
Why it matters
The cost of guessing wrong is asymmetric. Resending a send the server already accepted duplicates a turn. Losing one it never got costs the prompt. A user who cannot tell the two apart picks one at random.
Not a goal
response-latewith a minted bubble), and this PR keeps that.send_failed_connection. Main's receipt copy still calls it, so it is left in place.What changed (motivation → approach → change)
utils/deliveryWarning.tskeeps every doubtful send per slot, so a second one cannot overwrite the only copy of the first. The strip shows while any of them is still pending in the transcript (its optimistic row still on screen). A record whose row is confirmed, queued, cleared or refetched away is pruned: nothing is left for it to hand back.restoreSentTurn, hoisted unchanged out ofcomposerSend'srestoreComposerAfterFailedSend(which now calls it): typed text, paste blocks re-sequenced, session-reference chips, the quote,@relaliases, and parking in the slot's draft when it is off screen. It gains one optional input, the knowledge selection, merged under anything picked since through the merge main's create-failure path already uses (now one helper,mergeKnowledgeBack); the failure paths pass none, so their behaviour is unchanged. In a chat pane it is the pane draft'srestoreIntoComposer, with the paste blocks and files the send carried. The warning record holds only the payload that restore takes. Each send is re-checked at click: one that confirmed or was queued in between is left alone. When several sends are pending, their payloads are folded into ONE call to that restore (mergeSentTurns,mergePaneSends), oldest first, because the composer state a restore reads only advances at render, so a second call would overwrite the first. The stage holds one quote, so a second send's quote goes into its own text. Removing a send also removes its own in-doubt notice row and ends the local turn it started, unless a newer turn has started on the slot since: each warning records the slot's run epoch as it stood right after that send started its own turn (before the receipt is awaited, so a send made during the wait is not mistaken for it), and Remove settles the turn only while that epoch is unchanged.components/useDeliveryWarningStrip.ts.Main's existing notice row (
delivery_unconfirmed_pending) is cut to its fact, "Delivery not confirmed yet.", wherever the strip is raised, so the strip is the one place that gives advice and the action, and the two cannot disagree; it now carries its send id so Remove can take it away. Where no strip is raised (an app's chat launch, and a crewmate pane), the row keeps main's full guidance word for word under a new key,delivery_unconfirmed_resend_manually, copied from main's text in every catalog, so those users are not left with the bare fact and no recovery step. In the strip only the caption carries the warning colour; the note is muted. The two warn seams each gain one call to record the send, and the two receipt paths one call to the late-receipt notice.dropUnconfirmedRowis added tostore/chat/messages.ts; it refuses any row a confirmation has clearedoptimisticon, scans the whole transcript rather thanmarkSendUnconfirmed's reconcile window (Remove can be clicked after the row has scrolled past it, and a missed row would leave the bubble in place while its text came back), and drops that send's own notice row with it. When it removes rows from the open session while a session switch is still loading, it lowers the switch's live-row boundary (_switchLiveFrom) by one for each removed row before it, so a message sent after Remove is still recognised as newer than the loading history and kept when it lands. The exit is a small bordered secondary button. Fivedelivery_*keys are added to all 13 catalogs. The chat dashboard spec (docs/system-specs/modules/learn-cron-dashboard.md) now names the strip as where the advice and the exit live.Backwards compatibility
Compatible: every change is additive except the wording of
delivery_unconfirmed_pending, whose key and placement are unchanged; the two call sites that raise no strip now usedelivery_unconfirmed_resend_manually, which carries main's old text unchanged.Removes nothing: no record or capability is taken away;
dropUnconfirmedRowruns only from the user's own click on the strip, removes only that send's unconfirmed row and its own notice, and refuses a confirmed row.Tests
DeliveryWarningStrip.test.tsx:useDeliveryWarningStrip.test.tsx: the hook against the real store. The strip shows while the row is pending and its exit drops the row and calls the surface restore; it stays hidden on the surface that did not raise the warning; Remove ends the local turn; a removed send later accepted posts the notice exactly once; a click with no current slot does nothing; three pending sends with one confirmed in between are restored in ONE call, oldest first, and only the two still pending are dropped; a send whose late echo landed as a separate confirmed row is not handed back; removing an older warned send leaves a newer turn running (fails with the turn ended unconditionally); a disabled host shows nothing and removes nothing.chatSlice.dropUnconfirmedRow.test.ts: refuses a row confirmed without amid, removes an unconfirmed row that carries one, reaches a row left behind by a session switch, and reaches a row and its notice older than the reconcile window (fails against the windowed scan). Both guard cases fail against amid-keyed guard. It also takes its own notice row and no other, and keeps it when the row is refused.ChatPage.sendResponseLate.test.tsxandChatPane.draftRecovery.test.tsx: on each real surface, Remove takes the pending bubble away and puts the text back in that surface's composer through its own restore. A crewmate pane shows no Remove for an unconfirmed send (this test fails with the crewmate gate removed), nor for a pane warning raised on the same slot elsewhere, while an ordinary pane given the same warning does (fails with the crewmate host flag removed). On the chat page, two timed-out sends removed with one click both come back to the composer (fails against the per-record restore, which keeps only the second).deliveryWarningMerge.test.ts: both merges keep both texts, re-sequence a clashing paste block, and union session refs,@relaliases, knowledge and files; a second quote is folded into its text and a lone quote is carried as is.chatSlice.publicSurface.test.ts: the new action creator is registered on the slice's pinned export list.website/scripts/capture-delivery-warning-strip.mjswithwebsite/capture/delivery-warning-strip.tsx: renders the strip and fails unless its caption, exit and note each render once.website/scripts/capture-delivery-warning-live.mjs: the live run below, self-checking at every step.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*) passes: 6362 of 6362.tsc --noEmit,eslint --max-warnings 0on every changed source file, andjscpd(0 clones) are clean.Manual verification
Run on the real built app, in both the chat page and a split-view chat pane, dark and light, with
website/scripts/capture-delivery-warning-live.mjs. Every/apicall is answered from fixtures, and the harness holds the dashboard socket open so it can deliver a frame the way the gateway does.POST /api/chatis never answered, so the client's own 10s deadline fires and the send becomesresponse-late, which is the only path that raises the strip. The script asserts each state before it shoots, and exits non-zero on any mismatch:All four runs (2 surfaces × 2 themes) pass every check. Not covered by this run: a real gateway process, and the slot-refetch route back to a removed send (that route is covered by the hook's unit test through
selectSendAccepted).Screenshots / video
Live run, chat page (dark): in doubt, after Remove, delivered after all.
Live run, split-view chat pane (light):
Recordings of the same runs: chat page, dark · chat pane, light
The other theme on each surface
The strip on its own, from the real component against the real stylesheet (
website/scripts/capture-delivery-warning-strip.mjs, which exits non-zero unless the caption, exit and note each render once):Isolated strip, dark and light
Related Issues
Part of #6825.
Checklist