From 5326137670f95bf83f2b903848d0927c2882e4a8 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Tue, 10 Feb 2026 01:10:21 +0000 Subject: [PATCH] Validate bootstrap timeout configuration at startup Co-authored-by: Theo Browne --- apps/t3/src/runtimeApiServer.test.ts | 20 ++++++++++++++++++++ apps/t3/src/runtimeApiServer.ts | 6 ++++++ 2 files changed, 26 insertions(+) diff --git a/apps/t3/src/runtimeApiServer.test.ts b/apps/t3/src/runtimeApiServer.test.ts index 8a21d63cf2..bf1d23e211 100644 --- a/apps/t3/src/runtimeApiServer.test.ts +++ b/apps/t3/src/runtimeApiServer.test.ts @@ -203,6 +203,26 @@ describe("runtimeApiServer", () => { ).rejects.toThrow("Invalid launchCwd: expected directory path"); }); + it("rejects non-positive bootstrap timeout configuration", async () => { + await expect( + startRuntimeApiServer({ + port: 0, + launchCwd: process.cwd(), + bootstrapSessionTimeoutMs: 0, + }), + ).rejects.toThrow("Invalid bootstrapSessionTimeoutMs"); + }); + + it("rejects non-integer bootstrap timeout configuration", async () => { + await expect( + startRuntimeApiServer({ + port: 0, + launchCwd: process.cwd(), + bootstrapSessionTimeoutMs: 1.5, + }), + ).rejects.toThrow("Invalid bootstrapSessionTimeoutMs"); + }); + it("rejects empty auth token configuration", async () => { await expect( startRuntimeApiServer({ diff --git a/apps/t3/src/runtimeApiServer.ts b/apps/t3/src/runtimeApiServer.ts index 4187ade5de..fd73bbbd2c 100644 --- a/apps/t3/src/runtimeApiServer.ts +++ b/apps/t3/src/runtimeApiServer.ts @@ -348,6 +348,12 @@ export async function startRuntimeApiServer( } const bootstrapSessionTimeoutMs = options.bootstrapSessionTimeoutMs ?? BOOTSTRAP_SESSION_TIMEOUT_MS; + if ( + !Number.isInteger(bootstrapSessionTimeoutMs) || + bootstrapSessionTimeoutMs <= 0 + ) { + throw new Error("Invalid bootstrapSessionTimeoutMs: expected positive integer."); + } const providerManager = new ProviderManager(); const processManager = new ProcessManager(); const todoStore = new TodoStore(path.join(os.homedir(), ".t3", "todos.json"));