fix(chat): keep stored rectification titles on open
Independent Staging Quality Gate / validate (push) Successful in 11m43s
Independent Staging Quality Gate / publish (push) Successful in 2m3s

Opening a saved birth-time session no longer restamps the title or updatedAt from the wall clock. Occupies BUG-699, recurrence of BUG-553.
This commit is contained in:
jesse-ux
2026-09-15 14:48:03 +08:00
parent 224244c014
commit 2d7698ead3
13 changed files with 397 additions and 10 deletions
@@ -3,6 +3,7 @@
import type { Dispatch, MutableRefObject, SetStateAction } from "react";
import { resolveSessionTitle } from "@/lib/agent-reply";
import { rectificationOpenIdentity } from "@/lib/rectification-session-open";
import { showChatNotice as setComposerNotice } from "@/lib/chat-notice";
import { writeSessionUrl } from "@/lib/chat-session-url";
import type { ConsultationEntrypoint } from "@/lib/consultation-entrypoint";
@@ -213,16 +214,20 @@ export function useRectificationSurface(params: RectificationSurfaceParams) {
// Merge the server-created session into the local list. The browser
// never generates a Case id; it only mirrors the returned binding.
const existing = sessions.find((session) => session.id === opened.sessionId);
const merged: ChatSession = {
id: opened.sessionId,
const openIdentity = rectificationOpenIdentity(existing, {
title: resolveSessionTitle("生时校正", undefined, {
entrypoint: "birth_time_rectification",
existingTitles: sessions.map((session) => session.title),
}),
updatedAt: timestamp(),
});
const merged: ChatSession = {
id: opened.sessionId,
title: openIdentity.title,
theme: "general",
modelId: modelCatalog.defaultModelId ?? "",
messages: [],
updatedAt: timestamp(),
updatedAt: openIdentity.updatedAt,
sessionType: "birth_time_rectification",
rectificationCaseId: opened.caseId,
pinned: existing?.pinned ?? false,