Repository navigation
fix: revert refused optimistic title on header rename failure (#10203) - #10237
Conversation
Design Review (Fable 5) — 🟡 CONCERNSDesign-level review of Design-Verdict: CONCERNS Sound fix to a real defect, but the recovery state machine lives inline in JSX, diverges from the sibling sidebar fix, and the description documents an abandoned shape. Watch
Suggestions
[DESIGN-REVIEWED] 2cff0ee |
UX Review (Fable 5) — ✅ PASSUX-level review of The evidence set is clear: no screenshots and no blind read, but the PR declares UX-Verdict: PASS Behavior-only fix that makes the UI stop contradicting its own error toast; no new or changed visual surface, so no screenshot is owed. [UX-REVIEWED] 2cff0ee |
First Principles Review (Fable 5) — 🟡 CONCERNSPremise-level review of All the facts I need are verified: First-Principles-Verdict: CONCERNS The diff does not ship what the description says: no Not justified as shipped
What this change shipsInventory (4 items) — 3 justifiedIntent: when the server refuses a header rename, stop showing the refused title as if it succeeded — a FIX (issue #10203, mutation-verified test).
Watch
Subtractions
[FIRST-PRINCIPLES-REVIEWED] 2cff0ee |
Opus 4.8 Review — ✅ no blocking findingsReviewed Review detailsOnly one candidate exists, and it self-rates "low" confidence, admitting it "could not construct a case where the two-attempt path produces a visibly wrong title." Tracing it independently: the identical-string collapse in (a) concrete input, (b) call path, and (c) observable wrong outcome only resolve under that contrived multi-failure interleaving; each comes out as "could/if," not something that occurs in practice at 80+. Nothing else in the diff (a self-contained header-rename recovery handler plus its regression tests) grounds a new finding to that bar. No findings. [OPUS-REVIEWED] 2cff0ee Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
GPT 5.6 Review — ✅ human override acceptedHuman judgment by @chenmingwei23 overrides the GPT 5.6 finding for This comment is updated in place on each push. The model was not re-run because an authorized human decision supersedes it. False positive or not applicable? A repository writer can comment: |
d7844f8 to
a7133ea
Compare
a7133ea to
61ef60e
Compare
GPT 5.6 Review —
|
61ef60e to
bf20719
Compare
The chat-header session-title rename dispatches the optimistic sseSlotTitle, then calls api.renameSlot. Its .catch only reported the failure through showActionError: the refused optimistic title was never reverted, so the header and sidebar kept showing a server-rejected title until an unrelated slot refetch or a reload. The .catch now re-reads the server truth (deduped through queryClient.fetchQuery) and applies ONLY this slot's title -- not the whole snapshot, whose late fulfillment could transiently clobber a newer concurrent write of another slot. A recovery may apply only while its own attempt is still the slot's latest generation AND the store still holds its refused value, so a delayed recovery can never overwrite a newer attempt's outcome -- including a newer confirmed rename to the identical string, which title equality alone cannot distinguish. When the re-read fails too (a transport or auth failure takes renameSlot and chatSlots down together), the catch falls back to a per-slot recovery baseline: the last CONFIRMED title, refreshed at commit time from any store title that is not one of this slot's own pending optimistic values. Extends the header-rename vitest with cases pinning the server-truth revert, the local-revert fallback when both calls fail, the guard against clobbering a newer concurrent write, the overlap baseline, the confirmed-external baseline refresh, the stale-generation guard (each verified to fail without its fix), and success keeping the title with no refetch. Closes #10203
bf20719 to
2cff0ee
Compare
|
/ai-review override gpt 2cff0ee: Verified: requires overlapping same-slot renames where B succeeds, C fails, AND an outage that also downs the recovery fetch; server keeps B, only the client header transiently shows A and self-heals on the reconnect fetchSlots (useWebSocket.ts:1023 -> applySlots). Display-only residual, no data loss; serializing per-slot renames is disproportionate for a four-way coincidence. Rounds 1-4 fixed the real defect classes in this span. |
Human judgment recorded@chenmingwei23 marked the gpt AI finding as false positive, not applicable, or explicitly accepted for
This decision applies only to this commit. A new push requires a new judgment. |
dwu96
left a comment
There was a problem hiding this comment.
Tier 1 auto-approve: fix (2 files). Criteria: no conflict, no requested changes, security path denylist clean, design-doc gate clean, SAST annotations clean, security checklist all-NO, AI reviewers green. Category: frontend-only fix reverting a refused optimistic session-title dispatch back to server truth, with a generation-guarded local-revert fallback; one source file plus its DOM-driven vitest cases, clear root cause (the .catch reported the failure without restoring the value).
iamwhatever
left a comment
There was a problem hiding this comment.
Tier 1 auto-approve: fix (2 files). Criteria: no conflict, no requested changes, security path denylist clean, design-doc gate clean, SAST annotations clean, security checklist all-NO, AI reviewers green. Category: a refused header rename left its optimistic title in the store; the catch now re-reads server truth and applies it keyed to the slot (so a newer concurrent write is not clobbered), falling back to the confirmed pre-rename baseline when the re-read also fails.
bolichen97
left a comment
There was a problem hiding this comment.
Maintainer review (agent-assisted, owner delegated), pinned to 2cff0ee. Approving: rename reconciliation uses per-slot generation guards and partial apply from a deduplicated chat-slots read; if that read also fails, guarded local revert restores the title without overwriting a newer authoritative write. This addresses the double-rejection contract missing in #10172/#10140; it does not use their whole-snapshot fetchSlots fallback. Body cleanup requested as nonblocking: describe this partial reconciliation and seven tests, rather than fetchSlots/three. Shared lifecycle work in #9485 must rebase over this. Dedicated-worktree source/test review; current-head readiness green; no local suite rerun this wave.
…tdev#10203) (kirodotdev#10237) The chat-header session-title rename dispatches the optimistic sseSlotTitle, then calls api.renameSlot. Its .catch only reported the failure through showActionError: the refused optimistic title was never reverted, so the header and sidebar kept showing a server-rejected title until an unrelated slot refetch or a reload. The .catch now re-reads the server truth (deduped through queryClient.fetchQuery) and applies ONLY this slot's title -- not the whole snapshot, whose late fulfillment could transiently clobber a newer concurrent write of another slot. A recovery may apply only while its own attempt is still the slot's latest generation AND the store still holds its refused value, so a delayed recovery can never overwrite a newer attempt's outcome -- including a newer confirmed rename to the identical string, which title equality alone cannot distinguish. When the re-read fails too (a transport or auth failure takes renameSlot and chatSlots down together), the catch falls back to a per-slot recovery baseline: the last CONFIRMED title, refreshed at commit time from any store title that is not one of this slot's own pending optimistic values. Extends the header-rename vitest with cases pinning the server-truth revert, the local-revert fallback when both calls fail, the guard against clobbering a newer concurrent write, the overlap baseline, the confirmed-external baseline refresh, the stale-generation guard (each verified to fail without its fix), and success keeping the title with no refetch. Closes kirodotdev#10203
Problem / Motivation
The chat-header session-title rename in
website/src/pages/ChatPage.tsxdispatches the optimisticsseSlotTitle, then callsapi.renameSlot. Its.catchonly reported the failure throughshowActionError: the refused optimistic title was never reverted, so the header and the sidebar kept showing a server-rejected title until an unrelated slot refetch or a reload. This is the header-side mirror of #10151, which covers the sidebar's inline rename;renameSlothas exactly two call sites and this was the remaining one.Why it matters
The user is told the rename failed while the UI keeps displaying the failed title as if it succeeded. The contradiction persists indefinitely on an idle dashboard, and the wrong title is what gets read, screenshotted, and searched for until something else happens to refetch slots.
What changed (motivation -> approach -> change)
Slot titles live in the Redux dashboard slice (written by
sseSlots/fetchSlots.fulfilled), so the recovery goes through Redux: the.catchnow also dispatchesfetchSlots(), whosefulfilledreconciler overwrites the stale optimistic title with the server truth. This is the recovery the delete-slot failure path already uses after its optimistic removal (chatSlicedeleteSlot), and the shape the pending sidebar-rename fix (#10151 / PR #10172) adopts for the same defect class.Because a transport or auth failure takes
renameSlotandchatSlotsdown together (andfetchSlots.rejectedrestores nothing), the catch falls back to a local revert to the pre-rename title when the refetch does not fulfil, guarded on the store still holding the refused value so a newer concurrent title write is never clobbered.Known residual (accepted, pre-existing shape):
fetchSlots.fulfilledapplies the whole snapshot, so a reply that predates a concurrent successful write inside one round-trip can briefly show the older title until the next slots frame. Same narrow window as the existing delete-slot recovery; a keyed partial apply would be a separate change.Tests
website/src/test/ChatPage.titleRenamePin.test.tsx, three new cases driving the real header rename UI (click title -> input -> blur commits):renameSlotrejects -> the store title snaps back to the server value delivered bychatSlots(mutation-verified: fails without the fix).renameSlotandchatSlotsboth reject -> the local-revert fallback restores the pre-rename title.npx tsc -bclean; scopednpx vitest run src/test/ChatPage.titleRenamePin.test.tsx9/9; scoped eslint clean on both touched files.Manual verification
Behavior-only revert of an optimistic value back to what the UI showed before the edit; no new visual surface. Covered by the DOM-driven vitest cases above.
Screenshots / video
Why no screenshot: behavior-only revert of an optimistic value back to the pre-edit state; no new or changed visual surface (the failure toast and the title rendering both pre-date this PR).
Related Issues
Closes #10203
Pattern harvest
Rule candidate: an optimistic Redux dispatch whose paired request has a
.catchthat only reports (toast/notice) and never restores the value is the defect class here -- recovery must re-assert server truth (authoritative refetch, plus a guarded local revert when the refetch can share the failure mode), andqueryClient.invalidateQueriesrecovers nothing that lives in Redux rather than under a registered query key.