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
Rust agentsagiaiai-memoryaudio-recordingcomputer-visionhermeshermes-agentllmlocal-ailocal-firstmachine-learningmcpmultimodalopenclawprivacyrewindscreen-recordingspeech-to-textycombinator
fix meeting summary limit recovery (#6618)
Louis Beaumontb4b0bc943aa9
diff --git a/apps/screenpipe-app-tauri/components/meeting-notes/meeting-summary-lifecycle.test.ts b/apps/screenpipe-app-tauri/components/meeting-notes/meeting-summary-lifecycle.test.tsindex 92f53478d..5fc4d62bb 100644--- a/apps/screenpipe-app-tauri/components/meeting-notes/meeting-summary-lifecycle.test.ts+++ b/apps/screenpipe-app-tauri/components/meeting-notes/meeting-summary-lifecycle.test.ts@@ -262,7 +262,7 @@ describe("meeting summary lifecycle", () => {status: "failed",error_type: "daily_limit",});- expect(copy).toContain("usage limit is reached");+ expect(copy).toContain("AI usage limit");expect(copy).toContain("Your meeting and transcript are safe");});});@@ -281,6 +281,7 @@ describe("meetingSummaryFailure", () => {it("tells the user rate limits are transient and retryable", () => {const failure = meetingSummaryFailure(failed("rate_limited"));expect(failure.kind).toBe("rate_limit");+ expect(failure.title).toBe("AI is temporarily rate-limited");expect(failure.retryable).toBe(true);expect(failure.copy).toContain("rate-limited");expect(failure.upgrade).toBeNull();@@ -294,8 +295,10 @@ describe("meetingSummaryFailure", () => {]) {const failure = meetingSummaryFailure(failed(errorType));expect(failure.retryable).toBe(false);+ expect(failure.title).toBe("AI usage limit reached");expect(failure.copy).toContain("usage limit");expect(failure.copy).toContain("Your meeting and transcript are safe");+ expect(failure.changeModelRecommended).toBe(true);}});@@ -326,6 +329,7 @@ describe("meetingSummaryFailure", () => {it("suggests switching models when the plan gates the model", () => {const failure = meetingSummaryFailure(failed("model_not_allowed"));expect(failure.kind).toBe("model_not_allowed");+ expect(failure.title).toBe("Summary model not included");expect(failure.retryable).toBe(false);expect(failure.copy.toLowerCase()).toContain("model");});@@ -335,6 +339,7 @@ describe("meetingSummaryFailure", () => {failed("auth_failed", "authentication failed — check API key"),);expect(failure.kind).toBe("auth_failed");+ expect(failure.title).toBe("AI provider needs attention");expect(failure.retryable).toBe(false);expect(failure.copy).toContain("AI provider");expect(failure.copy).toContain("API key");@@ -351,6 +356,7 @@ describe("meetingSummaryFailure", () => {it("keeps the reassuring generic copy for unknown failures", () => {const failure = meetingSummaryFailure(failed("network", "socket hang up"));expect(failure.retryable).toBe(true);+ expect(failure.changeModelRecommended).toBe(false);expect(failure.copy).toBe("Your meeting and transcript are safe. Retry when you're ready.",);diff --git a/apps/screenpipe-app-tauri/components/meeting-notes/meeting-summary-lifecycle.ts b/apps/screenpipe-app-tauri/components/meeting-notes/meeting-summary-lifecycle.tsindex c52ebcc75..e5b4da497 100644--- a/apps/screenpipe-app-tauri/components/meeting-notes/meeting-summary-lifecycle.ts+++ b/apps/screenpipe-app-tauri/components/meeting-notes/meeting-summary-lifecycle.ts@@ -172,11 +172,15 @@ export function latestSummaryInputAt(export interface MeetingSummaryFailurePresentation {kind: PipeErrorType | "auth_failed";+ /** Short, explicit heading for the persistent recovery surface. */+ title: string;copy: string;/** Validated plan-upgrade action when the gateway offered one. */upgrade: QuotaUpgradeAction | null;/** Whether "retry summary" is a sensible primary action for this failure. */retryable: boolean;+ /** Whether choosing another summary model is a useful recovery path. */+ changeModelRecommended: boolean;}/** Rust pipe classifier values (`pipes/mod.rs parse_error_type`) → UI types. */@@ -203,9 +207,11 @@ export function meetingSummaryFailure(if (authFailed) {return {kind: "auth_failed",- copy: "The summary couldn't authenticate with your AI provider. Check its API key or switch models, then retry. Your meeting and transcript are safe.",+ title: "AI provider needs attention",+ copy: "The configured summary model couldn't authenticate with its AI provider. Choose another model or check its API key. Your meeting and transcript are safe.",upgrade: null,retryable: false,+ changeModelRecommended: true,};}const kind =@@ -217,32 +223,40 @@ export function meetingSummaryFailure(case "rate_limit":return {kind,+ title: "AI is temporarily rate-limited",copy: "AI is temporarily rate-limited. Retry in a moment — your meeting and transcript are safe.",upgrade: null,retryable: true,+ changeModelRecommended: true,};case "daily_limit":case "credits_exhausted":case "quota_exhausted":return {kind,- copy: "Your AI usage limit is reached. Your meeting and transcript are safe — retry after it resets, upgrade, or switch to a local model or your own provider key.",+ title: "AI usage limit reached",+ copy: "The configured summary model hit your AI usage limit. Upgrade for a higher limit, or choose a local model or one with your own provider key. Your meeting and transcript are safe.",upgrade,retryable: false,+ changeModelRecommended: true,};case "model_not_allowed":return {kind,- copy: "Your plan can't use the configured AI model. Switch the preset to an included model, or upgrade. Your meeting and transcript are safe.",+ title: "Summary model not included",+ copy: "Your plan doesn't include the configured summary model. Choose an included model or upgrade. Your meeting and transcript are safe.",upgrade,retryable: false,+ changeModelRecommended: true,};default:return {kind,+ title: "Summary could not be generated",copy: "Your meeting and transcript are safe. Retry when you're ready.",upgrade: null,retryable: true,+ changeModelRecommended: false,};}}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.tsxindex af18268e6..a8dcb7196 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@@ -332,4 +332,100 @@ describe("meeting summary surface", () => {expect(screen.getByRole("status")).toHaveTextContent("writing summary");expect(screen.getByTestId("meeting-summary-stream-cursor")).toBeVisible();});++ it("turns a terminal usage limit into explicit upgrade and model recovery", async () => {+ const onGenerate = vi.fn();+ const onUpgrade = vi.fn();+ const onSelectModel = vi.fn();+ const onManage = vi.fn();+ render(+ <MeetingSummarySurface+ note="notes only"+ state="attention"+ detail="summary needs attention"+ onGenerate={onGenerate}+ canGenerate+ recovery={{+ title: "AI usage limit reached",+ detail:+ "The configured summary model has no usage left. Choose another model or upgrade.",+ retryable: false,+ upgrade: {+ label: "upgrade to business",+ onSelect: onUpgrade,+ },+ model: {+ selectedId: "cloud",+ selectedLabel: "screenpipe cloud · frontier",+ saving: false,+ options: [+ {+ id: "local",+ label: "local",+ detail: "ollama · llama 3.2",+ onSelect: onSelectModel,+ },+ ],+ onManage,+ },+ }}+ />,+ );++ const alert = screen.getByRole("alert");+ expect(alert).toHaveTextContent("AI usage limit reached");+ expect(alert).toHaveTextContent("configured summary model");+ expect(+ screen.getByText("Generation stopped before a summary was written."),+ ).toBeVisible();+ expect(screen.getAllByText(/configured summary model/i)).toHaveLength(1);+ expect(screen.queryByRole("button", { name: "retry" })).toBeNull();+ expect(screen.queryByText("no summary yet")).toBeNull();++ fireEvent.click(+ screen.getByRole("button", { name: "upgrade to business" }),+ );+ expect(onUpgrade).toHaveBeenCalledOnce();++ fireEvent.keyDown(+ screen.getByRole("button", { name: /change summary model/i }),+ { key: "Enter" },+ );+ const localModel = (await screen.findByText("local")).closest(+ '[role="menuitem"]',+ );+ expect(localModel).not.toBeNull();+ fireEvent.click(localModel!);+ expect(onSelectModel).toHaveBeenCalledOnce();++ fireEvent.keyDown(+ screen.getByRole("button", { name: /change summary model/i }),+ { key: "Enter" },+ );+ fireEvent.click(+ await screen.findByRole("menuitem", { name: "manage models & keys" }),+ );+ expect(onManage).toHaveBeenCalledOnce();+ });++ it("keeps retry available for a temporary rate limit", () => {+ const onGenerate = vi.fn();+ render(+ <MeetingSummarySurface+ note="notes only"+ state="attention"+ detail="summary needs attention"+ onGenerate={onGenerate}+ canGenerate+ recovery={{+ title: "AI is temporarily rate-limited",+ detail: "Retry in a moment.",+ retryable: true,+ }}+ />,+ );++ fireEvent.click(screen.getByRole("button", { name: "retry" }));+ expect(onGenerate).toHaveBeenCalledOnce();+ });});diff --git a/apps/screenpipe-app-tauri/components/meeting-notes/meeting-workspace.tsx b/apps/screenpipe-app-tauri/components/meeting-notes/meeting-workspace.tsxindex 932a5b838..59724c13b 100644--- a/apps/screenpipe-app-tauri/components/meeting-notes/meeting-workspace.tsx+++ b/apps/screenpipe-app-tauri/components/meeting-notes/meeting-workspace.tsx@@ -6,7 +6,14 @@import React from "react";import { MemoizedReactMarkdown } from "@/components/markdown";import { cn } from "@/lib/utils";-import { Loader2 } from "lucide-react";+import {+ DropdownMenu,+ DropdownMenuContent,+ DropdownMenuItem,+ DropdownMenuSeparator,+ DropdownMenuTrigger,+} from "@/components/ui/dropdown-menu";+import { AlertTriangle, Check, ChevronDown, Loader2 } from "lucide-react";export type MeetingWorkspaceTab = "notes" | "transcript" | "summary";@@ -156,6 +163,28 @@ export function extractMeetingSummary(markdown: string): string | null {return body || null;}+export interface MeetingSummaryRecovery {+ title: string;+ detail: string;+ retryable: boolean;+ upgrade?: {+ label: string;+ onSelect: () => void;+ };+ model?: {+ selectedId: string | null;+ selectedLabel: string;+ saving: boolean;+ options: Array<{+ id: string;+ label: string;+ detail: string;+ onSelect: () => void;+ }>;+ onManage: () => void;+ };+}+export function MeetingSummarySurface({note,state,@@ -163,6 +192,7 @@ export function MeetingSummarySurface({streamedSummary,onGenerate,canGenerate,+ recovery,activity,}: {note: string;@@ -171,6 +201,7 @@ export function MeetingSummarySurface({streamedSummary?: string;onGenerate: () => void;canGenerate: boolean;+ recovery?: MeetingSummaryRecovery;// Replay scrubber and the "related during this meeting" list. They are// evidence for the summary — what was on screen and open while it was// written — so they belong under it. Under the note editor they sat below a@@ -180,6 +211,7 @@ export function MeetingSummarySurface({const savedSummary = extractMeetingSummary(note);const isStreaming = state === "working" && Boolean(streamedSummary?.trim());const summary = isStreaming ? streamedSummary! : savedSummary;+ const attention = state === "attention" ? recovery : undefined;return (<section@@ -204,11 +236,17 @@ export function MeetingSummarySurface({/>)}<span>- {state === "working" ? "writing summary" : "meeting summary"}+ {state === "working"+ ? "writing summary"+ : "meeting summary"}</span></div><p className="mt-2 text-sm leading-6 text-muted-foreground">- {detail}+ {attention+ ? savedSummary+ ? "The existing summary is unchanged."+ : "Generation stopped before a summary was written."+ : detail}</p></div><div className="flex shrink-0 items-center gap-2">@@ -216,8 +254,8 @@ export function MeetingSummarySurface({the tab rule above. This header keeps only the action that isunique to the summary tab: producing one. */}{(state === "idle" ||- state === "attention" ||- state === "ready") && (+ state === "ready" ||+ (state === "attention" && attention?.retryable)) && (<buttontype="button"onClick={onGenerate}@@ -234,6 +272,99 @@ export function MeetingSummarySurface({</div></div>+ {attention && (+ <div+ role="alert"+ data-testid="meeting-summary-recovery"+ className="mb-8 border border-border bg-muted/30 p-5"+ >+ <div className="flex items-start gap-3">+ <AlertTriangle+ className="mt-0.5 h-4 w-4 shrink-0 text-amber-600 dark:text-amber-300"+ aria-hidden="true"+ />+ <div className="min-w-0 flex-1">+ <h2 className="font-mono text-xs uppercase tracking-[0.12em] text-foreground">+ {attention.title}+ </h2>+ <p className="mt-2 max-w-xl text-sm leading-6 text-muted-foreground">+ {attention.detail}+ </p>+ <div className="mt-4 flex flex-wrap items-center gap-2">+ {attention.upgrade && (+ <button+ type="button"+ data-testid="meeting-summary-upgrade-button"+ onClick={attention.upgrade.onSelect}+ className="h-9 border border-foreground bg-foreground px-3 font-mono text-[10px] uppercase tracking-[0.12em] text-background transition-colors hover:bg-background hover:text-foreground"+ >+ {attention.upgrade.label}+ </button>+ )}+ {attention.model && (+ <DropdownMenu>+ <DropdownMenuTrigger asChild>+ <button+ type="button"+ data-testid="meeting-summary-change-model"+ disabled={attention.model.saving}+ className="flex h-9 items-center gap-2 border border-border bg-background px-3 font-mono text-[10px] uppercase tracking-[0.12em] text-foreground transition-colors hover:border-foreground disabled:text-muted-foreground"+ >+ {attention.model.saving+ ? "changing model"+ : "change summary model"}+ <ChevronDown className="h-3 w-3" aria-hidden="true" />+ </button>+ </DropdownMenuTrigger>+ <DropdownMenuContent+ align="start"+ className="w-72 rounded-none"+ >+ <div className="border-b border-border px-2 py-2">+ <p className="font-mono text-[9px] uppercase tracking-[0.12em] text-muted-foreground">+ current summary model+ </p>+ <p className="mt-1 truncate text-xs text-foreground">+ {attention.model.selectedLabel}+ </p>+ </div>+ {attention.model.options.map((option) => (+ <DropdownMenuItem+ key={option.id}+ onSelect={option.onSelect}+ className="rounded-none"+ >+ <span className="flex min-w-0 flex-1 items-center gap-2">+ <span className="min-w-0 flex-1">+ <span className="block truncate text-xs">+ {option.label}+ </span>+ <span className="block truncate text-[10px] text-muted-foreground">+ {option.detail}+ </span>+ </span>+ {option.id === attention.model?.selectedId && (+ <Check className="h-3.5 w-3.5" aria-hidden="true" />+ )}+ </span>+ </DropdownMenuItem>+ ))}+ <DropdownMenuSeparator />+ <DropdownMenuItem+ onSelect={attention.model.onManage}+ className="rounded-none font-mono text-[10px] uppercase tracking-[0.1em]"+ >+ manage models & keys+ </DropdownMenuItem>+ </DropdownMenuContent>+ </DropdownMenu>+ )}+ </div>+ </div>+ </div>+ </div>+ )}+<divdata-testid="meeting-summary-reading-column"className={cn(MEETING_READING_COLUMN_CLASS, "select-text")}@@ -263,7 +394,7 @@ export function MeetingSummarySurface({The first section replaces this message as soon as it is ready.</p></div>- ) : (+ ) : state === "attention" ? null : (<div className="border-l border-border py-2 pl-5"><p className="text-sm font-medium text-foreground">no summary yetdiff --git a/apps/screenpipe-app-tauri/components/meeting-notes/note-view.tsx b/apps/screenpipe-app-tauri/components/meeting-notes/note-view.tsxindex 732552faa..3d7809971 100644--- a/apps/screenpipe-app-tauri/components/meeting-notes/note-view.tsx+++ b/apps/screenpipe-app-tauri/components/meeting-notes/note-view.tsx@@ -162,6 +162,7 @@ import {} from "./meeting-summary-lifecycle";import { QUOTA_PLAN_LABELS } from "@/lib/chat/quota-errors";import { openExternalUrl } from "@/lib/open-external-url";+import { openBusinessUpgradeSurface } from "@/lib/upgrade-flow";import { MeetingSummaryTransition } from "./meeting-summary-transition";import {advanceMeetingSummaryStream,@@ -481,7 +482,7 @@ export function NoteView({const handleSummaryPresetSelect = useCallback(async (preset: AIPreset | null) => {- if (!preset || summaryPresetSaving) return;+ if (!preset || summaryPresetSaving) return false;const previousPresetIds = summaryPresetIds;const optimisticPresetIds = [preset.id,@@ -502,6 +503,7 @@ export function NoteView({pipe_slug: summaryPipeSlug,provider: preset.provider,});+ return true;} catch (error) {setSummaryPresetIds(previousPresetIds);console.error("failed to save meeting summary model", error);@@ -510,6 +512,7 @@ export function NoteView({description: "your previous model is still selected.",variant: "destructive",});+ return false;} finally {setSummaryPresetSaving(false);}@@ -1697,10 +1700,35 @@ export function NoteView({: "notes and transcript saved locally",};})();- const summaryUpgrade =+ const summaryFailure =visibleSummaryLifecycle.kind === "failed"- ? meetingSummaryFailure(visibleSummaryLifecycle.execution).upgrade+ ? meetingSummaryFailure(visibleSummaryLifecycle.execution): null;+ const summaryUpgrade = summaryFailure?.upgrade ?? null;+ const handleSummaryUpgrade = useCallback(async () => {+ if (!summaryUpgrade) return;+ posthog.capture("meeting_summary_upgrade_clicked", {+ source: "meeting-summary-limit",+ target_plan: summaryUpgrade.requiredPlan,+ });+ try {+ // The native account surface owns the common Basic → Business offer.+ // Higher tiers and Basic have gateway-owned billing URLs whose exact+ // target cannot be represented by that one offer card.+ if (summaryUpgrade.requiredPlan === "business") {+ await openBusinessUpgradeSurface("meeting-summary-limit");+ } else {+ await openExternalUrl(summaryUpgrade.upgradeUrl);+ }+ } catch (error) {+ console.error("failed to open meeting summary upgrade", error);+ toast({+ title: "couldn't open upgrade options",+ description: "try again from Settings → Account.",+ variant: "destructive",+ });+ }+ }, [summaryUpgrade, toast]);// Notes and Summary now own their summary lifecycle in the reading area.// Repeating the same state in the footer made the page look like two jobs// were running. Transcript still gets the global footer because it has no@@ -2405,6 +2433,53 @@ export function NoteView({!retranscribing &&!summaryPresetSaving}+ recovery={+ summaryFailure+ ? {+ title: summaryFailure.title,+ detail: summaryFailure.copy,+ retryable: summaryFailure.retryable,+ upgrade: summaryUpgrade+ ? {+ label: `upgrade to ${QUOTA_PLAN_LABELS[+ summaryUpgrade.requiredPlan+ ].toLowerCase()}`,+ onSelect: () => void handleSummaryUpgrade(),+ }+ : undefined,+ model: summaryFailure.changeModelRecommended+ ? {+ selectedId: summaryPresetId,+ selectedLabel: summaryPreset+ ? `${summaryPreset.id} · ${summaryPreset.model}`+ : "no summary model selected",+ saving: summaryPresetSaving,+ options: summaryPresets+ .filter((preset) => preset.id !== summaryPresetId)+ .map((preset) => ({+ id: preset.id,+ label: preset.id,+ detail: `${preset.provider.replace(/-/g, " ")} · ${preset.model}`,+ onSelect: () => {+ void (async () => {+ const changed =+ await handleSummaryPresetSelect(preset);+ if (changed) await handleSummarize();+ })();+ },+ })),+ onManage: () => {+ window.dispatchEvent(+ new CustomEvent("open-settings", {+ detail: { section: "ai" },+ }),+ );+ },+ }+ : undefined,+ }+ : undefined+ }// Mounted with the tab rather than always: the strip pulls the// meeting's transcript rows and frame samples, and opening a// meeting to read notes or the transcript should not pay for@@ -2578,9 +2653,7 @@ export function NoteView({type="button"data-testid="meeting-summary-upgrade-link"className="underline underline-offset-2 transition-colors hover:text-foreground"- onClick={() =>- void openExternalUrl(summaryUpgrade.upgradeUrl)- }+ onClick={() => void handleSummaryUpgrade()}>upgrade to{" "}{QUOTA_PLAN_LABELS[diff --git a/docs/pr-assets/meeting-summary-limit-recovery/meeting-summary-limit-light.jpg b/docs/pr-assets/meeting-summary-limit-recovery/meeting-summary-limit-light.jpgnew file mode 100644index 000000000..bc7c472d6Binary files /dev/null and b/docs/pr-assets/meeting-summary-limit-recovery/meeting-summary-limit-light.jpg differdiff --git a/docs/pr-assets/meeting-summary-limit-recovery/meeting-summary-model-picker-dark.jpg b/docs/pr-assets/meeting-summary-limit-recovery/meeting-summary-model-picker-dark.jpgnew file mode 100644index 000000000..92e96c2baBinary files /dev/null and b/docs/pr-assets/meeting-summary-limit-recovery/meeting-summary-model-picker-dark.jpg differ