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(activity): classify no-data outcomes

Louis Beaumont7f3570dcd682
diff --git a/apps/screenpipe-app-tauri/components/activity-ledger.test.tsx b/apps/screenpipe-app-tauri/components/activity-ledger.test.tsx
index b68ee45b2..e02580502 100644
--- a/apps/screenpipe-app-tauri/components/activity-ledger.test.tsx
+++ b/apps/screenpipe-app-tauri/components/activity-ledger.test.tsx
@@ -1667,6 +1667,20 @@ describe("ActivityLedger", () => {
);
expect(mocks.runDailySummaryWithPi).not.toHaveBeenCalled();
expect(screen.getByRole("button", { name: "Try again" })).toBeVisible();
+ expect(mocks.posthogCapture).toHaveBeenCalledWith(
+ "activity_generation_completed",
+ {
+ range: "today",
+ source: "empty_state",
+ outcome: "no_activity",
+ activity_count: 0,
+ data_status: "empty_but_recording",
+ },
+ );
+ expect(mocks.posthogCapture).not.toHaveBeenCalledWith(
+ "activity_generation_failed",
+ expect.anything(),
+ );
});
it("keeps a slow backend generation running past two minutes", async () => {
diff --git a/apps/screenpipe-app-tauri/components/activity-ledger.tsx b/apps/screenpipe-app-tauri/components/activity-ledger.tsx
index 396b9c83d..224346883 100644
--- a/apps/screenpipe-app-tauri/components/activity-ledger.tsx
+++ b/apps/screenpipe-app-tauri/components/activity-ledger.tsx
@@ -1641,11 +1641,21 @@ export function ActivityLedger({
? quota.message
: "History could not be updated. Try again.",
);
- posthog.capture("activity_generation_failed", {
- range: preset,
- source,
- error_kind: qualityFailure ? "quality_validation" : quota.kind,
- });
+ if (noDataStatus) {
+ posthog.capture("activity_generation_completed", {
+ range: preset,
+ source,
+ outcome: "no_activity",
+ activity_count: 0,
+ data_status: noDataStatus,
+ });
+ } else {
+ posthog.capture("activity_generation_failed", {
+ range: preset,
+ source,
+ error_kind: qualityFailure ? "quality_validation" : quota.kind,
+ });
+ }
} finally {
if (historyAbortRef.current === controller) {
historyLoadingRef.current = false;