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(onboarding): raise the engine ceiling above a real slow boot

Louis Beaumont29b71a2fedac
diff --git a/apps/screenpipe-app-tauri/components/onboarding/engine-startup.test.tsx b/apps/screenpipe-app-tauri/components/onboarding/engine-startup.test.tsx
index 38999123c..29a1876ea 100644
--- a/apps/screenpipe-app-tauri/components/onboarding/engine-startup.test.tsx
+++ b/apps/screenpipe-app-tauri/components/onboarding/engine-startup.test.tsx
@@ -351,6 +351,57 @@ describe("onboarding engine startup", () => {
}
});
+ // The ceiling exists to end a stall, not to cut off a slow-but-working boot.
+ // Observed in production: a macOS permission grant restarted the app, spawn
+ // never settled, and the engine came up at 114.9s. That must still count as a
+ // success, not a stuck screen.
+ it("waits out a slow but genuine boot instead of calling it stuck", async () => {
+ vi.useFakeTimers();
+ try {
+ let listening = false;
+ mocks.spawnScreenpipe.mockImplementation(() => new Promise(() => {}));
+ mocks.localFetch.mockImplementation(async () => {
+ if (!listening) throw new Error("Load failed");
+ return new Response(
+ JSON.stringify({
+ status: "healthy",
+ status_code: 200,
+ frame_status: "ok",
+ audio_status: "ok",
+ }),
+ { status: 200 },
+ );
+ });
+
+ render(<EngineStartup handleNextSlide={mocks.handleNextSlide} />);
+
+ // Stepped so the boot-phase poll can deliver and React can re-render
+ // between stuck-timer checks — a single jump leaves bootPhase null, which
+ // is not what a genuinely booting engine looks like.
+ for (let elapsed = 0; elapsed < 114900; elapsed += 5000) {
+ await act(async () => {
+ await vi.advanceTimersByTimeAsync(5000);
+ });
+ }
+ expect(mocks.capture).not.toHaveBeenCalledWith(
+ "onboarding_engine_stuck",
+ expect.anything(),
+ );
+
+ listening = true;
+ await act(async () => {
+ await vi.advanceTimersByTimeAsync(1000);
+ });
+
+ expect(mocks.capture).toHaveBeenCalledWith(
+ "onboarding_engine_started",
+ expect.any(Object),
+ );
+ } finally {
+ vi.useRealTimers();
+ }
+ });
+
// A user who gives up and closes the window used to be indistinguishable from
// one who never opened it, which is why the collapse produced no telemetry.
it("reports leaving the screen while the engine never came up", async () => {
diff --git a/apps/screenpipe-app-tauri/components/onboarding/engine-startup.tsx b/apps/screenpipe-app-tauri/components/onboarding/engine-startup.tsx
index 94018915b..202151dc0 100644
--- a/apps/screenpipe-app-tauri/components/onboarding/engine-startup.tsx
+++ b/apps/screenpipe-app-tauri/components/onboarding/engine-startup.tsx
@@ -48,7 +48,16 @@ const SPAWN_TIMEOUT_MS = 20000;
// phase that stalls never re-arms the timer. They sat on a spinner, gave up,
// and used the app from Home instead (95% reached Home, 69% sent a chat).
// Progress still buys time. It no longer buys forever.
-export const MAX_ENGINE_WAIT_MS = 120000;
+//
+// 120s was a judgement call with no data behind it, and production promptly
+// found its edge: a macOS user who granted Screen Recording mid-setup — which
+// restarts the app — had `spawn_screenpipe` never settle (spawn_timeout at
+// 20.1s), then reached `engine_started` at 114.9s and went on to complete setup
+// and reach the plan step. A legitimate recovery finished 5.1s inside the
+// ceiling. A ceiling that close to observed-good behaviour reports healthy
+// engines as stuck, so it sits comfortably above the worst legitimate case we
+// have actually seen rather than just above the ones we imagined.
+export const MAX_ENGINE_WAIT_MS = 180000;
// How long the health poll must fail continuously before it is worth reporting.
// The server binds only after the audio manager is built, so every poll before
// that fails by construction — the first real firing of the unreachable event