Validate bootstrap timeout configuration at startup

Co-authored-by: Theo Browne <[email protected]>
This commit is contained in:
Cursor AgentandTheo Browne committed 2026-02-10 01:10:21 +00:00
1 parent a201790c40
commit 5326137670
2 files changed
+26

No files matched your search

+20
View File
@@ -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({
+6
View File
@@ -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"));