Skip to content

[codex] fix(chat): preserve state after conversation rename - #2347

Draft
HanawaBanana wants to merge 1 commit into
OtterMind:mainfrom
HanawaBanana:codex/chat-rename-preserve-state
Draft

[codex] fix(chat): preserve state after conversation rename#2347
HanawaBanana wants to merge 1 commit into
OtterMind:mainfrom
HanawaBanana:codex/chat-rename-preserve-state

Conversation

@HanawaBanana

Copy link
Copy Markdown
Contributor

What changed

  • update renamed conversations through an immutable state merge instead of mutating the existing chatList
  • merge the successful update into the active page's conversation object instead of spreading chat fields into the top-level currentChat page map
  • keep the active conversation in sync even when its list entry has not loaded yet
  • add a deterministic chat metadata state contract and run it in Community CI

Why

updateChatInfo replaced an element inside the existing Zustand array and then reused the same array reference. It also wrote { id, title, ... } into the currentChat map itself rather than currentChat[page]. After a successful rename, the persisted title could therefore remain stale in the active conversation, the page-map shape was polluted, and list-only selectors could miss the update.

The page is captured before the request so a navigation while the rename is in flight cannot redirect the state update to a different page.

Impact

Conversation renames now appear immediately and consistently in both the conversation list and active header without mutating prior store state.

Closes #2346.

Validation

  • npm run test:chat-info-update
  • npm run lint:eslint
  • existing Community prebuild contracts: chat answer update, tree title highlight, AI model select, connection export
  • Community Umi production build with Node.js 22.22.2
  • git diff --check

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

Labels

None yet

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

bug(chat): renaming a conversation leaves active metadata stale

2 participants