Files
fusion/packages/dashboard/app/utils/dashboardTraceBuffer.ts
Fusion (runfusion.ai) ef5dd7ba25 feat(FN-5435): reset fallback retry counter on success in reviewer
Adds a fallback retry counter to the reviewer that resets on successful step completion, preventing premature escalation when earlier steps exhaust retries while later ones succeed; also aligns dashboard trace buffer types and adds comprehensive coverage for the reset semantics.

Fusion-Task-Id: FN-5435
2026-05-21 08:43:57 -07:00

55 lines
1.0 KiB
TypeScript

export type TraceEntry = {
ts: string;
source: string;
event: string;
detail: Record<string, unknown>;
};
const TRACE_CAP = 200;
const traces: TraceEntry[] = [];
export function pushTrace(source: string, event: string, detail: Record<string, unknown>): void {
traces.push({
ts: new Date().toISOString(),
source,
event,
detail,
});
if (traces.length > TRACE_CAP) {
traces.splice(0, traces.length - TRACE_CAP);
}
}
export function getTraces(): TraceEntry[] {
return [...traces];
}
export function clearTraces(): void {
traces.length = 0;
}
declare global {
interface Window {
__fusionDebug?: {
dashboardTraces?: {
get: () => unknown[];
clear: () => void;
};
resumeInstrumentation?: {
get: () => unknown[];
clear: () => void;
setEnabled: (nextEnabled: boolean) => void;
};
};
}
}
if (typeof window !== "undefined") {
window.__fusionDebug ??= {};
window.__fusionDebug.dashboardTraces = {
get: getTraces,
clear: clearTraces,
};
}