Skip to content

Supercharge your AI agents with data from the web and beyond. Building the library for superintelligence. 🔥

feat: add configurable harness startup timeout (#2560)

tomae25cfaa676d
diff --git a/apps/api/src/config.ts b/apps/api/src/config.ts
index 504967514..9afb016ea 100644
--- a/apps/api/src/config.ts
+++ b/apps/api/src/config.ts
@@ -97,6 +97,9 @@ const configSchema = z.object({
EXTRACT_WORKER_PORT: z.coerce.number().default(3004),
NUQ_WAIT_MODE: z.string().optional(),
+ // Harness Configuration
+ HARNESS_STARTUP_TIMEOUT_MS: z.coerce.number().default(60000),
+
// Job & Lock Management
JOB_LOCK_EXTEND_INTERVAL: z.coerce.number().default(10000),
JOB_LOCK_EXTENSION_TIME: z.coerce.number().default(60000),
diff --git a/apps/api/src/harness.ts b/apps/api/src/harness.ts
index a3b43697b..12d944c8b 100644
--- a/apps/api/src/harness.ts
+++ b/apps/api/src/harness.ts
@@ -161,7 +161,7 @@ function waitForPort(
options: { signal?: AbortSignal; timeoutMs?: number } = {},
): Promise<void> {
return new Promise((resolve, reject) => {
- const { signal, timeoutMs = 30000 } = options;
+ const { signal, timeoutMs = config.HARNESS_STARTUP_TIMEOUT_MS } = options;
let settled = false;
let retryTimer: NodeJS.Timeout | null = null;
@@ -455,7 +455,7 @@ async function startNuqPostgresContainer(
async function waitForPostgres(
host: string,
port: number,
- timeoutMs: number = 30000,
+ timeoutMs: number = config.HARNESS_STARTUP_TIMEOUT_MS,
): Promise<void> {
logger.info("Waiting for PostgreSQL to be ready...");
const start = Date.now();