fix(FN-834): fix branch prefix drift, add merger branch guard, and fix test OOM
- Fix resolveBaseBranch to use stored branch name and consistent fusion/ prefix for both explicit deps and blockedBy paths (was using kb/ for blockedBy) - Add main branch checkout verification in merger before squash merge to prevent feature code from landing on wrong branch lineage - Align all branch prefix references from stale kb/ to fusion/ across executor, merger, store, and routes - Fix executor test OOM by mocking merger fully, adding fake timers to retry tests, and switching vitest pool to vmThreads - Update all test assertions to use fusion/ branch prefix Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
43
packages/dashboard/app/hooks/useLiveTranscript.ts
Normal file
43
packages/dashboard/app/hooks/useLiveTranscript.ts
Normal file
@@ -0,0 +1,43 @@
|
||||
import { useState, useEffect, useRef } from "react";
|
||||
|
||||
/** Log entry from an agent's execution stream */
|
||||
export interface TranscriptEntry {
|
||||
type: string;
|
||||
content: string;
|
||||
timestamp?: string;
|
||||
}
|
||||
|
||||
export function useLiveTranscript(taskId: string | undefined) {
|
||||
const [entries, setEntries] = useState<TranscriptEntry[]>([]);
|
||||
const [isConnected, setIsConnected] = useState(false);
|
||||
const esRef = useRef<EventSource | null>(null);
|
||||
|
||||
useEffect(() => {
|
||||
if (!taskId) {
|
||||
setEntries([]);
|
||||
setIsConnected(false);
|
||||
return;
|
||||
}
|
||||
|
||||
const es = new EventSource(`/api/tasks/${encodeURIComponent(taskId)}/logs/stream`);
|
||||
esRef.current = es;
|
||||
|
||||
es.addEventListener("agent:log", (event) => {
|
||||
try {
|
||||
const entry = JSON.parse(event.data) as TranscriptEntry;
|
||||
setEntries(prev => [entry, ...prev]);
|
||||
} catch { /* skip */ }
|
||||
});
|
||||
|
||||
es.addEventListener("open", () => setIsConnected(true));
|
||||
es.addEventListener("error", () => setIsConnected(false));
|
||||
|
||||
return () => {
|
||||
es.close();
|
||||
esRef.current = null;
|
||||
setIsConnected(false);
|
||||
};
|
||||
}, [taskId]);
|
||||
|
||||
return { entries, isConnected };
|
||||
}
|
||||
Reference in New Issue
Block a user