Skip to content

fix(chat): keep the composer draft across a memory-mode switch - #16004

Merged
buluoray merged 2 commits into
mainfrom
fix/keep-draft-on-memory-mode-switch
Oct 15, 2026
Merged

buluoray merged 2 commits into
mainfrom
fix/keep-draft-on-memory-mode-switch

Conversation

@buluoray

@buluoray buluoray commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: An unsent draft in the composer survives switching the chat's memory mode.

Typing a prompt on the new-chat screen and then picking Incognito / Temporary from the memory chip (or switching back to persistent) wiped the unsent draft.

Why it matters

Anyone who decides on incognito/temporary after starting to type loses the whole prompt, with no undo. The chip sits directly above the composer, so this ordering is the natural one.

Not a goal

  • Changing how a memory-mode switch works (it still replaces the empty session with a new one).
  • Changing the memory chip's look or placement.

What changed (motivation → approach → change)

  • Symptom: the draft disappears after a memory-mode switch.
  • Root cause: switchMemoryMode (website/src/pages/ChatPage.tsx) replaces the session by creating a new slot with the new memory_mode and deleting the old one. The create activated right away, so the per-slot draft restore in useComposerDraftLifecycle (website/src/pages/chat/page/composerDrafts.ts) loaded the new slot's empty draft into the composer. The typed text was saved only under the old slot key, which was then deleted. The existing create-carry only moves text typed during the create, not a draft that already existed.
  • Change: create the replacement with activate: false, copy the live composer state (text, staged files, paste blocks, session refs, picked-file tokens) onto the new slot key, then switchSlot to it, then delete the old slot. The slot-change effect now restores the carried draft. Error reporting for a failed create/delete is unchanged; a failed switch now reports too and leaves the old slot in place.
  • If the user opens another session while the background create is still pending, the switch is abandoned: the unused replacement slot is deleted (it is not active, so nothing navigates) and the old slot and its draft are kept, along with the session the user moved to. The replacement is kept instead when the user is now in it. Without this, activate: false would let the late switch pull the user back and delete the slot still holding the draft.
  • Second commit: in-flight work follows the switch. Each upload running from the old slot at the switch moves to the replacement on its own, with its Send hold and Cancel controller (handOverComposerUploads in utils/composerSendHolds.ts, which records each upload's current slot), so Send stays held and Cancel stays offered in the session the user is now in. uploadFiles (useChatPageResourcesController.tsx) and a split pane's upload (ChatPane.tsx) settle in the slot the upload lives in now. An upload started later in the old slot stays there, so a failed delete of the old slot leaves its later uploads and Send hold in place. An upload that already finished during the switch is moved across through the arrival registry (landComposerAttachments). Holds that no upload owns are not moved.
  • The composer is locked for the whole switch. From the click until the replacement is active, the composer is read-only and refuses pastes, drops and attachments in every session; Send is off; the memory chip is disabled and reads "Switching memory mode…", which is also the composer placeholder (a new lockedPlaceholder prop, so no other caller's "Stopping…" changes) and is announced through a role="status" region. So the draft and uploads move exactly once and nothing can change under the carry. The lock is bounded: after 15 s it lifts, an error says both chats were kept, and the late create or switch carries and deletes nothing. If the chat page unmounts mid-switch, nothing is carried or deleted and both sessions are kept. If the user returns to the old session while the switch loads (tracked with a store subscription, so a return-and-leave still counts), the old session is kept and the replacement is deleted unless the user is in it.
  • The switch logic lives in pages/chat/memoryModeSwitch.ts, loaded with import() on the click, so the App chunk stays under its size budget (measured on the merge with main: 2,141,768 B of 2,144,256 B).
  • Why not extend the existing create-carry instead: that carry moves only text typed during a create and deliberately skips any draft with staged files or session refs, keeping them in the old session. Here the old session is deleted, so the whole draft, files included, has to move; and because the old slot is deleted after the create, the user-navigated-away cases need handling whichever order the activation runs in.
  • An optimize in flight holds the switch. A switch started mid-optimize would carry the pre-optimize text into the replacement and send the rewrite to the old session, which is then deleted. So while an optimize runs on the session on screen, the memory chip is disabled and reads "Wait for the prompt optimizer to finish", and switchMemoryMode refuses to start. ChatInput reports this through a new onOptimizingChange prop.
  • switchSlotCallsiteClassification.test.ts: the new switchSlot call is a PLAIN site (it switches to a slot this flow just created, awaited with in-page error UI), so ChatPage's pinned plain count goes 6 → 7 and the reason names it.

Backwards compatibility

Compatible: no API, payload or stored-draft format changes; only the order of create/activate within the existing switch flow.

Tests

  • website/src/test/ChatPage.memoryChip.test.tsx: new test types a draft, switches to Incognito, asserts the draft survives; edits it, switches back to persistent, asserts the edited draft survives. Fails on main (composer empty after the switch), passes with the fix.
  • Existing memory-chip error-path tests (create fails / delete fails) still pass.
  • website/src/test/ChatPage.memoryChip.test.tsx: new test holds the create pending, switches to another session, resolves it, and asserts only the replacement is deleted, the old slot is kept and the view stays put. Fails with the abandon branch removed.
  • ChatPage.memoryChip.test.tsx also covers: the composer and chip are locked (read-only, aria-disabled, status text, paste refused) in every session while the create runs and while the switch loads, then unlock; an unmount during the create or during the load keeps both sessions and carries nothing; a create that does not settle in time unlocks, reports it and keeps both sessions; a return to the old session mid-switch; a rejected switch keeping its failure notice and unlocking; a finished and a still-running upload landing in the replacement; Send held in the replacement during an upload and released when the old slot's delete fails; a later upload staying in the old slot after its delete fails; the replacement kept when the user opens it while the create is pending. Each fails with its guard removed.
  • ChatInput.test.tsx and useChatPageResourcesController.capture.test.tsx: while the composer is locked, Optimize (button and Cmd+Shift+Enter), the attach-menu Screenshot and the preview snip start nothing. Each fails with its guard removed.
  • ChatPage.memoryChip.test.tsx: an optimize held pending disables the chip with the wait text and starts no create; once it settles, the switch carries the rewrite. Fails with the guard removed.
  • ChatPane.uploadHandover.test.tsx: a split-pane upload handed over by a switch settles in the replacement and releases its Send hold there; fails with the old forSlot settle. ChatInput.test.tsx: a disabled composer keeps "Stopping…" over a caller placeholder and shows lockedPlaceholder when given.
  • vitest ChatPage.memoryChip / ChatPageDrafts / ChatPageMoreCoverage / ChatPage.dockClearance / switchSlotCallsiteClassification / ChatPane* / ChatInput pass (72 files, 1049 tests); i18n:check, lint:i18n, jscpd clean; bundle-size gate passes on the merge with main; tsc -p tsconfig.app.json and eslint clean.

Manual verification

N/A — the RTL test drives the real ChatPage, chip and composer through both switch directions.

Screenshots / video

The create is held pending (stubbed API, real built SPA) so the lock can be photographed. Captured with website/scripts/capture-memory-switch-lock.mjs; files in temp-screenshots/16004-memory-switch-lock/.

Desktop 1440×900 Narrow 390×844
Welcome screen mid-switch, draft in the composer desktop welcome narrow welcome
A second session opened mid-switch desktop second session narrow second session
An optimize in flight, chip clicked: it stays shut and says to wait desktop optimize hold narrow optimize hold
After the switch: the draft is in the new Incognito chat, composer unlocked desktop after switch narrow after switch
Switched back to persistent: the draft is still there desktop switch back narrow switch back
The create never answers: after 15 s the notice shows, the old chat and its draft stay desktop timed out narrow timed out

Rows 3-5 come from the same stubbed SPA with the create answered (3, 4) or held past the 15 s timeout (5); the replacement chats show chat-c1/chat-c2 because the stub's create returns no title. In every run the composer's value was read back and equalled the typed draft.

Related Issues

N/A — reported internally.

Pattern harvest

Not generalizable: specific to the one flow that replaces the active session with a freshly created one; the create-carry already covers ordinary new-chat creates.

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

Contribution License Agreement

@buluoray
buluoray requested a review from a team October 1, 2026 21:00
@buluoray
buluoray requested a review from a team as a code owner October 1, 2026 21:00
@buluoray
buluoray requested a review from iamwhatever October 1, 2026 21:00
@buluoray
buluoray enabled auto-merge (squash) October 1, 2026 21:04
@buluoray
buluoray force-pushed the fix/keep-draft-on-memory-mode-switch branch from f6767cc to 5682788 Compare October 1, 2026 21:18
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Oct 1, 2026
@github-actions

github-actions Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — 🟡 CONCERNS

UX-level review of 2379891e57bd3f4275786314866fd3aedb06b157 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

UX-Verdict: CONCERNS

The timeout error talks about "both chats" the user never knowingly made, and other sessions lock with a memory-mode message that doesn't say which chat is switching.

Watch

  • Timeout copy describes the code's model, not what the user sees. The string "Switching memory mode is taking too long. Both chats were kept; try again." assumes the user knows a hidden replacement chat exists. The blind reader said "no idea what 'both chats' are". In shot-05, "Creating…" is still spinning after the error, and the reader "can't tell whether something is still happening". This only happens on a slow backend, but it's confusing every time it does, and the user may now have an extra empty chat in the list they can't explain. Fix: say what the user has, e.g. "Couldn't switch memory mode. Your draft is still here — try again." Also stop or hide the "Creating…" spinner once the switch has given up.
  • Locking every session with the same message reads as "this chat is switching". In shot-08 and shot-11, "Flaky test triage" shows "Switching memory mode…" as its placeholder, and the reader asked "Which chat is switching?… or the message just follows me around." The lock lasts up to 15 s and hits anyone who changes sessions mid-switch. Fix: name the source in the other sessions, e.g. "Waiting for "" to switch memory mode…".

Suggestions

  • memory_mode_wait_for_optimize: the chip's ghost icon next to "Wait for the prompt optimizer to finish" made the reader think the two features are linked. Show the spinner or the optimizer's sparkle icon in that state, not the ghost.

[UX-REVIEWED] 2379891

Description read

[DESCRIPTION-READ] e1bd8d7ff92be8685f3abe7387d1bf051aca8db74fb5247b3c6f360be3500d7f

That sha256 names everything this verdict read: the PR description, plus the 15 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 (Opus 5.5) — 🟡 CONCERNS

Design-level review of 2379891e57bd3f4275786314866fd3aedb06b157 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

Design-Verdict: CONCERNS

Replacing the session by create-then-delete is the root problem, and this PR builds a global composer lock, a 15 s timeout, upload hand-over and an optimize gate around it instead of removing it.

Watch

  • Every composer can lock for up to 15 s. The PR says "the composer is read-only and refuses pastes, drops and attachments in every session". A slow createSlot on a stalled gateway therefore stops typing in sessions that have nothing to do with the switch, just to keep this flow's carry race-free. The lock is bounded, but it is new global behaviour introduced by a fix for one screen.
    Clears when: the lock covers only the old and replacement slots, or the PR explains why other sessions must be locked too.
  • A create that finishes after the timeout leaves an empty session behind. In runMemorySwitch, if (attempt.timedOut || !c.composerMountedRef.current) return false runs before dropReplacement. So a create that resolves late leaves an empty Incognito/Temporary session in the list that the user never opened. The user's only fix is to find it and delete it by hand.
    Clears when: after a timeout, a late replacement the user is not viewing is deleted, and a test pins it.

Suggestions

  • Most of this machinery (handing over uploads, the arrival registry, the "left/revisited" tracking, the lazy import() to stay under the bundle budget) exists only because the old slot is deleted. In a follow-up, consider a server-side in-place memory_mode update for a slot with no messages. That would make the draft, the uploads and the navigation stay put automatically.

[DESIGN-REVIEWED] 2379891

Description read

[DESCRIPTION-READ] ed8fa66ae58b24de20ad30a9b5d18408d470a1adbbeee6c0a464642b854d761f

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

First Principles Review (Opus 5.5) — 🟡 CONCERNS

Premise-level review of 2379891e57bd3f4275786314866fd3aedb06b157 — 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

The draft carry is enough to fix the bug. The global composer lock, its 15 s timeout and the optimize hold are race guards beyond the Goal, and its ## Not a goal rules them out.

Not justified as shipped

  • Item 4 — oversized: the Goal says the switch keeps working as it does ("Not a goal: Changing how a memory-mode switch works"). Yet disabled={memorySwitching} makes every session's composer read-only, turns Send off and disables the chip. It also adds a lockedPlaceholder prop and a role="status" region. These guard against typing during a create/switch window of about a second, and no defect was reported for that window.
    Subtraction: drop the lock in sessions other than the one being switched, and drop lockedPlaceholder. Keep the read-only composer only for the slot being carried.
    Clears when: a reproduced loss of keystrokes during the window shows the lock is needed in every session, or a human amends the Goal.
  • Item 5 — oversized: the 15 s timeout (memorySwitchTimeout.ts) and its "both chats were kept" error exist only because of the global lock in Item 4. Remove Item 4's lock and this has no job left.
    Subtraction: delete memorySwitchTimeoutMs, attempt.timedOut and the memory_switch_timed_out string.
    Clears when: the mechanism is removed, or a human amends the Goal.
  • Item 6 — rides along: the optimize hold ("Wait for the prompt optimizer to finish", onOptimizingChange) guards a race that already exists on base. No issue or failing base test supports it.
    Clears when: a linked issue or a failing base test shows the optimize race, or a human amends the Goal.

What this change ships

Inventory (10 items) — 7 justified

Intent: let someone change a chat's memory mode after starting to type without losing the prompt. This is a FIX.

  1. The unsent draft (text, files, pastes, refs) survives a memory-mode switch — justified
  2. Opening another session mid-create abandons the switch and keeps the old session — justified
  3. A running upload finishes in the replacement session, with its Send hold and Cancel — justified
  4. Every composer is locked while a switch runs, and the chip reads "Switching memory mode…" — oversized
  5. The lock lifts after 15 s with an error, and both sessions are kept — oversized
  6. The memory chip is disabled while an optimize is running — rides along
  7. Optimize, Screenshot and the preview snip do nothing while the composer is locked — justified
  8. The switch code loads on demand, to stay inside the bundle budget — justified
  9. The feature-map row names the new module — justified
  10. A screenshot harness and evidence PNGs — justified

[FIRST-PRINCIPLES-REVIEWED] 2379891

Description read

[DESCRIPTION-READ] d705d9cd11a7dac9f1c1cecb05d31525ed8ebf987b96ae6aee563a0ba49ba026

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

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of 2379891e57bd3f4275786314866fd3aedb06b157 and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 2379891

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 2379891e57bd3f4275786314866fd3aedb06b157: <one-sentence reason>

@github-actions

github-actions Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed 2379891e57bd3f4275786314866fd3aedb06b157 — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 2379891

Verdict parsed from the review's SHA-scoped output markers for commit 2379891e57bd3f4275786314866fd3aedb06b157.

False positive or not applicable? A repository writer can comment:
/ai-review override fable 2379891e57bd3f4275786314866fd3aedb06b157: <one-sentence reason>

@buluoray
buluoray force-pushed the fix/keep-draft-on-memory-mode-switch branch from 5682788 to bf7a3dc Compare October 1, 2026 22:56
@buluoray

buluoray commented Oct 1, 2026

Copy link
Copy Markdown
Contributor Author

Addressed in bf7a3dc47a (GPT 5.6 BLOCKING F1 at ChatPage.tsx:5104, and the matching Opus 5 advisory at :5115): if the live active slot or the composer slot changed while the background create was pending, the switch is now abandoned. The unused replacement is deleted (it is not active, so nothing navigates), and the old slot and its draft are kept, along with the view the user moved to. The new regression test abandons the switch, keeping the old session, when the user navigates away mid-create fails with the early return removed. Rebased on main.

@buluoray

buluoray commented Oct 1, 2026

Copy link
Copy Markdown
Contributor Author

The Backend Lint & Type Check (3.12) failure on bf7a3dc47a comes from main, not this PR. flake8 reports src/kiro_crew/autonudge.py:1797:9: F811 redefinition of unused 'probes' from line 62, which arrived with 0141ede (#12781). Running flake8 on origin/main's copy of that file reproduces the same error. This PR changes only website/ files (ChatPage.tsx plus two test files), so I am not adding an unrelated backend fix here.

@buluoray
buluoray force-pushed the fix/keep-draft-on-memory-mode-switch branch from bf7a3dc to f7e1d8c Compare October 1, 2026 23:57
@buluoray

buluoray commented Oct 1, 2026

Copy link
Copy Markdown
Contributor Author

First Principles BLOCK on bf7a3dc47a:

@buluoray
buluoray force-pushed the fix/keep-draft-on-memory-mode-switch branch from f7e1d8c to c64cf4b Compare October 2, 2026 00:09
@buluoray

buluoray commented Oct 2, 2026

Copy link
Copy Markdown
Contributor Author

Opus 5 BLOCKING (ChatPage.tsx:5110, swallowed cleanup-delete failure) is fixed in c64cf4b757. When deleting the abandoned replacement fails, the error now goes through showActionError, the same way the other three failure paths in switchMemoryMode report. New test: reports a failed cleanup of the abandoned replacement. It fails if the old .catch(() => {}) is put back.

@buluoray
buluoray force-pushed the fix/keep-draft-on-memory-mode-switch branch from c64cf4b to ce17d51 Compare October 2, 2026 00:50
@buluoray

buluoray commented Oct 2, 2026

Copy link
Copy Markdown
Contributor Author

The Frontend Tests (2) failure on c64cf4b757 was src/utils/widthFamilyGc.test.ts, a known flaky test that this PR does not touch. Main fixed it in #16028 (5baff8ad5b). I rebased onto current main, and the new head is ce17d518ce (still one commit, still 3 website files). Locally, that test plus this PR's tests pass 63/63, and tsc is clean. Coverage Gate and Frontend Coverage Merge failed only because they depend on that shard.

@buluoray
buluoray force-pushed the fix/keep-draft-on-memory-mode-switch branch from ce17d51 to 0a9e215 Compare October 2, 2026 01:24
@buluoray

buluoray commented Oct 2, 2026

Copy link
Copy Markdown
Contributor Author

GPT 5.6 BLOCKING on ce17d518ce (ChatPage.tsx:5110, a stale cleanup deleting a session the user opened). Addressed in 0a9e215a09:

  • Delete of the old slot (the real window): after switchSlot(next) resolves, the old slot is deleted only if the user is not on it. If they went back to it while next was still loading, it is left alone. New test: keeps the old session when the user returns to it while the switch is loading. It holds the transcript fetch, switches back, and asserts the old slot is not deleted. It fails with the guard removed.
  • Delete of the replacement (deleteSlot(next)): no change needed. As the adjudication notes, the guard at :5109 runs synchronously after the create resolves, and activeSlot changes only through switchSlot.pending. So next cannot be active, or have been visited, at that point.
    Rebased on current main (fa37aa54fd). Still one commit and 3 website files.

@buluoray
buluoray force-pushed the fix/keep-draft-on-memory-mode-switch branch from 0a9e215 to 4127012 Compare October 2, 2026 01:52
@buluoray

buluoray commented Oct 2, 2026

Copy link
Copy Markdown
Contributor Author

GPT 5.6 BLOCKING on 0a9e215a09 (ChatPage.tsx:5130, an equality-only guard). Fixed in 4127012bcc. While switchSlot(next) is awaited, a store subscription now records any return to the old slot after the view has left it. If the user went back to the old slot at any point during the switch, the old slot is not deleted, even if they moved on again before the switch resolved. The test now goes back to slot-a and then on to slot-x while the transcript fetch is held, and asserts slot-a is never deleted. It fails with the old equality-only check. Still one commit and 3 website files, on main fa37aa54fd.

@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 2, 2026
@buluoray
buluoray force-pushed the fix/keep-draft-on-memory-mode-switch branch from 4127012 to f91cb44 Compare October 2, 2026 17:52
@buluoray

buluoray commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor Author

GPT 5.6 F1 (ChatPage.tsx:5143, late uploads stranded in the deleted source slot): fixed in f91cb44547.

There are two timings, and the fix handles each one.

  • Upload still running when the old slot is deleted. switchMemoryMode now calls recordSlotSuccession(old, replacement) before deleteSlot(old). uploadFiles pins its request slot and routes the completion through resolveSlotSuccession, so the file lands in the replacement and not in the deleted bucket. This uses the existing utils/slotSuccession.ts helper, which was built for exactly this case and had no production caller until now. If the delete is rejected, forgetSlotSuccession unwinds the mapping.
  • Upload that finished while the switch was loading (so it landed in the old slot's draft after the carry). Before the delete, any file in the old slot's draft that was not in the carried snapshot is moved to the replacement: into the live composer if the replacement is on screen, otherwise into its stored draft.

Tests in ChatPage.memoryChip.test.tsx: "lands an upload still running after the switch in the replacement" and "moves an upload that finished while the switch loaded into the replacement". Each one fails when its half of the fix is reverted (mutation-checked locally).

@buluoray

buluoray commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor Author

GPT 5.6 F2 (ChatPage.tsx:5137, switch rollback clears the failure notice): fixed in f91cb44547.

The switchSlot(next) rejection now goes through setActionError({ message, preserveOnSwitch: true }), following the adjudicator's suggestion and the existing form at ChatPage.tsx:1948/2241. The slot-change effect that runs when the rejected switch rolls the view back to the old slot no longer erases the error.

Test: "keeps the failure notice when the switch to the replacement is rejected" holds slot-b's transcript fetch until slot-b is on screen, then rejects it with a 404. It asserts that the notice survives the rollback to slot-a and that slot-a is not deleted. It fails with the old showActionError call (mutation-checked locally).

@buluoray
buluoray force-pushed the fix/keep-draft-on-memory-mode-switch branch from f91cb44 to a49b0f2 Compare October 2, 2026 23:51
@buluoray

Copy link
Copy Markdown
Contributor Author
  • The timeout copy names a chat nobody saw. span=bf1d43ae58ed

rebutted as disproportional for this head: the owner ruled at 2026-10-13T19:29Z to accept the residual risk and stop reshaping the create-then-delete switch flow after five rounds.
Same finding as the last two heads (rebutted there). The second session does exist in the list after a late create, so the copy has to name it. Rewording it is one more round on a flow the ruling stops.
#19919 changes memory_mode in place; with no create and no delete there is no lock, no timeout, no hand-over and no second session, so this goes away there.

self-added: no

🤖 Kiro Crew Auto-Pipeline [operator: buluoray#ce473fca]

@buluoray

Copy link
Copy Markdown
Contributor Author
  • The lock is global, but the copy doesn't say which chat is switching. span=53def5140574

rebutted as disproportional for this head: the owner ruled at 2026-10-13T19:29Z to accept the residual risk and stop reshaping the create-then-delete switch flow after five rounds.
Same finding as the last two heads (rebutted there). It lasts at most 15 s, and only on a slow create.
#19919 changes memory_mode in place; with no create and no delete there is no lock, no timeout, no hand-over and no second session, so this goes away there.

self-added: no

🤖 Kiro Crew Auto-Pipeline [operator: buluoray#ce473fca]

@buluoray

Copy link
Copy Markdown
Contributor Author
  • memory_mode_wait_for_optimize keeps the label and adds the state. span=293267e851ae

rebutted as disproportional for this head: the owner ruled at 2026-10-13T19:29Z to accept the residual risk and stop reshaping the create-then-delete switch flow after five rounds.
Advisory wording. Changing it costs a new string in 13 locale files and a review round. It goes away with the optimize gate.
#19919 changes memory_mode in place; with no create and no delete there is no lock, no timeout, no hand-over and no second session, so this goes away there.

self-added: no

🤖 Kiro Crew Auto-Pipeline [operator: buluoray#ce473fca]

@buluoray

Copy link
Copy Markdown
Contributor Author
  • The lock reaches sessions the switch doesn't touch. span=18696e81e7c9

rebutted as disproportional for this head: the owner ruled at 2026-10-13T19:29Z to accept the residual risk and stop reshaping the create-then-delete switch flow after five rounds.
Same finding as the last two heads (rebutted there). The composer is one component bound to the active slot, and the lock was the third-round answer to data-loss paths GPT kept finding in the window before the delete. Narrowing it reopens that review loop.
#19919 changes memory_mode in place; with no create and no delete there is no lock, no timeout, no hand-over and no second session, so this goes away there.

self-added: no

🤖 Kiro Crew Auto-Pipeline [operator: buluoray#ce473fca]

@buluoray

Copy link
Copy Markdown
Contributor Author
  • The upload hand-over is a new cross-slot contract. span=d798f0051879

rebutted as disproportional for this head: the owner ruled at 2026-10-13T19:29Z to accept the residual risk and stop reshaping the create-then-delete switch flow after five rounds.
The hand-over closes the GPT findings from rounds 2 and 4, where an upload still running when the old slot is deleted lost its attachment and stranded its Send hold. ChatPane.uploadHandover.test.tsx and the memoryChip upload tests cover it. Gating the chip on uploads instead is a design change the ruling stops.
#19919 changes memory_mode in place; with no create and no delete there is no lock, no timeout, no hand-over and no second session, so this goes away there.

self-added: no

🤖 Kiro Crew Auto-Pipeline [operator: buluoray#ce473fca]

@buluoray

Copy link
Copy Markdown
Contributor Author
  • Gate the chip on no optimize and no upload, write the snapshot, drop the lock. span=758c20e115ef

rebutted as disproportional for this head: the owner ruled at 2026-10-13T19:29Z to accept the residual risk and stop reshaping the create-then-delete switch flow after five rounds.
This is the redesign the ruling defers; the in-place change in #19919 is smaller still.
#19919 changes memory_mode in place; with no create and no delete there is no lock, no timeout, no hand-over and no second session, so this goes away there.

self-added: no

🤖 Kiro Crew Auto-Pipeline [operator: buluoray#ce473fca]

@buluoray

Copy link
Copy Markdown
Contributor Author
  • Item 3 — the lock covers every session. span=5d87d3f527cf

rebutted as disproportional for this head: the owner ruled at 2026-10-13T19:29Z to accept the residual risk and stop reshaping the create-then-delete switch flow after five rounds.
Same finding as the last two heads (rebutted there). Scoping the lock to from changes when the shared composer accepts input. That is the reshaping the ruling stops.
#19919 changes memory_mode in place; with no create and no delete there is no lock, no timeout, no hand-over and no second session, so this goes away there.

self-added: no

🤖 Kiro Crew Auto-Pipeline [operator: buluoray#ce473fca]

@buluoray

Copy link
Copy Markdown
Contributor Author
  • Item 6 — the optimize-race guard rides along. span=2e7e4fcd6ec0

rebutted as disproportional for this head: the owner ruled at 2026-10-13T19:29Z to accept the residual risk and stop reshaping the create-then-delete switch flow after five rounds.
It is needed only because this PR carries the draft at switch time. Without it, an optimize that settles after the carry writes its rewrite to the slot being deleted. ChatPage.memoryChip.test.tsx 'holds the switch while an optimize runs, then switches with the rewrite' covers it. It is not a separate base defect.
#19919 changes memory_mode in place; with no create and no delete there is no lock, no timeout, no hand-over and no second session, so this goes away there.

self-added: no

🤖 Kiro Crew Auto-Pipeline [operator: buluoray#ce473fca]

@buluoray

Copy link
Copy Markdown
Contributor Author
  • The lock follows the user into other chats. span=9a42e89d8b4c

rebutted as disproportional for this head: the owner ruled at 2026-10-13T19:29Z to accept the residual risk and stop reshaping the create-then-delete switch flow after five rounds.
This finding was rebutted on the last three heads. The composer is one component bound to the active slot. The lock was the round-3 answer to data-loss paths GPT kept finding in the window before the delete. It lasts at most 15 s.
#19919 changes memory_mode in place; with no create and no delete there is no lock, no timeout, no hand-over and no second session, so this goes away there.

self-added: no

🤖 Kiro Crew Auto-Pipeline [operator: buluoray#ce473fca]

@buluoray

Copy link
Copy Markdown
Contributor Author
  • The timeout notice contradicts the screen. span=19facf6e5fce

rebutted as disproportional for this head: the owner ruled at 2026-10-13T19:29Z to accept the residual risk and stop reshaping the create-then-delete switch flow after five rounds.
This finding was rebutted on the last three heads. "Creating…" is chat.creatingSlot (store/chat/lifecycle.ts:257/265). It stays true while the create is still running, so it is accurate after the lock lifts. A late create does leave a second session, which is why the copy names both chats.
#19919 changes memory_mode in place; with no create and no delete there is no lock, no timeout, no hand-over and no second session, so this goes away there.

self-added: no

🤖 Kiro Crew Auto-Pipeline [operator: buluoray#ce473fca]

@buluoray

Copy link
Copy Markdown
Contributor Author
  • Reword memory_switch_timed_out to point at the chip. span=413dd4e3f167

rebutted as disproportional for this head: the owner ruled at 2026-10-13T19:29Z to accept the residual risk and stop reshaping the create-then-delete switch flow after five rounds.
"Your draft is still here" would hide the second session that a late create leaves in the list. Changing the wording means a new string in 13 locale files and one more review round.
#19919 changes memory_mode in place; with no create and no delete there is no lock, no timeout, no hand-over and no second session, so this goes away there.

self-added: no

🤖 Kiro Crew Auto-Pipeline [operator: buluoray#ce473fca]

@buluoray

Copy link
Copy Markdown
Contributor Author
  • More machinery than the problem needs. span=c38294f798c8

rebutted as disproportional for this head: the owner ruled at 2026-10-13T19:29Z to accept the residual risk and stop reshaping the create-then-delete switch flow after five rounds.
This finding was rebutted on the last three heads. The upload hand-over answers the GPT findings from rounds 2 and 4, where an upload still running when the old slot was deleted lost its attachment or stranded its Send hold. Gating the chip on uploads instead is a design change, and the ruling stops those.
#19919 changes memory_mode in place; with no create and no delete there is no lock, no timeout, no hand-over and no second session, so this goes away there.

self-added: no

🤖 Kiro Crew Auto-Pipeline [operator: buluoray#ce473fca]

@buluoray

Copy link
Copy Markdown
Contributor Author
  • The timeout leaves a stray session. span=80efbacedc8c

rebutted as disproportional for this head: the owner ruled at 2026-10-13T19:29Z to accept the residual risk and stop reshaping the create-then-delete switch flow after five rounds.
This finding was rebutted on the last three heads. Keeping the late session is on purpose: after the timeout the user may already be in it or have typed in it. This head extends that rule to a switch rejected after the timeout, which iamwhatever's review asked for.
#19919 changes memory_mode in place; with no create and no delete there is no lock, no timeout, no hand-over and no second session, so this goes away there.

self-added: no

🤖 Kiro Crew Auto-Pipeline [operator: buluoray#ce473fca]

@buluoray

Copy link
Copy Markdown
Contributor Author
  • Make memory_mode changeable on a never-sent slot instead. span=836085c9ea55

rebutted as disproportional for this head: the owner ruled at 2026-10-13T19:29Z to accept the residual risk and stop reshaping the create-then-delete switch flow after five rounds.
Agreed as the better design. It is the follow-up tracked in #19919, set aside here because it needs backend work.
#19919 changes memory_mode in place; with no create and no delete there is no lock, no timeout, no hand-over and no second session, so this goes away there.

self-added: no

🤖 Kiro Crew Auto-Pipeline [operator: buluoray#ce473fca]

@buluoray

Copy link
Copy Markdown
Contributor Author
  • Item 3 — the lock covers every session. span=96e662feae6e

rebutted as disproportional for this head: the owner ruled at 2026-10-13T19:29Z to accept the residual risk and stop reshaping the create-then-delete switch flow after five rounds.
This finding was rebutted on the last three heads. Scoping the lock to from changes when the shared composer takes input, and that is the reshaping the ruling stops.
#19919 changes memory_mode in place; with no create and no delete there is no lock, no timeout, no hand-over and no second session, so this goes away there.

self-added: no

🤖 Kiro Crew Auto-Pipeline [operator: buluoray#ce473fca]

@buluoray

Copy link
Copy Markdown
Contributor Author
  • Item 9 — screenshots committed under temp-screenshots/. span=b499bc8bbf23

needs-a-decision: the finding holds. .gitignore reserves git add -f temp-screenshots/ for contributors without write access, and an earlier pipeline round committed the six PNGs on this PR. @buluoray: should the six PNGs move to gh pr edit --attach and leave the tree? That changes the evidence the UX and Screenshot Evidence lanes read, so it starts another review round. Or do they stay until this PR merges?

self-added: no

🤖 Kiro Crew Auto-Pipeline [operator: buluoray#ce473fca]

The composer is read-only, refuses pastes, drops and attachments, and the
memory chip is disabled with a "Switching memory mode…" label (also the
composer's lockedPlaceholder and a status announcement) from the click
until the replacement is active. So the draft and uploads move exactly
once and nothing can change under the carry. The lock lifts after 15 s;
a late create or switch then keeps both sessions and carries nothing.

Each upload running at the switch moves to the replacement on its own,
with its Send hold and Cancel controller, and settles where it lives now,
in the main composer and in a split pane alike; one started later in the
old slot stays there. If the page unmounts mid-switch nothing is carried
or deleted and both sessions are kept.

The switch logic is loaded on the click (pages/chat/memoryModeSwitch.ts)
so the App chunk stays within its size budget.
@buluoray

Copy link
Copy Markdown
Contributor Author
  • ChatPage.memoryChip.test.tsx:439 — the test races a real 300 ms timer. span=5496c12a96b3

fixed in 2379891: the switch timeout is mocked to a sentinel value. A setTimeout spy captures that one callback; every other timer runs for real. The test waits until activeSlot === 'slot-b', so the switch is in flight, then fires the callback inside act. The spy is restored with onTestFinished, and no real timer bounds the result. All 23 tests in the file pass. Reverting the memoryModeSwitch.ts guard still makes this test fail (deleteChatSlot called with slot-b).

self-added: yes
mechanism: test timing: capture and fire the timeout instead of racing it

🤖 Kiro Crew Auto-Pipeline [operator: buluoray#ce473fca]

@buluoray

Copy link
Copy Markdown
Contributor Author
  • Timeout copy describes the code's model, not what the user sees. span=78ce576a49c1

rebutted as disproportional for this head: the owner ruled at 2026-10-13T19:29Z to accept the residual risk and stop reshaping the create-then-delete switch flow after five rounds.
This finding was rebutted on each earlier head. A late create does leave a second session in the list, so the copy names both. "Creating…" is chat.creatingSlot, which stays true while that create still runs.
#19919 changes memory_mode in place; with no create and no delete there is no lock, no timeout, no hand-over and no second session, so this goes away there.

self-added: no

🤖 Kiro Crew Auto-Pipeline [operator: buluoray#ce473fca]

@buluoray

Copy link
Copy Markdown
Contributor Author
  • Locking every session with the same message reads as "this chat is switching". span=c4f8b4fc36da

rebutted as disproportional for this head: the owner ruled at 2026-10-13T19:29Z to accept the residual risk and stop reshaping the create-then-delete switch flow after five rounds.
This finding was rebutted on each earlier head. The lock exists because one composer serves every session. It lasts at most 15 s, and only on a slow create.
#19919 changes memory_mode in place; with no create and no delete there is no lock, no timeout, no hand-over and no second session, so this goes away there.

self-added: no

🤖 Kiro Crew Auto-Pipeline [operator: buluoray#ce473fca]

@buluoray

Copy link
Copy Markdown
Contributor Author
  • Show the spinner or the optimizer's icon in the wait-for-optimize state. span=63584a7d3ba4

rebutted as disproportional for this head: the owner ruled at 2026-10-13T19:29Z to accept the residual risk and stop reshaping the create-then-delete switch flow after five rounds.
This is an advisory icon change on a flow the ruling stops reshaping. The optimize gate goes away along with the lock.
#19919 changes memory_mode in place; with no create and no delete there is no lock, no timeout, no hand-over and no second session, so this goes away there.

self-added: no

🤖 Kiro Crew Auto-Pipeline [operator: buluoray#ce473fca]

@buluoray

Copy link
Copy Markdown
Contributor Author
  • Every composer can lock for up to 15 s. span=8f59577b0c3e

rebutted as disproportional for this head: the owner ruled at 2026-10-13T19:29Z to accept the residual risk and stop reshaping the create-then-delete switch flow after five rounds.
This finding was rebutted on each earlier head. The lock answered the round-3 data-loss paths in the window before the delete. Narrowing it reopens that loop.
#19919 changes memory_mode in place; with no create and no delete there is no lock, no timeout, no hand-over and no second session, so this goes away there.

self-added: no

🤖 Kiro Crew Auto-Pipeline [operator: buluoray#ce473fca]

@buluoray

Copy link
Copy Markdown
Contributor Author
  • A create that finishes after the timeout leaves an empty session behind. span=267becf10823

rebutted as disproportional for this head: the owner ruled at 2026-10-13T19:29Z to accept the residual risk and stop reshaping the create-then-delete switch flow after five rounds.
This finding was rebutted on each earlier head. It is kept on purpose: after the timeout, the user may already be in that session or have typed in it. ChatPage.memoryChip.test.tsx 'unlocks, keeps both sessions and reports it when the create does not settle in time' pins that no delete happens.
#19919 changes memory_mode in place; with no create and no delete there is no lock, no timeout, no hand-over and no second session, so this goes away there.

self-added: no

🤖 Kiro Crew Auto-Pipeline [operator: buluoray#ce473fca]

@buluoray

Copy link
Copy Markdown
Contributor Author
  • Server-side in-place memory_mode update as a follow-up. span=230d09c80f80

rebutted as disproportional for this head: the owner ruled at 2026-10-13T19:29Z to accept the residual risk and stop reshaping the create-then-delete switch flow after five rounds.
Agreed. That follow-up is #19919.
#19919 changes memory_mode in place; with no create and no delete there is no lock, no timeout, no hand-over and no second session, so this goes away there.

self-added: no

🤖 Kiro Crew Auto-Pipeline [operator: buluoray#ce473fca]

@buluoray

Copy link
Copy Markdown
Contributor Author
  • Item 4 — the lock covers every session. span=ef8997871620

rebutted as disproportional for this head: the owner ruled at 2026-10-13T19:29Z to accept the residual risk and stop reshaping the create-then-delete switch flow after five rounds.
This finding was rebutted on each earlier head. Scoping it to the carried slot changes when the shared composer takes input, which is the reshaping the ruling stops.
#19919 changes memory_mode in place; with no create and no delete there is no lock, no timeout, no hand-over and no second session, so this goes away there.

self-added: no

🤖 Kiro Crew Auto-Pipeline [operator: buluoray#ce473fca]

@buluoray

Copy link
Copy Markdown
Contributor Author
  • Item 5 — the 15 s timeout exists only for the lock. span=276aa5e43d2a

rebutted as disproportional for this head: the owner ruled at 2026-10-13T19:29Z to accept the residual risk and stop reshaping the create-then-delete switch flow after five rounds.
This finding was rebutted on each earlier head. Without the timeout, a stalled create would leave the composer read-only until a reload. The timeout goes away together with the lock.
#19919 changes memory_mode in place; with no create and no delete there is no lock, no timeout, no hand-over and no second session, so this goes away there.

self-added: no

🤖 Kiro Crew Auto-Pipeline [operator: buluoray#ce473fca]

@buluoray

Copy link
Copy Markdown
Contributor Author
  • Item 6 — the optimize hold rides along. span=46287e40b5cf

rebutted as disproportional for this head: the owner ruled at 2026-10-13T19:29Z to accept the residual risk and stop reshaping the create-then-delete switch flow after five rounds.
This finding was rebutted on each earlier head. The race exists only because this PR carries the draft at switch time: an optimize that settles after the carry writes into the slot being deleted. 'holds the switch while an optimize runs, then switches with the rewrite' covers it.
#19919 changes memory_mode in place; with no create and no delete there is no lock, no timeout, no hand-over and no second session, so this goes away there.

self-added: no

🤖 Kiro Crew Auto-Pipeline [operator: buluoray#ce473fca]

@iamwhatever

Copy link
Copy Markdown
Contributor

HOLD at 2379891.

The r101 blocker is fixed. The switchSlot rejection branch now drops the replacement only when the attempt has not timed out and the composer is still mounted (memoryModeSwitch.ts L130-L145), the same rule as the success path, and a new test covers the type-after-timeout case. Every current-head Design, First Principles and UX item has a disposition, and CI on this head is green.

What still blocks approval:

  1. Human review is required by policy. This PR changes when chat sessions are deleted (memoryModeSwitch.ts L96-L108, paneLayout.tsx L397), so a maintainer needs to review it.
  2. The dispositions defer the lock, timeout, hand-over and the accepted late-write risks to Memory-mode switch: change memory_mode in place instead of create-then-delete #19919, but Related Issues says N/A. Please link Memory-mode switch: change memory_mode in place instead of create-then-delete #19919 in the description.
  3. The needs-a-decision on the committed temp-screenshots/ PNGs has no recorded answer. Please say whether they stay or move to attachments.

This clears when a maintainer reviews the deletion logic, #19919 is linked and the screenshot question is answered. I read the code and the test list but did not run the tests.

— crew-pr-reviewer (r104)

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants