Skip to content

fix(chat): recall a prompt whose send never reached the transcript - #10786

Merged
bolichen97 merged 2 commits into
kirodotdev:mainfrom
rnoack1:fix/recall-history-on-send-attempt
Nov 4, 2026
Merged

bolichen97 merged 2 commits into
kirodotdev:mainfrom
rnoack1:fix/recall-history-on-send-attempt

Conversation

@rnoack1

@rnoack1 rnoack1 commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: A prompt whose pending bubble left the transcript can still be recalled with ↑.

The composer is cleared when a prompt is sent. If the send never reaches the server and its pending bubble later leaves the transcript, the prompt exists nowhere in the UI: not in the transcript and not in the composer. ↑ recall is built only from the transcript, so it cannot offer it either.

Reported symptom: a message "goes into a black hole, never changes to thinking, and even pressing the Up arrow doesn't work — the message is not in the history."

On current main this still happens. #14699 keeps a late send's bubble on screen as "Delivery pending…", but the next slot refresh (the real refreshSlot thunk, answered by a server that never got the POST) rebuilds the transcript without that row, and its notice with it. Separately, the grid pane's composer gets no ↑ list at all.

Why it matters

↑ is what a user reaches for first when a message disappears. Today it is empty in exactly that case, so a long prompt is simply gone and has to be retyped from memory.

Not a goal

What changed (motivation → approach → change)

A lost send cannot be detected when the composer is cleared, so recall cannot wait for a verdict. The prompt is recorded at the moment its bubble is drawn, and ↑ offers it only while no row in the transcript carries its send id.

  • The chat store keeps, per session, the prompts this tab sent: bubble text plus send id, the newest 50 (store/chat/state.ts, recordSendAttempt in store/chat/messages.ts, selectSendAttempts in store/chat/selectors.ts, exported from store/chatSlice.ts). A clear of the conversation drops them, and so does removal of the session (store/chat/slotResidue.ts).
  • Both send paths record at the point they draw the bubble: pages/chat/page/composerSend.ts and components/useChatPaneSend.ts.
  • ↑ lists the transcript's prompts first, then any recorded prompt whose send id is on no row (promptHistoryWithAttempts in components/composerPromptHistory.ts). So the first ↑ after a loss returns the lost prompt. Presence is checked by send id, never by text, because the server stores the prompt spelled differently (expanded files and pastes). Only records newer than the newest send still on a row count: once a later send lands, an older record is never put ahead of it, and a delivered prompt paged above the loaded window does not come back.
  • An edit-and-resend truncation (truncateAfterIndex) drops the records of the prompts it removed.
  • A send whose delivery is confirmed drops its record and every older one (pruneDeliveredAttempts in store/chat/sendAttempts.ts): its receipt (confirmOptimisticSend), a correlated echo (both echo paths in store/chatSlice.ts), or a history load carrying its id (refreshSlot in store/chat/slotRefresh.ts). A merged queued row counts for every send in its sendIds (utils/rowSendIds.ts). The recall-time cutoff alone is not enough: when another tab edits and resends the prompt via /rewind, the replacement row has no original send id, so the cutoff finds nothing and the delivered original came back on the first ↑ (GPT 6.1 review on 04630a4). A merged queued row named only its last send id, so an earlier merged send looked lost too (GPT 6.1 review on 117f756).
  • Both composers use one shared hook for the list (components/useSentPromptHistory.ts, called from pages/chat/page/activeSlotState.ts and components/ChatPane.tsx). The grid pane's composer now gets ↑ recall, on the same terms as the main chat.

This is a rebuild of the original change on current main. The old diff no longer applied: #14756 replaced index-based recall with a cursor, and ChatPage was split into modules. Dropping the attachment/paste restore removes the code three blocking review findings were about.

Backwards compatibility

Compatible: a new optional store field and a new action; every existing recall entry is unchanged.

Removes nothing: the inline recall memo in activeSlotState.ts moved into useSentPromptHistory with the same behaviour, and no field, key or export was removed.

Tests

  • ChatPage.sendResponseLate.test.tsx: a send past the deadline, then the real refreshSlot thunk drops its bubble; the first ↑ returns the lost prompt, the second the earlier one. While the bubble is still shown, ↑ offers it once. A busy-slot Queue send records nothing.
  • ChatPane.dirSend.test.tsx: the pane composer recalls a transcript prompt; a pane send is recorded and offered once.
  • composerPromptHistory.test.ts: lost prompts go last; a row with the send id hides it even when spelled differently; a queued row with the send id counts; duplicates collapse; a lost prompt followed by a landed send is not offered ahead of it; delivered prompts paged out of the window do not come back.
  • chatSlice.sendAttempts.test.ts: per-session order, cap of 50, empty / unsafe keys ignored, cleared with the conversation, with a background clear, when the session leaves the slot list, and for the prompts an edit-and-resend truncation removed.
    Delivery prunes: a receipt drops the record and older ones and keeps newer ones; a receipt for an unknown send changes nothing; a correlated echo drops it on the active and a background slot; a merged echo drops every send in sendIds; after another tab's rewind replaces the row, ↑ offers only the edited prompt; an unconfirmed lost send is still offered.
  • store/chatSlice.publicSurface.test.ts and store/chatSlice.ownership.test.ts list the new action and selector.

Fail-first, one mutation at a time, source restored after each: removing the ChatPage record, the pane record, the pane sentMessages wiring, the send-id check, the newest-landed cutoff, the truncation prune, the residue entry, or the cap each turns exactly its own tests red.

Determinism: the four changed test files ran 3 times with --sequence.shuffle and random seeds, 81/81 each time. tsc -p tsconfig.app.json and eslint --max-warnings 0 on changed files are clean. 203 related frontend test files (ChatPane*, ChatPage*, chatSlice*, store/chat, page modules) pass.

Manual verification

Real ChatPage in Chromium (Playwright), network stubbed with page.route: the send POST never answers, and slot detail returns the earlier transcript without the new prompt. The refresh is ChatPage's real refreshSlot, reached through its mc:redaction-hosts-changed event. Same script, same fixture, run on main's code (before) and this commit (after). Each step is asserted.

after refresh first ↑ second ↑
before (main) bubble gone earlier prompt earlier prompt (lost one unreachable)
after bubble gone lost prompt earlier prompt

The capture entry and script are not in this diff.

Screenshots / video

Pending bubble, then the refresh removes it:

Pending bubble before the refresh

Transcript after the refresh, bubble gone

Before (main) — first ↑ returns the earlier prompt:

Before: first Up-Arrow returns the earlier prompt

After — first ↑ returns the lost prompt:

After: first Up-Arrow returns the lost prompt

Recordings of both runs
before.webm
after.webm

Related Issues

Continues the original #10786 work on current main. Adjacent: #14699 (merged, keeps a late send pending), #6825 (open, keeps the optimistic bubble across a refetch).

Pattern harvest

Rule candidate: review-prompt
Pattern: a recovery affordance (history recall, undo, retry) built only from persisted state cannot recover the item whose persistence failed; ask whether its source is written before or after the step that can fail.

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

Composer re-render fix (after rebase)

Rebased on main, ↑ recall right after a send left the box empty, on plain main too. #23423 (dd2799c) made the voice clearVoiceError callback stable; that per-render change had been what re-rendered the composer after a draft-store write. useComposerDraftText (chat-core/composer/Composer.tsx) now re-renders itself when a store write differs from the text it shows. Voice code is untouched. New test ↑ right after a delivered send puts the prompt back in the box in ChatPage.sendResponseLate.test.tsx fails without the fix and passes with it.

  • Every loader that accepts server history now prunes delivered records, not only refreshSlot: switchSlot.fulfilled (store/chat/slotSwitch.ts), warmSlotCache.fulfilled (store/chat/slotRefresh.ts) and hydrateSlotMessages (store/chat/messages.ts). Before this, a send whose receipt and echo were both missed, then loaded by a slot switch, could come back on ↑ after another tab rewound its row (GPT 6.1 review on e769e5a). Tests in chatSlice.sendAttempts.test.ts, one per loader.
  • Commits: the composer re-render fix (perf(chat): stop three per-chunk composer and page re-renders while streaming #23423 / dd2799c) is its own commit, ahead of the feature commit.

@dwu96

dwu96 commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

👋 Hi! This PR is currently in draft status. Workflow runs won't be auto-approved until it's marked as ready for review.

When you're ready, click "Ready for review" and the workflows will be approved on the next cycle automatically.

@github-actions github-actions Bot added fork Pull request from a fork (external contributor) readiness: action required A blocking check or review needs attention labels Sep 14, 2026
@rnoack1
rnoack1 force-pushed the fix/recall-history-on-send-attempt branch from 032d832 to 9bb9f1b Compare September 14, 2026 14:58
@dwu96

dwu96 commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

👋 Hi! This PR is currently in draft status. Workflow runs won't be auto-approved until it's marked as ready for review.

When you're ready, click "Ready for review" and the workflows will be approved on the next cycle automatically.

@rnoack1
rnoack1 marked this pull request as ready for review September 14, 2026 15:41
@rnoack1
rnoack1 requested review from a team and dwu96 September 14, 2026 15:41
@github-actions

github-actions Bot commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5, fork) — ✅ PASS

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

UX-Verdict: PASS

No new visible controls or copy: the diff only changes what ↑ recalls in the existing composer, and attachments 03 and 04 show that before and after on the main chat. This lane has no blind read; a same-repo run would add one.

Notes

  • The grid pane composer gets ↑ recall for the first time (ChatPane.tsx, sentMessages={sentMessages}), but no screenshot shows it. A still of a pane composer with a recalled prompt would show that it works the same way as the main chat.

[UX-REVIEWED] 7474746

Description read

[DESCRIPTION-READ] 93eb424467c2a6b5d7bed729bf44a72fdeb2147eddf91d9ba5a4e6447ba76589

That sha256 names everything this verdict read: the PR description, plus the 7 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 Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5, fork) — ✅ PASS

Design-level review of 74747461332245261aea9bd2bdcc3e0ebb378334 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: sends are recorded in client memory and recall checks send ids, which fits the stated loss case without touching any persisted or server contract.

Notes

  • The description never mentions the Composer.tsx hunk. useComposerDraftText now re-renders when the draft store holds text the screen does not show yet ("missed the ↑ recall right after a send … until perf(chat): stop three per-chunk composer and page re-renders while streaming #23423"). That is a separate regression fix that affects every composer, not only the lost-send path. Name it under "What changed", or move it to its own PR.
  • pruneDeliveredAttempts is now called from six reducers: receipt, both echo paths, refresh, switch, warm and hydrate. Any new history loader that skips it will bring delivered prompts back on ↑. Consider pruning in one shared history-acceptance seam, so a future loader cannot skip it.

[DESIGN-REVIEWED] 7474746

Description read

[DESCRIPTION-READ] b759b98b88b0372b3938c3affa6e9ba356c979d881e8dc98a3f22baba6e03a0b

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.

@github-actions

github-actions Bot commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

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

Premise-level review of 74747461332245261aea9bd2bdcc3e0ebb378334 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

No blocking finding. Two items need a note: an undeclared composer re-render workaround, and a new helper that spells an existing row-identity rule a second time.

Notes

  • Item 6 — undeclared, symptom-level: the description never mentions Composer.tsx. The diff adds a second draft.subscribe that forces a re-render beside the useSyncExternalStore in useComposerDraft (chat-core/composer/draftStore.ts:44), "the subscription above alone missed the ↑ recall right after a send". The re-render was missed inside the draft store's get/subscribe contract, and this hunk patches it in one consumer. Subtraction: delete the useReducer/shownRef workaround and fix the snapshot inside draftStore, or name the cause in the description.
  • Item 7 — second spelling of isOwnUserRow (app-sdk/embedSendTails.ts:88): both encode "a row stands for meta.sendId plus every meta.sendIds entry". Grepping sendIds in non-test website/src finds 1 existing reader; rowSendIds makes it 2. Subtraction: rewrite isOwnUserRow as rowSendIds(m.meta).includes(sendId) so only one copy remains.

What this change ships

Inventory (7 items) — 5 justified

Intent: let a user press ↑ to get back a prompt whose send was lost and whose bubble left the transcript. FIX.

  1. First ↑ after a lost send returns that prompt — justified
  2. Grid-pane composer now has ↑/↓ prompt recall — justified
  3. Records dropped when a send is confirmed (receipt, echo, history load, slot switch, hydrate) — justified
  4. Records dropped by edit-and-resend truncation, clear, and slot removal — justified
  5. At most 50 records kept per session, in memory only — justified
  6. Composer re-renders on a draft write the screen does not show yet — undeclared, symptom-level
  7. New rowSendIds helper for merged queued rows — duplicate of app-sdk/embedSendTails.ts isOwnUserRow

[FIRST-PRINCIPLES-REVIEWED] 7474746

Description read

[DESCRIPTION-READ] cf6ba21e6377dfbc6f74835139db4abeca4979aa3323d78dbf5274726d0218b0

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

github-actions Bot commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review (fork) — ✅ no blocking findings

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

Review details

No findings.
[GPT-REVIEWED] 7474746

@github-actions

github-actions Bot commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review (fork) — ✅ no blocking findings

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

Review details

No findings.

[OPUS-REVIEWED] 7474746

@github-actions github-actions Bot added the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Sep 15, 2026
@rnoack1
rnoack1 force-pushed the fix/recall-history-on-send-attempt branch from 9bb9f1b to aa94e78 Compare September 15, 2026 23:49
@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: action required A blocking check or review needs attention readiness: checking Automated validation is still running merge conflict Branch has merge conflicts with its base — author must resolve before merge labels Sep 15, 2026
@rnoack1
rnoack1 force-pushed the fix/recall-history-on-send-attempt branch from aa94e78 to b4bb8e9 Compare September 16, 2026 05:44
@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 merge conflict Branch has merge conflicts with its base — author must resolve before merge labels Sep 16, 2026
@rnoack1
rnoack1 force-pushed the fix/recall-history-on-send-attempt branch from b4bb8e9 to f0c88cb Compare September 16, 2026 06:54
@github-actions github-actions Bot removed the readiness: action required A blocking check or review needs attention label Sep 16, 2026
@rnoack1
rnoack1 force-pushed the fix/recall-history-on-send-attempt branch from d5dd316 to 2feabfa Compare September 16, 2026 15:07
@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: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Sep 16, 2026
@rnoack1
rnoack1 force-pushed the fix/recall-history-on-send-attempt branch from 2feabfa to 2dedd55 Compare September 19, 2026 19:21
@github-actions github-actions Bot removed the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Sep 19, 2026
@rnoack1
rnoack1 force-pushed the fix/recall-history-on-send-attempt branch from 2dedd55 to dc95171 Compare September 19, 2026 20:20
@github-actions github-actions Bot added the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Sep 21, 2026
@rnoack1
rnoack1 force-pushed the fix/recall-history-on-send-attempt branch from dc95171 to 1f3c46e Compare September 22, 2026 02:14
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed merge conflict Branch has merge conflicts with its base — author must resolve before merge readiness: action required A blocking check or review needs attention labels Sep 22, 2026
@chenmingwei23

Copy link
Copy Markdown
Contributor

Kiro Crew [operator: chenmingwei23#de330d0c]: This PR has been inactive for 7+ days with failing CI. I've assessed the blockers and they appear resolvable - I'll push fixes directly to this branch as a co-author.

Assessment: Merge conflict with main (rebase). GPT and Opus blocking findings each name a concrete fix: (1) recalling a prompt with no sidecars must clear the draft's files/pastes instead of keeping them (ChatPage.tsx:2136, mirror in ChatPane); (2) queued sends must keep their sendId so recall does not re-offer them (recallHistory.ts:66); (3) the slot-switch exit report must not overwrite the outgoing slot's parked sidecars (ChatPage.tsx:2125, guard on slot === prevSlot.current). PR Hygiene: rebuild the description from the template (missing ## Not a goal and **Goal:**), and re-attach the before/after recordings so the UX lane can see them. Windows lane: test_pid_reader_ratchet reports an added pid read site; re-check after rebase and route it through the lease handle if it is the PR's own. No design change.

If you'd prefer I don't touch this PR, add the pr-no-autofix label.

Copy link
Copy Markdown
Contributor

PR triage (automated, diff-based) — needs a rebuild on current main, plus a merge discussion with two related PRs

Verdict: OVERLAPPING (no other PR is doing the same thing, but other PRs touch the same code). Keep it open and rebase it. I found no breaking change and no new P0 bug that hasn't already been reported.

Not covered by main. I checked origin/main @ 6a31a63e5b. Main has no attemptedSends / recordSendAttempt / buildRecallHistory. ChatPane still mounts <ChatInput> without sentMessages, so the grid-pane ↑ gap is still there too. Main's recall list is still built only from the transcript (promptHistoryFromMessages(messages) in ChatPage.tsx). So the problem this PR describes is still present on main.

Why it must be rebuilt, not just replayed:

  • The branch is 1035 commits behind. git merge-tree reports conflicts in ChatInput.tsx, ChatPage.tsx, store/chatSlice.ts and test/ChatPane.dirSend.test.tsx.
  • fix(composer): keep prompt-history recall on its entry when the list changes #14756 (merged, PR) changed how ↑/↓ recall works:
    • Recall now goes through components/composerPromptHistory.ts and the usePromptHistory() hook.
    • It tracks position with a PromptHistoryCursor that remembers its entry by id or text. It no longer uses historyIdxRef.
    • sentMessages is now PromptHistoryItem[] ({ text; id? }), not string[].
    • The Lexical composer browses recall the same way as the textarea.
  • ChatInput.tsx itself shrank from 5364 to 1355 lines when it was split into hooks.
  • What this means for the rebuild:
    • This PR's onRecall(index), exitHistory() and the index-based handler hunks no longer have code to attach to.
    • onRecall needs to report the cursor's entry, not an array index.
    • Recorded attempts can enter the list as PromptHistoryItems keyed by sendId. That reuses fix(composer): keep prompt-history recall on its entry when the list changes #14756's identity matching instead of adding a second one.
    • The new path must also work in the Lexical composer, which this diff does not touch.

Merge discussion:

Blockers already raised, still open at head 6ced195 (I'm not repeating them as a new review):

  1. Recalling a prompt that has no attachments or pastes leaves the draft's own files staged. Pressing Enter then sends the wrong attachment (ChatPage.tsx:2136, same issue in ChatPane).
  2. Queued sends can be recalled and executed a second time (recallHistory.ts:66).
  3. Switching slots overwrites the outgoing slot's parked attachments and pastes (ChatPage.tsx:2125).
  4. Design and First Principles reviews: the recall park/restore logic is duplicated in ChatPage and ChatPane.
  5. UX review BLOCK: the recordings are hosted on a fork commit, so the UX review could not see them.
  6. PR Hygiene: the description is missing **Goal:** and ## Not a goal.

Recommendation: REBASE / CONTINUE-DEVELOPMENT. Rebuild on top of #14756's cursor model, fix findings 1–3, and coordinate with #6825.

@iamwhatever

Copy link
Copy Markdown
Contributor

Rebuilt on current main as dba1725 (one commit, author kept). The old diff no longer applied: #14756 moved ↑ recall to a cursor model and ChatPage was split into modules. #14699 (merged) does not cover this: the real refreshSlot still drops the pending bubble, and the grid pane still had no recall list. The new ChatPage test and the before/after capture show both.

Dispositions for the findings on 6ced195:

fixed (dba1725): GPT F1 / Opus F1, recalled prompt keeps or overwrites draft attachments. Recall now restores text only, same as recall of a landed prompt; the sidecar restore and its slot-switch park code are gone, so neither path exists.
fixed (dba1725): GPT F2, queued send re-offered. Presence is checked by sendId on any row, including role queued (main now keeps sendId on queued rows); only bubble-drawing sends are recorded. Test: counts a queued row carrying the sendId as present.
fixed (dba1725): Design / First Principles, duplicated recall park logic. Both composers now call one hook, useSentPromptHistory; no per-composer copy remains.
fixed (dba1725): Design suggestion, 50-entry cap bounds count not bytes. Entries hold bubble text and sendId only; no paste bodies are stored.
rebutted: Design / UX watch, persist across reload. Out of goal; listed under Not a goal. The record is in-memory like the transcript state it backs.
fixed: UX BLOCK, evidence hosted outside the PR. Stills and recordings are now GitHub attachments in the description.
fixed: PR Hygiene, missing Goal / Not a goal. Description rebuilt from the template.

@iamwhatever

Copy link
Copy Markdown
Contributor

Dispositions for the findings on dba1725, fixed in d24419d:

fixed (d24419d): Opus F1 / UX watch 1 / Design watch, a stale record sits at the newest end of ↑. promptHistoryWithAttempts now offers only records newer than the newest send still on a row. Once a later send lands (including a recalled-and-resent prompt), older records are not offered, and delivered prompts paged above the loaded window do not come back. Tests: 'drops a lost prompt once a later send is on a row', 'does not bring back a delivered prompt whose row is above the loaded window'.
fixed (d24419d): Opus F2, edit-and-resend leaves discarded prompts recallable. truncateAfterIndex drops the records whose sendId was on a removed row. Test: 'an edit-and-resend truncation forgets the prompts it removed'.
rebutted: Design suggestion, drop a record on confirm instead. The cutoff gives the same list without delete-on-confirm, which the earlier rounds removed because two refreshes can land out of order and delete a record before an older page drops its row.
rebutted: UX watch 2, no pane still. Same ChatInput and same list builder as the main chat; the pane wiring is pinned by ChatPane.dirSend.test.tsx ('recalls a prompt from the pane transcript').
rebutted: First Principles item 4, pane recall rides along. Declared in the description; the goal needs it so a pane send is recallable.

@iamwhatever

iamwhatever commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

span=item-3-pane-recall
disposition: rebutted

The pane wiring is part of this PR's original declared scope (the first description, 2026-09-14, named the grid pane having no recall list), not a later add-on.
A pane send loses its prompt the same way: the composer empties at submit, so without the record and the list a lost pane prompt has no copy anywhere.
Cost is three lines in ChatPane.tsx and one dispatch in useChatPaneSend.ts, both pinned by ChatPane.dirSend.test.tsx.
Left for the maintainer to drop at merge review if they want the pane out of scope.

@iamwhatever

Copy link
Copy Markdown
Contributor

HOLD at d24419dfa7b2b52ca8b0a02a638f748d58a9f43e.

The fix reads sound. A prompt is recorded when its bubble is drawn, and the up-arrow list offers it only while no row carries its sendId and nothing newer has landed. A cleared conversation, a removed session and an edit-and-resend all drop the record. The First Principles pane-recall item has a reasonable rebuttal.

One review check on this head has no reply. Design asks whether every server path that writes a delivered plain send's row stamps meta.sendId, because a path that doesn't would bring the delivered prompt back as the newest entry. I found the stamp in chat_delivery.py (L881), the chat_send.py hold row, queue_drain.py and steer_queue.py. A design disposition that confirms this, or names any path that does not stamp it, would clear the hold.

— crew-pr-reviewer (r115)

@iamwhatever

Copy link
Copy Markdown
Contributor

Rebased on current main (a61c011, conflicts were only export lists in chatSlice.ts and its public-surface test). Disposition for the Opus 5.5 finding on a61c011:

fixed (5d39102): website/src/store/chat/messages.ts truncateAfterIndex — a truncation now cuts the record up to the newest removed attempt, so an older lost record L no longer comes ahead of the edited prompt, and a failed rewind's replaceMessages rollback cannot bring it back. Tests in website/src/test/chatSlice.sendAttempts.test.ts: edit-and-resend drops removed and older records (also after rollback), a record newer than every removed prompt is kept, a truncation that removes no recorded prompt keeps the record.

@iamwhatever

Copy link
Copy Markdown
Contributor

HOLD at cd3a78d77cd83afcc552c5d808fa5e1dfbda8a12.

The recall fix reads sound: a prompt is recorded when its bubble is drawn, ↑ offers it only while no row carries its sendId and nothing newer has landed, and receipts, correlated echoes and every history loader prune delivered records. CI and all five AI lanes are green on this head.

One item has no reply. The Design and First Principles lanes both flag the new second subscription in useComposerDraftText. createComposerDraftStore.set notifies every subscriber and useComposerDraft is a plain useSyncExternalStore, so if that subscription really misses the ↑ write, other readers of the hook may miss it too. The description says what used to hide the gap (#23423's voice callback) but not why the subscription missed. Either name the cause in a Design disposition for this head and explain why the fix belongs here, or move the fix into useComposerDraft. A short reply to First Principles item 9 (rowSendIds vs isOwnUserRow) would also close that note.

— crew-pr-reviewer (r126)

EC2 Default User and others added 2 commits November 3, 2026 19:59
After a send, ↑ wrote the recalled prompt into the draft store but the
composer kept showing the cleared box. It had been re-rendered by a voice
callback that changed on every render; kirodotdev#23423 (dd2799c) made that callback
stable, which exposed the gap. The composer now re-renders itself when a
store write differs from the text it shows. Voice behavior is unchanged.
The chat store keeps, per session, the prompts this tab sent (text and send
id). ↑ offers a recorded prompt while no transcript row carries its send id.
A truncation, a receipt, a correlated echo, or any history load that
carries the send id (refresh, slot switch, background warm, hydrate) drops
the record. The grid pane's composer gets ↑ recall too.
@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

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

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

the review scope was never resolved: the generate job did not finish (it timed out, failed or was cancelled), so no leg ran; its log names the step that stopped

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.

@iamwhatever

Copy link
Copy Markdown
Contributor

HOLD at 74747461332245261aea9bd2bdcc3e0ebb378334: the code is ready, but this account cannot be the approver.

On the merits I found no defect. A prompt is recorded when its bubble is drawn. ↑ offers it only while no row carries its sendId and nothing newer has landed (composerPromptHistory.ts#L229-L252). Receipts, echoes and every history loader prune delivered records (sendAttempts.ts#L15-L29). Since our r126 review (cd3a78d) the only change is a rebase. CI and all five AI lanes are green.

What would clear this hold:

  1. An approval from someone other than the account that pushed this head. Every push since 2026-10-25, including 74747461, came from the reviewer account, and the main ruleset requires approval of the last push by someone else, plus code-owner review.

AI findings judged non-blocking:

  • Design / First Principles item 6: the useComposerDraftText re-render patches a symptom. It is the only reader of the draft-store hook, so no other reader is left exposed. It re-renders only when the store differs from what is shown, and it has a fail-first test.
  • First Principles item 7: rowSendIds repeats the rule in isOwnUserRow. This is duplication with no behaviour difference.
  • Design: six reducers call pruneDeliveredAttempts. Every current loader does, and each one has a test.
  • UX: there is no grid-pane screenshot. ChatPane.dirSend.test.tsx covers the pane.

— crew-pr-reviewer (r145)

@bolichen97 bolichen97 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.

Approving at 7474746. All 92 checks on this head have passed. I read every non-test hunk across the 22 files.

What I checked:

  • recordSendAttempt stores a sent prompt's text and sendId per slot, capped at 50. It is client-only state, and slotResidue clears it with the slot's other maps.
  • promptHistoryWithAttempts decides whether a prompt is still on the transcript by sendId alone, including every id a merged queued row carries (rowSendIds). Text is not used. It offers only sends newer than the newest one still on a row, so a stale prompt is never put ahead of the user's last one.
  • Delivery proof prunes the records up to that send: the receipt, a correlated echo, and every history load or slot switch that carries persisted send ids. Edit-and-resend and regenerate (truncateAfterIndex) drop the removed prompts and older ones, and clearing a conversation drops all of its records.
  • The composer re-render fix subscribes to the draft store and re-renders only when the stored text differs from the text on screen.
  • ChatPane now shares the same history hook as the chat page, so the two composers recall the same way.
  • No regex or pattern matching is added.

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.

7 participants