Files
Jyotisha/frontend/src/lib/chat-session-observability.ts
T
Jesse_Chen b6989c3eea
Independent Staging Quality Gate / validate (push) Has been cancelled
Independent Staging Quality Gate / publish (push) Has been cancelled
fix(chat): make the server the only writer of session messages
List GET no longer ships transcripts; consult appends questions after reserve and ignores client history so dual-tab last-write-wins cannot erase messages.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-01 19:51:19 +08:00

16 lines
534 B
TypeScript

import { createHash } from "node:crypto";
import { logAgentObservability } from "@/lib/agent-observability";
export function hashedUserId(userId: string): string {
return createHash("sha256").update(userId).digest("hex").slice(0, 16);
}
export function logIgnoredSessionMessages(sessionId: string, userId: string, messageCount: number): void {
logAgentObservability({
sessionId,
requestId: `compat-${hashedUserId(userId)}`,
errorCode: "compat_messages_ignored",
evidenceCount: Math.max(0, messageCount),
});
}