Skip to content

YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context

fix(meetings): keep completed summary visible (#6846)

Ezra Ellettefc5a65ffbfc7
diff --git a/apps/screenpipe-app-tauri/components/meeting-notes/meeting-workspace.test.tsx b/apps/screenpipe-app-tauri/components/meeting-notes/meeting-workspace.test.tsx
index 01efe96b3..fbd6a02fe 100644
--- a/apps/screenpipe-app-tauri/components/meeting-notes/meeting-workspace.test.tsx
+++ b/apps/screenpipe-app-tauri/components/meeting-notes/meeting-workspace.test.tsx
@@ -7,6 +7,7 @@ import { fireEvent, render, screen } from "@testing-library/react";
import { describe, expect, it, vi } from "vitest";
import {
extractMeetingSummary,
+ meetingSummarySaveIsVisible,
MEETING_QUIET_CONTROL_CLASS,
MEETING_READING_COLUMN_CLASS,
MEETING_SHELL_CLASS,
@@ -208,6 +209,33 @@ describe("meeting workspace tabs", () => {
});
describe("meeting summary surface", () => {
+ it("waits for the completed run's summary to be visible in the saved note", () => {
+ expect(meetingSummarySaveIsVisible("notes only", "notes only", true)).toBe(
+ false,
+ );
+ expect(
+ meetingSummarySaveIsVisible(
+ "## Summary\nEarlier summary.",
+ "## Summary\nEarlier summary.",
+ true,
+ ),
+ ).toBe(false);
+ expect(
+ meetingSummarySaveIsVisible(
+ "## Summary\nEarlier summary.",
+ "## Summary\nUpdated summary.",
+ true,
+ ),
+ ).toBe(true);
+ expect(
+ meetingSummarySaveIsVisible(
+ "## Summary\nAlready saved.",
+ "## Summary\nAlready saved.",
+ false,
+ ),
+ ).toBe(true);
+ });
+
it("uses the latest appended summary without including the user's notes", () => {
const onGenerate = vi.fn();
const note = [
@@ -359,7 +387,7 @@ describe("meeting summary surface", () => {
});
it("replaces the placeholder with the real summary as it streams", () => {
- render(
+ const { rerender } = render(
<MeetingSummarySurface
note={"## Summary\nEarlier summary."}
state="working"
@@ -380,6 +408,30 @@ describe("meeting summary surface", () => {
expect(screen.queryByText("Earlier summary.")).not.toBeInTheDocument();
expect(screen.getByRole("status")).toHaveTextContent("writing summary");
expect(screen.getByTestId("meeting-summary-stream-cursor")).toBeVisible();
+
+ rerender(
+ <MeetingSummarySurface
+ note={"## Summary\nEarlier summary."}
+ state="ready"
+ detail="saved to this meeting note"
+ streamedSummary="The team **approved** the launch."
+ onGenerate={vi.fn()}
+ canGenerate
+ />,
+ );
+
+ expect(
+ screen.getByText(
+ (_, element) =>
+ element?.textContent === "The team approved the launch.",
+ { selector: "p" },
+ ),
+ ).toBeVisible();
+ expect(screen.queryByText("Earlier summary.")).not.toBeInTheDocument();
+ expect(screen.queryByText("no summary yet")).not.toBeInTheDocument();
+ expect(
+ screen.queryByTestId("meeting-summary-stream-cursor"),
+ ).not.toBeInTheDocument();
});
it("turns a terminal usage limit into explicit upgrade and model recovery", async () => {
diff --git a/apps/screenpipe-app-tauri/components/meeting-notes/meeting-workspace.tsx b/apps/screenpipe-app-tauri/components/meeting-notes/meeting-workspace.tsx
index f1f6bcd6d..20fb22e8d 100644
--- a/apps/screenpipe-app-tauri/components/meeting-notes/meeting-workspace.tsx
+++ b/apps/screenpipe-app-tauri/components/meeting-notes/meeting-workspace.tsx
@@ -204,6 +204,15 @@ export interface MeetingSummaryRecovery {
};
}
+export function meetingSummarySaveIsVisible(
+ currentNote: string,
+ refreshedNote: string,
+ awaitedNewSummary: boolean,
+): boolean {
+ if (!extractMeetingSummary(refreshedNote)) return false;
+ return !awaitedNewSummary || refreshedNote !== currentNote;
+}
+
export function MeetingSummarySurface({
note,
state,
@@ -228,8 +237,15 @@ export function MeetingSummarySurface({
activity?: React.ReactNode;
}) {
const savedSummary = extractMeetingSummary(note);
- const isStreaming = state === "working" && Boolean(streamedSummary?.trim());
- const summary = isStreaming ? streamedSummary! : savedSummary;
+ const liveSummary = streamedSummary?.trim() || null;
+ // A Pipe run completes immediately after its final message, while the
+ // meeting-note PUT from that message can still be reaching the API. Keep
+ // the draft that was already on screen through that handoff instead of
+ // briefly replacing it with an older summary (or "no summary yet").
+ const showingLiveSummary =
+ Boolean(liveSummary) && (state === "working" || state === "ready");
+ const isStreaming = state === "working" && showingLiveSummary;
+ const summary = showingLiveSummary ? liveSummary : savedSummary;
const attention = state === "attention" ? recovery : undefined;
return (
diff --git a/apps/screenpipe-app-tauri/components/meeting-notes/note-view.tsx b/apps/screenpipe-app-tauri/components/meeting-notes/note-view.tsx
index 850291172..99886acf7 100644
--- a/apps/screenpipe-app-tauri/components/meeting-notes/note-view.tsx
+++ b/apps/screenpipe-app-tauri/components/meeting-notes/note-view.tsx
@@ -174,6 +174,7 @@ import {
} from "./meeting-summary-stream";
import {
extractMeetingSummary,
+ meetingSummarySaveIsVisible,
MEETING_QUIET_CONTROL_CLASS,
MEETING_READING_COLUMN_CLASS,
MEETING_RULE_ACTION_CLASS,
@@ -571,7 +572,8 @@ export function NoteView({
visibleSummaryLifecycle.kind === "running");
const summaryExecutionId =
visibleSummaryLifecycle.kind === "queued" ||
- visibleSummaryLifecycle.kind === "running"
+ visibleSummaryLifecycle.kind === "running" ||
+ visibleSummaryLifecycle.kind === "completed"
? visibleSummaryLifecycle.execution.id
: null;
const summaryExecutionIdRef = useRef<number | null>(summaryExecutionId);
@@ -717,35 +719,45 @@ export function NoteView({
});
}
}
- setSummaryLifecycle(next);
-
+ let summarySavePending = false;
if (
next.kind === "completed" &&
refreshedSummaryExecutionRef.current !== next.execution.id
) {
- refreshedSummaryExecutionRef.current = next.execution.id;
const meetingResponse = await localFetch(`/meetings/${meeting.id}`);
if (meetingResponse.ok && !cancelled) {
const updatedMeeting =
(await meetingResponse.json()) as MeetingRecord;
- if (
- summaryRevealPendingRef.current &&
- updatedMeeting.note !== meeting.note
- ) {
+ const saveIsVisible = meetingSummarySaveIsVisible(
+ meeting.note ?? "",
+ updatedMeeting.note ?? "",
+ summaryRevealPendingRef.current,
+ );
+ if (saveIsVisible) {
+ refreshedSummaryExecutionRef.current = next.execution.id;
summaryRevealPendingRef.current = false;
- setSummaryRevealKey((key) => key + 1);
+ if (updatedMeeting.note !== meeting.note) {
+ setSummaryRevealKey((key) => key + 1);
+ }
+ onSavedRef.current(updatedMeeting);
} else {
- summaryRevealPendingRef.current = false;
+ // Execution completion and the meeting-note write are separate
+ // observable operations. Retry the authoritative meeting read
+ // until the summary is actually there; marking this execution
+ // refreshed on the first stale read made the empty state stick.
+ summarySavePending = true;
}
- onSavedRef.current(updatedMeeting);
+ } else {
+ summarySavePending = true;
}
}
+ setSummaryLifecycle(next);
// Never stop: settling to idle used to end the poll, which is how a
// deleted Pipe or a late run stayed invisible until the note remounted.
pollHandle = setTimeout(
() => void poll(),
- summaryLifecycleIsWorking(next)
+ summarySavePending || summaryLifecycleIsWorking(next)
? SUMMARY_ACTIVE_POLL_MS
: SUMMARY_IDLE_POLL_MS,
);