Skip to content

fix(chat): Preserve confirmed sends on refresh - #15843

Closed
junjiequ wants to merge 1 commit into
kirodotdev:mainfrom
junjiequ:fix/dashboard-message-loss
Closed

junjiequ wants to merge 1 commit into
kirodotdev:mainfrom
junjiequ:fix/dashboard-message-loss

Conversation

@junjiequ

@junjiequ junjiequ commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: Keep a sent message visible while an active chat refresh catches up with transcript persistence.

A server-confirmed user message can disappear from the dashboard during a running turn even though the agent received and processed it.

Why it matters

A disappearing message makes a successful send look lost. The user may send the instruction again and trigger duplicate work.

Not a goal

  • Diagnose or change browser input that never reached the gateway.
  • Change the backend stale-writer guard or queued-message semantics.
  • Change transcript layout or user-facing copy.

What changed (motivation → approach → change)

Messages you send and replies already shown stay visible while transcript persistence catches up. The gateway can confirm a send or stream a reply before its disk snapshot includes that row. Replacing the live transcript with that older page made confirmed work disappear and invited duplicate instructions.

The slot-detail reader already merges its captured in-memory unflushed tail, but it cannot order independent responses when a read snapshots first, a send confirms second, and the read response arrives last. Neither response carries one shared server revision, so the browser must reconcile that inversion.

Situation Reconciliation rule
Running refresh Retain only safely ordered, confirmed user rows. Private in-memory proof cannot arrive from server JSON and clears when the canonical row appears.
Switch-back Match reply segments by exact row identity or by the nearest shared durable turn opener whose role and timestamp agree; a receipt-confirmed opener may instead prove the same unique sendId and server mid. Sequence and generation evidence orders open and finalized copies.
Remote rewind Capture the comparable server row count when each switch or refresh starts. A lower count makes the rewritten page authoritative over confirmed-send rescue and cached candidates. An equal count drops only an unclaimed identified reply positively replaced at the same segment position; ambiguous and claimed rows remain conservative.
Raced refresh Retry up to three bounded attempts after a live frame or HTTP receipt changes the active transcript. Apply only when unique row identity, exact segment position, or compatible stream sequence proves the current view is covered; otherwise preserve local state.

Empty running pages keep only the confirmed user suffix. Bounded reads walk back to an exact shared anchor instead of guessing from text or timestamps. Dispatched cron, app, recovery, replay, and synthesis rows use one shared turn-opener contract; passive notes never anchor a segment. Multi-segment replies use ordinals, so one prompt's second or third segment cannot be confused with its first.

A request-scoped claim records the exact local accumulators and finalizers changed while a switch fetch is in flight. Fulfillments apply only while their pending issue or claim still owns the same slot; eviction makes late responses no-ops. An ordered rowless boundary finalizes the fetched segment before later local segments are inserted, while unknown anchors never collapse two open segments. Canonical rows deduplicate by mid or sendId; stale open rows converge to one completed segment only with compatible proof. Assistant-role compaction, stuck-turn, and session-reload notices remain visible but never identify or count as reply segments. A raced active refresh re-snapshots the current view for at most three bounded attempts, with a 30-request ceiling including capped window walks. Per-slot issue tokens order overlapping refreshes and switches, so an older-issued read cannot win merely by settling later. A newer refresh that out-ranks an in-flight switch owns the bounded paging cursor too; whether the older switch fulfills or rejects, it settles without transcript or cursor mutation, and rejection emits no stale failure notice or sidebar eviction. Equal or older refreshes remain blocked. Each refresh also compares count changes with its dispatch-time baseline rather than a global count another response moved. Coverage remains bounded, retained steers keep finalize-before-insert ordering, ordinary sends keep their existing order, and idle refresh pages remain authoritative.

website/src/store/chat owns the reconciliation, request claims, paging rules, and turn-opener contract. Tests under website/src/test and website/src/store cover empty and stale pages, forged metadata, request isolation, open/finalized ordering, multi-segment turns, cron and passive-note boundaries, remote rewinds, live-tail rescue, exact and ambiguous identities, payload immutability, and opposite authority cases. docs/system-specs/modules/learn-cron-dashboard.md records the behavior.

Backwards compatibility

Compatible: the change adds client-side reconciliation evidence and does not reject, rename, or remove any existing input or output.

Removes nothing: no API, accepted field, transcript role, or user-visible capability is removed.

Tests

  • Current-base related frontend selector: 11,413 tests passed across 368 files.
  • Direct backend name/reference overlaps: 1,359 tests passed across 11 files.
  • Focused out-ranked rejection and cursor-ordering set: 157 tests passed across three files.
  • Regressions prove confirmed-send retention, receipt-only refresh races, dual send/row identity, segment identity and ordering, stale-open convergence, remote-rewind deletion, same-count rewrite replacement, same-count live-tail rescue, request-scoped count baselines, request isolation, bounded reconnect retries, ambiguous-identity refusal, system-notice preservation, and stale-rejection notice/eviction suppression in both directions.
  • npm --prefix website run build.
  • TypeScript and ESLint on every changed TypeScript file.
  • ./scripts/docs-lint.sh, git diff --check, and the single-commit base guard.

Manual verification

N/A — reducer tests reproduce the timing races and verify both stale-page and authoritative-page outcomes without a visual-only assertion.

Screenshots / video

Why no screenshot: This changes transcript reconciliation only; rendered messages look the same except that confirmed content no longer disappears.

Related Issues

no linked issue: the incident was reported directly from an affected dashboard session.

Pattern harvest

Rule candidate: review-prompt
Pattern: Reconcile stale server pages only with exact row or turn identity and request-scoped ordering; use retained server counts to distinguish stale tails from remote rewinds.

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)
  • 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

@junjiequ
junjiequ requested a review from a team October 1, 2026 12:18
@junjiequ
junjiequ requested a review from a team as a code owner October 1, 2026 12:18
@junjiequ
junjiequ requested a review from cruisercohen October 1, 2026 12:18
@github-actions github-actions Bot added fork Pull request from a fork (external contributor) readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Oct 1, 2026
@github-actions

github-actions Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Fable 5, fork) — ✅ PASS

UX-level review of c6449cd8277f587e2cac3d9b5bf4942005992e36 via the fork AI-review pipeline — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

UX-Verdict: PASS

Verify a user-clicked slot open that 404s stays announced when no newer refresh of that slot has applied — suppression must cover only superseded races.

[UX-REVIEWED] c6449cd

Description read

[DESCRIPTION-READ] c37b14fa683ac61fc81af5e51ae9bee52158f0875218b9e54feca6482e2aeb04

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

Copy link
Copy Markdown
Contributor

Design Review (Fable 5, fork) — 🟡 CONCERNS

Design-level review of c6449cd8277f587e2cac3d9b5bf4942005992e36 via the fork AI-review pipeline — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

Design-Verdict: CONCERNS

Browser heuristics reconstruct response ordering the wire could state in one field; each new race variant will demand another interlocking rule.

Watch

The spec added here admits the root cause — "Neither response carries one shared monotonic server revision that proves their order" — then compensates in the client: a segment comparer keyed on anchor+ordinal, symbol-based persistence proofs, request-scoped claims, per-slot issue tokens, count baselines, and a 3×10-request retry budget spread across seven store/chat modules and ~240 lines of spec prose. Because ordering is inferred rather than carried, every settlement path (refresh, switch, cursor, rejection notices, rewinds) had to be touched in lockstep, and the next independent-response race will need yet another heuristic; a slot revision stamped on the send ack and the slot-detail response would let the client order responses directly and retire most of this machinery.
Clears when: a maintainer either records client reconciliation as the chosen paradigm (declining the backend stamp) or files the follow-up adding a shared per-slot revision to send acknowledgements and slot-detail responses.

Suggestions

  • Pursue the per-slot monotonic revision on the wire as a follow-up; this PR's conservative rules then become a compatibility path for old gateways rather than the permanent ordering mechanism.

[DESIGN-REVIEWED] c6449cd

Description read

[DESCRIPTION-READ] d01b3a4b36b787b3c073a5df2536876cf5b1ded36de195a3027e1b3afcd39b10

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 Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

GPT 5.6 Review (fork) — 🔴 changes requested (blocking)

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

1 of 1 blocking finding(s) are security-class and were withheld from adjudication, so the blocking verdict stands.

BLOCKING -- website/src/store/chat/slotRefresh.ts:457 -- Older refresh can overwrite a newer switch

if ((applied[safeKey(key)] ?? 0) > refreshSeq) return
Delayed refresh → newer switch settles → refresh passes this refresh-only guard and replaces the newer transcript.
Anchor: residual/crash-data-loss-corruption
Fix: Reject a refresh when a later same-slot switch has settled.
[BLOCK-MERGE] c6449cd
[GPT-REVIEWED] c6449cd

Adjudication (Opus 5) — is blocking on each finding proportionate?

F1 — harm UNBOUNDED-class as fenced (transcript rows silently dropped from the active view). Conditions confirmed: refreshSlot.fulfilled orders only against refreshAppliedSeq (website/src/store/chat/slotRefresh.ts:457) and consults no switch claim, while the switch half of the same ordering was added in this PR (slotSwitch.ts fulfilled compares state.refreshAppliedSeq[...] > claim.refreshIssuedSeq), so a refresh issued before a same-slot switch applies its older page after the switch's reconciliation; switchSlot is explicitly safe to re-dispatch on an unchanged key, and liveFrameSeq is not advanced by a switch, so the raced-frame retry does not catch it.

Recovery exists (a later refresh carries a higher issueSeq and re-applies at slotRefresh.ts:457), but the rarity argument FLAG requires cannot be made: two HTTP responses reordering across a sidebar click is the ordinary race this PR's own refreshIssuedSeq claim was built to order in the mirror direction, not an extreme or self-contradicting condition combination.

[ADJUDICATION] c6449cd total=0 uphold=0 downgrade=0
[GPT-ADJUDICATED] c6449cd
[ADJUDICATION-FENCED] c6449cd fenced=1 flagged=0
UPHOLD-FENCED F1 website/src/store/chat/slotRefresh.ts:457 -- The refresh reducer orders only against other refreshes while this PR added the symmetric switch-side guard, so an ordinary out-of-order response after a same-slot switch is a plausible, non-extreme path to silently replacing the newer reconciled transcript.
[GPT-ADJUDICATED-FENCED] c6449cd

@github-actions

github-actions Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Fable 5, fork) — 🟡 CONCERNS

Premise-level review of c6449cd8277f587e2cac3d9b5bf4942005992e36 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/CONCERNS are advisory.

First-Principles-Verdict: CONCERNS

A ~1,900-line assistant-reply reconciliation engine ships inside a fix whose frozen goal is keeping one confirmed user message visible.

Not justified as shipped

  • Item 4 — oversized: the Goal and Problem name only "a server-confirmed user message can disappear", yet the diff replaces the base serverHasLastLocal last-reply re-attach with a segment-identity/claim engine (createSegmentComparer, slotSwitchChunkClaim, finalizers, rowless finalizers, same-count rewrite, generation ordering) for assistant replies.
    Subtraction: defer slotSwitchChunkClaim and the createSegmentComparer/finalizer machinery; keep the base re-attach and ship only mergeConfirmedUserTailAfterPage plus the receipt race token.
    Clears when: the mechanism is removed, or a human amends the Goal.
  • Item 3 — symptom-level: the description's own cause — "Neither response carries one shared monotonic server revision that proves their order" — is fixable with one server-stamped revision on slot-detail pages and send receipts; the bounded retry-plus-coverage inference patches around its absence.
    Clears when: the cause-level server revision is recorded as deferred follow-up work (a linked issue), or the retry/coverage inference shrinks to the base single-decline behavior.

What this change ships

Inventory (10 items) — 7 justified

Intent: FIX — a server-confirmed sent message disappears from the dashboard during a running turn; keep it visible until persistence catches up.

  1. A confirmed sent message stays visible through a running refresh — justified
  2. The same retention when switching back to a slot mid-turn — justified
  3. A raced refresh now silently retries up to 3 times (≤30 requests) instead of declining once — symptom-level: client infers an ordering one shared server revision would state
  4. Switch-back reconciles every assistant reply segment through a new identity/claim engine, replacing the old last-reply re-attach — oversized: Goal names only user sends
  5. A confirmed remote deletion (lower server count) now wins over locally cached rows — justified
  6. A newer refresh out-ranks an in-flight switch (transcript, paging cursor, suppressed stale 404 notice/eviction); the reversed cursor pin's own hazard is removed by the ordering — justified
  7. HTTP send receipts now count as live frames for refresh race detection — justified
  8. Compaction/stuck-turn/reload notices no longer count or identify as reply segments — rides along: support for item 4's ordinals
  9. The turn-opener inject contract moved into a shared turnInject.ts module — justified
  10. Spec section added to learn-cron-dashboard.md in the same commit — justified

[FIRST-PRINCIPLES-REVIEWED] c6449cd

Description read

[DESCRIPTION-READ] e0e3a86e69015d20f5a9deb40e795021e809c9b483b63f2c669d68d38030fd32

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 Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5 Review (fork) — 🔴 changes requested (blocking)

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

The switch-back replay floor is now read off the post-merge array, so a retained steer silently disables it and already-shown text is appended twice.

BLOCKING — website/src/store/chat/slotSwitch.ts:580

      const pageSegment = readPageSegment(preserved)
      const snapGen = pageSegment.status === 'open' ? pageSegment.gen : undefined
      const snapSeq = pageSegment.status === 'open' ? pageSegment.seq : undefined

A receipt-confirmed steer (meta: { steer: true, sendId, mid }, optimistic deleted by confirmOptimisticSend) retained by mergeConfirmedUserTailAfterPage runs finalizeTrailingStreaming(merged), which rewrites the fetched page's trailing streaming row to assistant (or splices a placeholder) → readPageSegment(preserved) is finalized, so snapGen/snapSeq are undefined → line 935 raiseChunkSeq(floorForGen(state.lastChunkSeq, state.lastChunkGen, undefined), undefined) leaves the floor at the stale per-slot value pending restored and never installs lastChunkGen → every WS chunk at or below the page's folded seq that raced this snapshot passes the floor test and is pushed into a fresh streaming row below the steer bubble, duplicating the fragment already rendered in the finalized bubble. The sibling reducer still seeds from the pure payload (slotRefresh.ts:581-583, snapshotChunkGen(messages) / snapshotChunkSeq(messages)), and this file's own surviving comment at line 926 still asserts "Seed the replay guard from the PURE fetched page".
Fix: derive the floor inputs from the untouched payload — const floorSegment = readPageSegment(messages) for snapGen/snapSeq — and keep pageSegment = readPageSegment(preserved) only for the merge/index decisions that must address preserved.

[BLOCK-MERGE] c6449cd
[OPUS-REVIEWED] c6449cd

@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 1, 2026
@junjiequ
junjiequ force-pushed the fix/dashboard-message-loss branch from 43e2348 to fb33e68 Compare October 1, 2026 13:14
@junjiequ

junjiequ commented Oct 1, 2026

Copy link
Copy Markdown
Contributor Author

self-added: yes
mechanism: shared confirmed-send retention across active-view consumers

fixed
Moved retention into confirmedUserTailAfterPage and applied it to refreshSlot.fulfilled and switchSlot.fulfilled.
Added switch-back regression coverage in fb33e687785eb93f7dd424fb9a687737d18c3124.

@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 1, 2026
@junjiequ
junjiequ force-pushed the fix/dashboard-message-loss branch from fb33e68 to c230258 Compare October 1, 2026 14:37
@junjiequ

junjiequ commented Oct 1, 2026

Copy link
Copy Markdown
Contributor Author

self-added: yes
mechanism: durable anchor behind a transient streaming suffix

fixed
confirmedUserTailAfterPage now skips only trailing identity-less streaming rows and still declines every other unidentified tail.
Refresh and switch-back regressions cover the streaming-tailed stale page in c23025892acefc013f676ceae2498a6cd309dc49.

@junjiequ

junjiequ commented Oct 1, 2026

Copy link
Copy Markdown
Contributor Author

self-added: yes
mechanism: durable anchor behind a transient streaming suffix

fixed
confirmedUserTailAfterPage now skips only trailing identity-less streaming rows and still declines every other unidentified tail.
Refresh and switch-back regressions cover the streaming-tailed stale page in c23025892acefc013f676ceae2498a6cd309dc49.

@junjiequ

junjiequ commented Oct 1, 2026

Copy link
Copy Markdown
Contributor Author

self-added: yes
mechanism: durable anchor behind a transient streaming suffix

fixed
confirmedUserTailAfterPage now skips only trailing identity-less streaming rows and still declines every other unidentified tail.
Refresh and switch-back regressions cover the streaming-tailed stale page in c23025892acefc013f676ceae2498a6cd309dc49.

@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 1, 2026
@junjiequ
junjiequ force-pushed the fix/dashboard-message-loss branch from c230258 to 76191b3 Compare October 1, 2026 15:43
@junjiequ

junjiequ commented Oct 1, 2026

Copy link
Copy Markdown
Contributor Author

self-added: yes
mechanism: stale-page tail uses live user-insertion semantics

fixed
A retained steer now finalizes a cloned stale stream before insertion, so later chunks open below the steer.
Ordinary non-steers deliberately keep [streaming, user], matching appendMessage; broad finalization would split one running turn. Covered in 76191b3a83bcbc054005cd54824b8356e14b4bbc.

@junjiequ

junjiequ commented Oct 2, 2026

Copy link
Copy Markdown
Contributor Author

self-added: yes
mechanism: one reconciled page-segment reader owns stream authority

  • Fixed: finalized snapshots cannot resurrect or reorder a stale stream

After three recurrences, the repeated streamToKeep branch chain was removed rather than patched again.
readPageSegment(preserved) now classifies and indexes the same steer-reconciled array the reducer modifies, so finalization and placeholder removal cannot shift a raw-page index onto the pre-steer assistant or retained steer.
Finalized-page, exact-identity, post-steer continuation, and placeholder-splice regressions all pass.
Fixed in f82f8ef416af48f3b01ba3b3d948abbd2e80ac7e; 9,711 related frontend and 1,234 direct backend tests pass.

@junjiequ

junjiequ commented Oct 2, 2026

Copy link
Copy Markdown
Contributor Author
  • Rebutted as a current defect: both replacement consumers now share one owner

The frozen goal is to keep an already confirmed dashboard send visible; changing slot-detail pagination or persistence semantics would alter the shared server contract beyond that goal.
Active refresh and switch-back now share confirmed-row reconciliation, client-only proof, and one absent/open/finalized page-segment interpretation instead of duplicating endpoint assumptions.
No other consumer has reproduced this loss, so a server read-through or version stamp remains an architectural option rather than evidence this client fix is incomplete.

@junjiequ

junjiequ commented Oct 2, 2026

Copy link
Copy Markdown
Contributor Author

self-added: yes
mechanism: one reconciled page-segment reader owns stream authority

  • Rebutted: stream authority is required once a confirmed user tail is retained

Retaining the sent row breaks the base assumption that the open stream is always the array tail; removing stream reconciliation would trade the original disappearance for dropped, duplicated, or misordered reply text.
One absent/open/finalized reader now replaces three rounds of branch conditions and compares sequence/generation only for an open segment.
Finalized, distinct-next-segment, exact-identity, steer, and placeholder regressions prove both the original goal and the opposite failure mode remain covered.

@junjiequ

junjiequ commented Oct 2, 2026

Copy link
Copy Markdown
Contributor Author

Rebased: main advanced from a56c5bb4e3341dbb0cdc8129bde5d63758edf5b6 to 6916ba17f06413fd6933459ae7f69ed864fc4e26 across adjacent system-spec modules before publication. The single feature commit is now f82f8ef416af48f3b01ba3b3d948abbd2e80ac7e; 9,711 related frontend tests, 1,234 direct backend overlaps, typecheck, ESLint, docs, and both local review contracts pass. CI is re-running.

@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 2, 2026
@junjiequ
junjiequ force-pushed the fix/dashboard-message-loss branch from f82f8ef to 44273a3 Compare October 2, 2026 22:58
@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 2, 2026
Keep confirmed user sends and locally completed replies visible when a running slot fetch returns an older transcript snapshot.

Reconcile fetched and local segments by durable turn identity, segment order, request-scoped finalizer evidence, and retained server counts. Remote rewinds remain authoritative.
@junjiequ
junjiequ force-pushed the fix/dashboard-message-loss branch from 44273a3 to c6449cd Compare October 3, 2026 03:14
@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 3, 2026
@github-actions github-actions Bot added the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Oct 3, 2026
@dwu96 dwu96 added needs-pr-triage PR scanner: awaiting automated triage needs-author-decision PR blocked on author input and removed needs-pr-triage PR scanner: awaiting automated triage labels Oct 6, 2026
@dwu96

dwu96 commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

🤖 Kiro Crew [operator: dwu96#8c08bee0]: This PR has been inactive for 7+ days. I reviewed the blockers but they require your input:

  • Two lanes block the current head c6449cd82, and GPT's finding is security-fenced. GPT 5.6 blocks at website/src/store/chat/slotRefresh.ts:457 ("Older refresh can overwrite a newer switch"), and its adjudication records UPHOLD-FENCED — the rarity downgrade was explicitly refused, because "two HTTP responses reordering across a sidebar click is the ordinary race this PR's own refreshIssuedSeq claim was built to order in the mirror direction, not an extreme or self-contradicting condition combination." Harm is classed UNBOUNDED (transcript rows silently dropped from the active view). A disposition from me cannot clear a fenced finding.

  • GPT's prescribed fix needs ordering state that does not exist yet. The remedy is "Reject a refresh when a later same-slot switch has settled", but the adjudicator notes refreshSlot.fulfilled "orders only against refreshAppliedSeq … and consults no switch claim", and that "liveFrameSeq is not advanced by a switch". So the refresh reducer has nothing to consult today: satisfying this means designing the switch-side claim that refresh reads. How refresh and switch rank against each other is this PR's central question, and I don't think automation should pick that model for you.

  • The PR breaks an existing main invariant, and that is not base drift. website/src/store/chatSlice.boundedRefetchShrink.test.ts ("a bounded refetch must not shrink what is already loaded") fails on this head. It was last changed on main in f93b53a20 at 2026-10-02T05:05Z, before this head was pushed at 2026-10-03T03:03Z, so the current version of that test is the one you are running against. Your own modified chatSlice.abortOlderOnSwitch.test.ts ("a newer refresh out-ranks a pending same-slot switch and owns its cursor") also still fails — the invariant is stated but not yet satisfied.

  • Ten distinct frontend test files are red, which is wider than the ordering fix alone: chatSlice.abortOlderOnSwitch, chatSlice.boundedRefetchShrink, ChatPage.navFarJump, ChatPageCoverage, ChatPageNewSessionPrefill, ChatPageSendCreateFailure, and four ChatSidebar.* files (boardFolderCreateInTab, boardNewChatInFolder, folderCreateInTab, newChatInTab). Worth confirming whether the ChatSidebar.* four are fallout from a shared store-shape change or separate drift.

  • Opus 5 also blocks, separately, at website/src/store/chat/slotSwitch.ts:580 — the switch-back replay floor is read off the post-merge array, so a retained steer disables it and already-shown text appends twice. This one is concretely specified (const floorSegment = readPageSegment(messages) for snapGen/snapSeq, keeping pageSegment = readPageSegment(preserved) for merge/index decisions only) and your own comment at line 926 still asserts "Seed the replay guard from the PURE fetched page". I'd have been comfortable fixing this one alone, but it is not the blocker that decides the PR.

For reference, the merge conflict itself is small — 6 hunks in slotRefresh.ts, 2 in chatSlice.ts, 1 doc hunk, at 463 commits behind main — but it sits in the same span as the fenced race, so resolving it is entangled with the ordering decision above rather than independent of it.

When you've addressed these, the pipeline will re-assess on its next cycle. If you'd prefer no automation on this PR at all, add the pr-no-autofix label.

@iamwhatever

Copy link
Copy Markdown
Contributor

Thank you for this careful investigation, @junjiequ. We are closing it because the disappearing-send symptom has since been fixed on main by smaller changes: #18658 (sending right after opening a chat) and #25630 (sending during a slot refresh). This branch now conflicts with both, and it still has an open blocking review at slotRefresh.ts:457. If you can still reproduce a confirmed send vanishing on current main, please open an issue with the steps; a focused fix on top of #25630 would be welcome.

The branch is left untouched, so you can reopen this PR at any time, or open a fresh one on current main, if you want to pick it back up.

@iamwhatever iamwhatever closed this Nov 1, 2026
@github-actions github-actions Bot removed the readiness: action required A blocking check or review needs attention label Nov 1, 2026
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) merge conflict Branch has merge conflicts with its base — author must resolve before merge needs-author-decision PR blocked on author input

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants