fix: finalize session after memory promotion
This commit is contained in:
@@ -177,9 +177,13 @@ export function AppShell() {
|
||||
// stopSession already does, and this effect must stay side-effect-free on the
|
||||
// backend if the session is already inactive.
|
||||
useEffect(() => {
|
||||
if (lastSystemEvent?.type === "system_event" && (lastSystemEvent as any).event === "session_exit") {
|
||||
stopSession();
|
||||
}
|
||||
if (lastSystemEvent?.type !== "system_event") return;
|
||||
const ev = (lastSystemEvent as any).event;
|
||||
if (ev === "session_exit") stopSession();
|
||||
// The final workflow turn ends with the session already finalized on disk:
|
||||
// refetch now instead of waiting for the 10s poll, so the completed state
|
||||
// (and the new-session invite below the transcript) appears immediately.
|
||||
if (ev === "agent_end") refresh();
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [lastSystemEvent]);
|
||||
|
||||
@@ -241,6 +245,17 @@ export function AppShell() {
|
||||
<>
|
||||
<CentralStatus working={working} />
|
||||
<WidgetHost sessionId={activeSessionId} />
|
||||
{finalized && !agentActive && (
|
||||
<div className="rounded-2xl border border-border/80 bg-card p-5 text-center shadow-md">
|
||||
<p className="text-sm text-muted-foreground">
|
||||
Session completed and finalized — the SQL and all phase
|
||||
documents are saved.
|
||||
</p>
|
||||
<Button className="mt-3" onClick={startNewSession}>
|
||||
Start a new question
|
||||
</Button>
|
||||
</div>
|
||||
)}
|
||||
</>
|
||||
) : (
|
||||
<EmptyState />
|
||||
|
||||
Reference in New Issue
Block a user