Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions agent/pipeline_runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,9 +200,11 @@ def build_meeting_result(state: dict) -> dict:
if pipeline_succeeded:
verdict = "GO"

score = scoring.get("final_score", 0)
if not score and isinstance(code_eval_result.get("match_rate"), (int, float)):
score = scoring.get("final_score")
if score is None and isinstance(code_eval_result.get("match_rate"), (int, float)):
score = code_eval_result.get("match_rate", 0)
if score is None:
score = 0

return {
"score": score,
Expand Down
11 changes: 10 additions & 1 deletion web/src/app/error.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,16 @@ export default function GlobalError({ error, reset }: { error: Error & { digest?
const isChunkError = message.includes("ChunkLoadError") || message.includes("Failed to load chunk");
if (!retriedRef.current && isChunkError) {
retriedRef.current = true;
window.location.reload();
try {
const reloadKey = "vibedeploy_chunk_reload_count";
const count = Number(sessionStorage.getItem(reloadKey) || "0");
if (count < 2) {
sessionStorage.setItem(reloadKey, String(count + 1));
window.location.reload();
}
} catch {
// sessionStorage unavailable (e.g., Safari private mode)
}
}
}, [error]);

Expand Down
10 changes: 7 additions & 3 deletions web/src/app/result/[id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,13 @@ export default function ResultPage() {
useEffect(() => {
let mounted = true;

getMeetingResult(params.id).then((next) => {
if (mounted) setResult(next);
});
getMeetingResult(params.id)
.then((next) => {
if (mounted) setResult(next);
})
.catch(() => {
if (mounted) setResult(null);
});

return () => {
mounted = false;
Expand Down
62 changes: 48 additions & 14 deletions web/src/components/brainstorm/brainstorm-view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,22 +87,56 @@ export function BrainstormView({ sessionId }: { sessionId: string }) {
);

useEffect(() => {
const stop = createSSEClient({
url: `${DASHBOARD_API_URL}/brainstorm`,
body: {
prompt: "Run brainstorm and stream all events.",
config: { configurable: { thread_id: sessionId } },
},
onEvent: handleEvent,
onComplete: () => {
let stopFn: (() => void) | undefined;
let cancelled = false;

// Check if result already exists (page refresh case)
getBrainstormResult(sessionId).then((existing) => {
if (cancelled) return;
if (existing) {
setResult(existing);
setStreamCompleted(true);
getBrainstormResult(sessionId).then((res) => {
if (res) setResult(res);
});
},
onError: (err) => setError(err.message),
return;
}

stopFn = createSSEClient({
url: `${DASHBOARD_API_URL}/brainstorm`,
body: {
prompt: "Run brainstorm and stream all events.",
config: { configurable: { thread_id: sessionId } },
},
onEvent: handleEvent,
onComplete: () => {
setStreamCompleted(true);
getBrainstormResult(sessionId).then((res) => {
if (res) setResult(res);
});
},
onError: (err) => setError(err.message),
});
}).catch(() => {
if (cancelled) return;
stopFn = createSSEClient({
url: `${DASHBOARD_API_URL}/brainstorm`,
body: {
prompt: "Run brainstorm and stream all events.",
config: { configurable: { thread_id: sessionId } },
},
onEvent: handleEvent,
onComplete: () => {
setStreamCompleted(true);
getBrainstormResult(sessionId).then((res) => {
if (res) setResult(res);
});
},
onError: (err) => setError(err.message),
});
});
Comment on lines +90 to 134
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The logic for initializing the SSE client is duplicated in both the success path (when no existing result is found) and the error path of the getBrainstormResult call. Refactoring this into a helper function within the useEffect would improve maintainability and reduce code duplication.

return stop;

return () => {
cancelled = true;
stopFn?.();
};
}, [handleEvent, sessionId]);

const synthesis = result?.synthesis;
Expand Down
61 changes: 42 additions & 19 deletions web/src/components/meeting/meeting-view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -152,26 +152,48 @@ export function MeetingView({ meetingId }: { meetingId: string }) {
}, []);

useEffect(() => {
const stop = createSSEClient({
url: `${DASHBOARD_API_URL}/run`,
body: {
prompt: "Run the council meeting and stream all events.",
config: { configurable: { thread_id: meetingId } },
},
onEvent: (event) => {
const tagged = { ...event, _uid: `mev-${++eventSeq.current}` };
setEvents((prev) => [...prev, tagged]);
handleEvent(event);
},
onComplete: () => {
setStreamCompleted(true);
setPhaseIndex(6);
setTimeout(() => router.push(`/result/${meetingId}`), 2000);
},
onError: (streamError) => setError(streamError.message),
});
let stopFn: (() => void) | undefined;
let cancelled = false;

(async () => {
// Check if result already exists (page refresh case)
try {
const { getMeetingResult } = await import("@/lib/api");
const existing = await getMeetingResult(meetingId);
if (existing && !cancelled) {
router.push(`/result/${meetingId}`);
return;
}
} catch {
// Result not found — proceed with new stream
}

if (cancelled) return;

stopFn = createSSEClient({
url: `${DASHBOARD_API_URL}/run`,
body: {
prompt: "Run the council meeting and stream all events.",
config: { configurable: { thread_id: meetingId } },
},
onEvent: (event) => {
const tagged = { ...event, _uid: `mev-${++eventSeq.current}` };
setEvents((prev) => [...prev, tagged]);
handleEvent(event);
},
onComplete: () => {
setStreamCompleted(true);
setPhaseIndex(6);
setTimeout(() => router.push(`/result/${meetingId}`), 2000);
},
onError: (streamError) => setError(streamError.message),
});
})();

return stop;
return () => {
cancelled = true;
stopFn?.();
};
}, [handleEvent, meetingId, router]);

useEffect(() => {
Expand Down Expand Up @@ -316,6 +338,7 @@ export function MeetingView({ meetingId }: { meetingId: string }) {
]
: ["All dimensions cleared. Proceed to build + deploy."]
}
onRevise={() => router.push("/")}
/>
</motion.div>
)}
Expand Down
7 changes: 7 additions & 0 deletions web/src/components/zero-prompt/zero-prompt-workspace.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export function ZeroPromptWorkspace({ initialSession, autostart = false }: { ini
isConnected,
isLoading,
hasLoadedDashboard,
error,
startSession,
queueBuild,
passCard,
Expand Down Expand Up @@ -85,6 +86,12 @@ export function ZeroPromptWorkspace({ initialSession, autostart = false }: { ini
</div>
</header>

{error && (
<div className="rounded-lg border border-red-500/30 bg-red-500/10 p-3 text-sm text-red-400">
{error}
</div>
)}

<StatusBar session={session} isConnected={isConnected} />

<KanbanBoard
Expand Down
34 changes: 17 additions & 17 deletions web/src/hooks/use-zero-prompt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ function applyEventToSession(prev: ZPSession | null, data: Record<string, unknow
card_id: cardId,
video_id: String(data.video_id || cardId),
title: stringifyValue(data.title) || stringifyValue(data.video_id) || cardId,
score: Number(data.score || 0),
score: Number(data.score ?? 0),
status: (String(data.status || "analyzing") as CardStatus),
reason: stringifyValue(data.reason),
reason_code: stringifyValue(data.reason_code),
Expand Down Expand Up @@ -245,22 +245,22 @@ function applyEventToSession(prev: ZPSession | null, data: Record<string, unknow
const merged: ZPCard = {
...current,
...nextPatch,
score: nextPatch.score || current.score,
reason: nextPatch.reason || current.reason,
reason_code: nextPatch.reason_code || current.reason_code,
score_breakdown: nextPatch.score_breakdown || current.score_breakdown,
domain: nextPatch.domain || current.domain,
papers_found: nextPatch.papers_found || current.papers_found,
competitors_found: nextPatch.competitors_found || current.competitors_found,
saturation: nextPatch.saturation || current.saturation,
novelty_boost: nextPatch.novelty_boost || current.novelty_boost,
analysis_step: nextPatch.analysis_step || current.analysis_step,
build_step: nextPatch.build_step || current.build_step,
build_phase: nextPatch.build_phase || current.build_phase,
build_node: nextPatch.build_node || current.build_node,
repo_url: nextPatch.repo_url || current.repo_url,
live_url: nextPatch.live_url || current.live_url,
thread_id: nextPatch.thread_id || current.thread_id,
score: nextPatch.score ?? current.score,
reason: nextPatch.reason ?? current.reason,
reason_code: nextPatch.reason_code ?? current.reason_code,
score_breakdown: nextPatch.score_breakdown ?? current.score_breakdown,
domain: nextPatch.domain ?? current.domain,
papers_found: nextPatch.papers_found ?? current.papers_found,
competitors_found: nextPatch.competitors_found ?? current.competitors_found,
saturation: nextPatch.saturation ?? current.saturation,
novelty_boost: nextPatch.novelty_boost ?? current.novelty_boost,
analysis_step: nextPatch.analysis_step ?? current.analysis_step,
build_step: nextPatch.build_step ?? current.build_step,
build_phase: nextPatch.build_phase ?? current.build_phase,
build_node: nextPatch.build_node ?? current.build_node,
repo_url: nextPatch.repo_url ?? current.repo_url,
live_url: nextPatch.live_url ?? current.live_url,
thread_id: nextPatch.thread_id ?? current.thread_id,
Comment on lines +248 to +263
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

While switching from || to ?? correctly allows a score of 0 to be preserved, it introduces a regression where fields missing from the event data will overwrite existing values with defaults (like 0 or ""). This happens because nextPatch is pre-filled with these defaults (e.g., score: Number(data.score || 0)). To avoid resetting existing data when an event only updates a subset of fields, you should only apply the patch for fields that are explicitly present in the data object.

Suggested change
score: nextPatch.score ?? current.score,
reason: nextPatch.reason ?? current.reason,
reason_code: nextPatch.reason_code ?? current.reason_code,
score_breakdown: nextPatch.score_breakdown ?? current.score_breakdown,
domain: nextPatch.domain ?? current.domain,
papers_found: nextPatch.papers_found ?? current.papers_found,
competitors_found: nextPatch.competitors_found ?? current.competitors_found,
saturation: nextPatch.saturation ?? current.saturation,
novelty_boost: nextPatch.novelty_boost ?? current.novelty_boost,
analysis_step: nextPatch.analysis_step ?? current.analysis_step,
build_step: nextPatch.build_step ?? current.build_step,
build_phase: nextPatch.build_phase ?? current.build_phase,
build_node: nextPatch.build_node ?? current.build_node,
repo_url: nextPatch.repo_url ?? current.repo_url,
live_url: nextPatch.live_url ?? current.live_url,
thread_id: nextPatch.thread_id ?? current.thread_id,
score: data.score !== undefined ? nextPatch.score : current.score,
reason: data.reason !== undefined ? nextPatch.reason : current.reason,
reason_code: data.reason_code !== undefined ? nextPatch.reason_code : current.reason_code,
score_breakdown: data.score_breakdown !== undefined ? nextPatch.score_breakdown : current.score_breakdown,
domain: data.domain !== undefined ? nextPatch.domain : current.domain,
papers_found: data.papers_found !== undefined ? nextPatch.papers_found : current.papers_found,
competitors_found: data.competitors_found !== undefined ? nextPatch.competitors_found : current.competitors_found,
saturation: data.saturation !== undefined ? nextPatch.saturation : current.saturation,
novelty_boost: data.novelty_boost !== undefined ? nextPatch.novelty_boost : current.novelty_boost,
analysis_step: data.analysis_step !== undefined ? nextPatch.analysis_step : current.analysis_step,
build_step: data.build_step !== undefined ? nextPatch.build_step : current.build_step,
build_phase: data.build_phase !== undefined ? nextPatch.build_phase : current.build_phase,
build_node: data.build_node !== undefined ? nextPatch.build_node : current.build_node,
repo_url: data.repo_url !== undefined ? nextPatch.repo_url : current.repo_url,
live_url: data.live_url !== undefined ? nextPatch.live_url : current.live_url,
thread_id: data.thread_id !== undefined ? nextPatch.thread_id : current.thread_id,

};

const cards = [...prev.cards];
Expand Down