fix(consult): drop traces, budget checkpoints, silent summary inherit
Independent Staging Quality Gate / validate (push) Canceled after 3m8s
Independent Staging Quality Gate / publish (push) Canceled after 0s

BUG-729: dropped history rounds leave an omission marker in the model-visible summary slot.
BUG-730: checkpoint threshold is 0.4 of historyBudgetChars (128k still 16,000).
BUG-731: session_full new chat copies owned context_summary on the server; clients send only continued_from_session_id.
This commit is contained in:
jesse-ux
2026-09-16 07:38:36 +08:00
parent e61535f464
commit 149e1ec4c3
18 changed files with 451 additions and 31 deletions
@@ -59,6 +59,7 @@ export const chatSessionCreateSchema = z.object({
messages: z.array(chatMessageSchema).max(0),
session_type: z.enum(["consultation", "birth_time_rectification"]),
rectification_case_id: z.string().uuid().nullable(),
continued_from_session_id: z.string().uuid().optional(),
...chartBindingSchema,
updated_at: z.string().datetime().optional(),
}).strict();
@@ -148,11 +149,41 @@ export type ChatSessionCreate = Readonly<{
messages: readonly [];
session_type: "consultation" | "birth_time_rectification";
rectification_case_id: string | null;
continued_from_session_id?: string;
chart_profile_id?: string | null;
chart_profile_name?: string | null;
chart_profile_role?: "self" | "other" | null;
}>;
export type ChatSessionCreateInsertValues = Readonly<{
title: string;
theme: ConsultationDomain;
model_id: string;
messages: readonly unknown[];
session_type: "consultation" | "birth_time_rectification";
rectification_case_id: string | null;
chart_profile_id?: string | null;
chart_profile_name?: string | null;
chart_profile_role?: "self" | "other" | null;
}>;
export function chatSessionCreateInsertRow(input: {
id: string;
userId: string;
values: ChatSessionCreateInsertValues;
inheritedSummary?: unknown;
updatedAt: string;
}): Record<string, unknown> {
const row: Record<string, unknown> = {
id: input.id,
user_id: input.userId,
...input.values,
updated_at: input.updatedAt,
};
if (input.inheritedSummary) row.context_summary = input.inheritedSummary;
return row;
}
export type ChatSessionWrite = Readonly<{
title: string;
theme: ConsultationDomain;