Skip to content

feat(chat): one owner for the delivery-warning strip both chat surfaces render - #22478

Merged
iamwhatever merged 1 commit into
kirodotdev:mainfrom
rnoack1:split/delivery-warning-strip
Oct 28, 2026
Merged

iamwhatever merged 1 commit into
kirodotdev:mainfrom
rnoack1:split/delivery-warning-strip

Conversation

@rnoack1

@rnoack1 rnoack1 commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

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

  • Persisting the warning across a reload. That is the persisted recovery store, a separate unit of fix(chat): keep the optimistic user bubble across a slot refetch #6825.
  • Restoring the composer automatically after a late send. Main skips that restore on purpose (response-late with a minted bubble), and this PR keeps that.
  • Renaming send_failed_connection. Main's receipt copy still calls it, so it is left in place.

What changed (motivation → approach → change)

  • A warning that outlives the send path. utils/deliveryWarning.ts keeps 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.
  • One exit, through each surface's existing restore. "Remove message, keep the text" removes each pending row and hands back what its send consumed by calling the restore that surface's send path already uses for a failed send, rather than a restore of its own. On the chat page that is restoreSentTurn, hoisted unchanged out of composerSend's restoreComposerAfterFailedSend (which now calls it): typed text, paste blocks re-sequenced, session-reference chips, the quote, @rel aliases, 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's restoreIntoComposer, 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.
  • Only the surface that raised a warning offers its exit. The chat page stages session references and knowledge, which a pane cannot hold, so a page send that times out shows no strip in split view; its pending row and notice still do, and the strip returns when the user leaves split view. A pane send likewise only shows its strip in a pane. A crewmate pane raises no warning and shows no strip, including for a pane warning an ordinary split pane raised on the same session: its transcript draws messages only, so the notice that a removed send arrived after all could never reach the user there, and offering Remove would hand back a copy with no way to say it was delivered.
  • A late receipt after Remove is said out loud. A removed send is remembered for as long as this tab is open. If its receipt still lands (the two receipt paths) or it reappears confirmed or queued, the conversation gets a notice that it arrived, ending with what to do: "Clear the composer to avoid sending it twice." The strip's note promises only that: "this tab tells you".
  • One owner. Both surfaces take the strip's state and exit from 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. dropUnconfirmedRow is added to store/chat/messages.ts; it refuses any row a confirmation has cleared optimistic on, scans the whole transcript rather than markSendUnconfirmed'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. Five delivery_* 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 use delivery_unconfirmed_resend_manually, which carries main's old text unchanged.

Removes nothing: no record or capability is taken away; dropUnconfirmedRow runs 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:
    • The strip states its exit and consequence, and only the caption carries the warning colour.
    • A structural guard that both surfaces render the strip and take it from the shared hook.
    • The exit hands each send to the restore of the surface that raised it and removes its row; leaves a send that is no longer pending alone; never hands a send to the other surface, and keeps the other surface's record when one surface dismisses its own; keeps two doubtful sends in one slot and restores them in one call.
    • Lifecycle: a record whose row left the transcript is pruned; a removed send that turns out delivered gets the notice once; a delivered send never removed stays silent.
  • 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 a mid, 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 a mid-keyed guard. It also takes its own notice row and no other, and keeps it when the row is refused.
  • ChatPage.sendResponseLate.test.tsx and ChatPane.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, @rel aliases, 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.mjs with website/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/i18n with 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 0 on every changed source file, and jscpd (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 /api call 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/chat is never answered, so the client's own 10s deadline fires and the send becomes response-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:

  1. After the deadline: the strip sits above the real composer, the pending row and the "Delivery not confirmed yet." notice row are in the transcript, and the composer is empty.
  2. After "Remove message, keep the text": the row and its notice are gone, "Thinking…" is gone, the text is back in the composer, and the strip is gone.
  3. The socket then delivers the server's echo of the removed send, carrying its send id: the "delivered after all" notice, which says to clear the composer, appears exactly once.

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.

Chat page: strip above the composer while delivery is in doubt

Chat page: after Remove, the row is gone and the text is back in the composer

Chat page: the echo of the removed send lands and the delivered-after-all notice appears

Live run, split-view chat pane (light):

Chat pane: strip above the pane's composer while delivery is in doubt

Chat pane: after Remove

Chat pane: delivered-after-all notice

Recordings of the same runs: chat page, dark · chat pane, light

The other theme on each surface

Chat page light: in doubt
Chat page light: after Remove
Chat page light: delivered after all
Chat pane dark: in doubt
Chat pane dark: after Remove
Chat pane dark: delivered after all

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

Delivery-warning strip, dark theme

Delivery-warning strip, light theme

Related Issues

Part of #6825.

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

@github-actions github-actions Bot added fork Pull request from a fork (external contributor) readiness: checking Automated validation is still running labels Oct 20, 2026
@github-actions

github-actions Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5, fork) — ✅ PASS

UX-level review of 4abaedb2ce6890f13533149d160521776c599483 via the fork AI-review pipeline — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

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

  • delivery_removed_delivered tells the user "Clear the composer to avoid sending it twice." but offers no button for it. A "Clear composer" action on that notice row would turn the instruction into one click.
  • In split view, "Delivery unconfirmed — resending may send it twice." and the "Remove message, keep the text" button wrap onto two lines, and the note under them onto a third (attachment-10), so the strip stacks three lines above the pane's composer. A shorter note like "Text returns to the composer; you'll be told if it arrived." would give back a line in narrow panes.

[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 .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5, fork) — ✅ PASS

Design-level review of 4abaedb2ce6890f13533149d160521776c599483 via the fork AI-review pipeline — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

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

  • A page send that times out while the user is in split view now shows only the shortened notice "Delivery not confirmed yet.", with no strip and no resend guidance until they leave split view. Choosing between delivery_unconfirmed_pending and _resend_manually based on whether the strip can show, instead of on isolated alone, would close this gap.
  • deliveryWarning.ts adds a second store, at module level and outside Redux, that has to agree with the transcript. Keeping it consistent depends on prune effects that only run while a surface is mounted. That is acceptable for now, but if the persisted recovery store from fix(chat): keep the optimistic user bubble across a slot refetch #6825 lands, its records belong there.

[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 .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@rnoack1
rnoack1 force-pushed the split/delivery-warning-strip branch from 2a7e03b to 584496f Compare October 20, 2026 13:12
@github-actions

github-actions Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5, fork) — ✅ PASS

Premise-level review of 4abaedb2ce6890f13533149d160521776c599483 via the fork AI-review pipeline — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

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 ships

Inventory (9 items) — 9 justified

Intent: 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.

  1. A strip above the composer, on the chat page and in an ordinary split pane, with a "Remove message, keep the text" button while a timed-out send is still pending — justified
  2. The existing in-doubt notice row is shortened to "Delivery not confirmed yet." wherever the strip shows — justified
  3. An app chat launch and a crewmate pane keep the old full resend advice, under a new key — justified
  4. Remove deletes the pending bubble and its notice, and puts text, pastes, chips, quote and aliases back through the surface's existing failure restore — justified
  5. Remove also restores the knowledge selection on the chat page — justified
  6. Several pending sends come back together in one composer restore, oldest first — justified
  7. Remove ends the local turn the removed send started, unless a newer turn has begun — justified
  8. A notice, "A message you removed was delivered after all", if a removed send's receipt or echo arrives later — justified
  9. Capture scripts, an isolated capture entry and committed screenshots under temp-screenshots/ — justified

[FIRST-PRINCIPLES-REVIEWED] 4abaedb

Description read

[DESCRIPTION-READ] 07d911cce126318e58aba0a2e568394d31f8c57e52ad25e6f779e1198d187dcc

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@github-actions

Copy link
Copy Markdown
Contributor

Security Scope Review (fork) — 🔴 BLOCK (blocking)

Which legitimate operations does 2a7e03b618af379813f975dc21697c6ad41c71b4 newly refuse? Model proposes, scripts/deny_diff.py decides — updated in place on each push. A script-confirmed regression blocks PR readiness.

no leg reported, and this was not the nothing-to-adjudicate short circuit

No [SCOPE-REVIEWED] marker for this head was produced, so the model's text is withheld: it cannot be shown to describe this revision. See the job logs.

@github-actions

github-actions Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review (fork) — ✅ no blocking findings

Reviewed 4abaedb2ce6890f13533149d160521776c599483 via the fork AI-review pipeline; updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 4abaedb

@github-actions

github-actions Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review (fork) — ✅ no blocking findings

Reviewed 4abaedb2ce6890f13533149d160521776c599483 via the fork AI-review pipeline; updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 4abaedb

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Oct 20, 2026
@rnoack1
rnoack1 force-pushed the split/delivery-warning-strip branch from 584496f to e857b82 Compare October 20, 2026 15:27
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Oct 20, 2026
@rnoack1
rnoack1 force-pushed the split/delivery-warning-strip branch from e857b82 to 697c8ce Compare October 20, 2026 17:23
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Oct 20, 2026
@rnoack1
rnoack1 force-pushed the split/delivery-warning-strip branch from 697c8ce to 4af92c3 Compare October 21, 2026 00:51
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Oct 21, 2026
@rnoack1
rnoack1 force-pushed the split/delivery-warning-strip branch from 4af92c3 to 9542684 Compare October 21, 2026 05:47
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Oct 21, 2026
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention merge conflict Branch has merge conflicts with its base — author must resolve before merge and removed readiness: passed Eligible automated validation passed for the current revision readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention labels Oct 21, 2026
@rnoack1
rnoack1 force-pushed the split/delivery-warning-strip branch from ee87dae to 865dd5d Compare October 22, 2026 20:43
@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed merge conflict Branch has merge conflicts with its base — author must resolve before merge readiness: checking Automated validation is still running labels Oct 22, 2026
@rnoack1
rnoack1 force-pushed the split/delivery-warning-strip branch from 865dd5d to 56961dd Compare October 27, 2026 19:18
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: passed Eligible automated validation passed for the current revision merge conflict Branch has merge conflicts with its base — author must resolve before merge and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Oct 27, 2026
@iamwhatever

Copy link
Copy Markdown
Contributor

Hold at 56961dd: the branch conflicts with main.

GitHub reports the PR as CONFLICTING. A merge against current main conflicts in website/src/components/ChatPane.tsx and website/src/i18n/locales/fr.json. To clear it, rebase onto main, resolve both files, and let CI and the review lanes run on the new head. A rebased head needs a fresh review.

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). dropUnconfirmedRow refuses a confirmed row. Remove ends only the turn its own send started. All review lanes passed on this head. The Security Scope BLOCK comment belongs to an older head, and that check is green here.

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)

@rnoack1
rnoack1 force-pushed the split/delivery-warning-strip branch from 56961dd to 84880f0 Compare October 27, 2026 22:32
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed merge conflict Branch has merge conflicts with its base — author must resolve before merge readiness: passed Eligible automated validation passed for the current revision readiness: checking Automated validation is still running labels Oct 27, 2026
…es render

Carves the strip, its six i18n keys and the sendDelivered accessor off kirodotdev#6825 as
an independent unit; the render sites follow.
@rnoack1
rnoack1 force-pushed the split/delivery-warning-strip branch from 84880f0 to 4abaedb Compare October 28, 2026 06:31

@iamwhatever iamwhatever left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.ts is 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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fork Pull request from a fork (external contributor)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants