fix(chat): keep rectification sessions findable and keep the delivery card
Independent Staging Quality Gate / validate (push) Failing after 6m45s
Independent Staging Quality Gate / publish (push) Skipped

Rectification answers now advance chat_sessions.updated_at (BUG-704).
A ?c= id missing from the loaded page is fetched before anyone may call
it deleted (BUG-705). The range card no longer has a post-card tie-break
button; live questions leave the card visible with adopt locked
(BUG-706/708). Spoken copy bans 相对支持度 (BUG-709).

Task docs assigned 700-704; qizheng already took 700-703.
This commit is contained in:
jesse-ux
2026-09-15 17:10:53 +08:00
parent d3a2c48ba5
commit f51e494c5a
37 changed files with 799 additions and 177 deletions
+26 -1
View File
@@ -6,6 +6,7 @@ import { useRef } from "react";
import { showChatNotice as setComposerNotice } from "@/lib/chat-notice";
import { writeChatSession } from "@/lib/chat-session-write-contract";
import {
SESSION_LOOKUP_FAILED_NOTICE,
SESSION_MISSING_NOTICE,
parseSessionUrlQuery,
writeSessionUrl,
@@ -21,6 +22,7 @@ import {
fetchSessionDetail,
fetchSessions,
LoginRedirectError,
lookupSessionById,
mergeHydratedSession,
patchSessionModel,
readSessions,
@@ -405,7 +407,7 @@ export function useSessionManagement(params: SessionManagementParams) {
const query = parseSessionUrlQuery(search);
const fallbackId = listed[0]?.id ?? "";
const requestedId = query.sessionId;
if (query.present && (!requestedId || !listed.some((session) => session.id === requestedId))) {
if (query.present && !requestedId) {
writeSessionUrl(null, "replace");
sessionSelectionSource.current = "history";
if (fallbackId) selectSession(fallbackId);
@@ -413,6 +415,29 @@ export function useSessionManagement(params: SessionManagementParams) {
setComposerNotice(SESSION_MISSING_NOTICE);
return;
}
if (query.present && requestedId && !listed.some((session) => session.id === requestedId)) {
void lookupSessionById(requestedId, modelCatalog).then((looked) => {
if (looked.status === "found") {
setSessions((current) => mergeHydratedSession(current, looked.session));
sessionSelectionSource.current = "history";
selectSession(looked.session.id);
return;
}
if (looked.status === "missing") {
writeSessionUrl(null, "replace");
sessionSelectionSource.current = "history";
if (fallbackId) selectSession(fallbackId);
else setActiveSessionId("");
setComposerNotice(SESSION_MISSING_NOTICE);
return;
}
setComposerNotice(SESSION_LOOKUP_FAILED_NOTICE);
}).catch((caught) => {
if (caught instanceof LoginRedirectError) return;
setComposerNotice(SESSION_LOOKUP_FAILED_NOTICE);
});
return;
}
if (!requestedId) {
if (fallbackId) {
sessionSelectionSource.current = "history";