feat(FN-5389): add resume event instrumentation with SSE, hooks, and diagno

FN-5389 adds dashboard resume event instrumentation: a `resumeInstrumentation` utility captures SSE resume signals, wired through `useChat`, `useChatRooms`, and `useTasks` hooks, with remount markers in `Board` and `ChatView`; diagnostics routes expose resume events for observability, documented in

Fusion-Task-Id: FN-5389
This commit is contained in:
Fusion (runfusion.ai)
2026-05-20 19:55:46 -07:00
committed by gsxdsm
parent 12582414da
commit 1913cb59fe
16 changed files with 885 additions and 4 deletions

View File

@@ -45,6 +45,7 @@ import { useMobileScrollLock } from "../hooks/useMobileScrollLock";
import { matchesAgentMentionFilter } from "./mentionMatching";
import { useNavigationHistoryContext } from "../hooks/useNavigationHistory";
import { linkifyFilePaths, linkifyReactChildren } from "../utils/filePathLinkify";
import { recordResumeEvent } from "../utils/resumeInstrumentation";
export interface ChatViewProps {
projectId?: string;
@@ -55,6 +56,7 @@ export interface ChatViewProps {
// Keep a generous cap so pasted multi-paragraph text stays visible while
// still preventing the composer from overtaking the message pane on short viewports.
const CHAT_INPUT_MAX_HEIGHT_PX = 640;
let chatViewWasPreviouslyInactive = false;
export function clampChatInputHeight(scrollHeight: number): number {
// Floor matches QuickChat (clampQuickChatInputHeight) and the CSS min-height,
@@ -889,6 +891,26 @@ const ChatMessageItem = memo(function ChatMessageItem({
});
export function ChatView({ projectId, addToast, experimentalFeatures }: ChatViewProps) {
useEffect(() => {
recordResumeEvent({
view: "ChatView",
trigger: chatViewWasPreviouslyInactive ? "route-active" : "remount",
projectId,
replayAttempted: false,
});
chatViewWasPreviouslyInactive = false;
return () => {
chatViewWasPreviouslyInactive = true;
recordResumeEvent({
view: "ChatView",
trigger: "route-inactive",
projectId,
replayAttempted: false,
});
};
}, [projectId]);
const {
activeSession,
sessionsLoading,