Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

serve: read a bare OMB_SERVE_READY_TIMEOUT_MS as milliseconds, and keep the name server-only

milind-sonif5cd7ee42177
diff --git a/server/bot-box/env.test.ts b/server/bot-box/env.test.ts
index 94134f64ac..9b587e404b 100644
--- a/server/bot-box/env.test.ts
+++ b/server/bot-box/env.test.ts
@@ -46,7 +46,7 @@ const SERVER_ONLY_OMB: ReadonlySet<string> = new Set([
"OMB_OPENAI_IMAGE_KEY", "OMB_OPENAI_LIVE_KEY", "OMB_OPENAI_LIVE_URL", "OMB_OPENROUTER_API_KEY",
"OMB_OPENROUTER_DECIDER_KEY", "OMB_OWN_MCP_HTTP", "OMB_SESSION_TOOL_BUDGET", "OMB_PERSON_FIRST_MS", "OMB_PHONE_PUSH", "OMB_PHONE_RELAY", "OMB_PHONE_RELAY_URL", "OMB_PHONE_SECRET_PUBLIC_KEY", "OMB_PODMAN_SERVICE", "OMB_PORT", "OMB_SERVES_TUNNEL", "OMB_POSTIZ_API_KEY",
"OMB_POSTIZ_CLOUD_URL", "OMB_PROCESS_ID", "OMB_PUBLIC_IPV4", "OMB_PUBLIC_URL", "OMB_PUSH_CREDENTIAL", "OMB_QUOTA_SWITCH",
- "OMB_REPLAY_TOOL_HISTORY", "OMB_ROOM_SESSIONS", "OMB_SAFETY_FLOOR", "OMB_SERVER_COMPILE_CACHE", "OMB_SERVER_NAME",
+ "OMB_REPLAY_TOOL_HISTORY", "OMB_ROOM_SESSIONS", "OMB_SAFETY_FLOOR", "OMB_SERVE_READY_TIMEOUT_MS", "OMB_SERVER_COMPILE_CACHE", "OMB_SERVER_NAME",
"OMB_SERVER_UPDATE_DIR",
"OMB_SESSION_IDLE_MIN_MS", "OMB_SESSION_IDLE_MS", "OMB_SESSION_MAX_DAYS", "OMB_SESSION_TTL_DAYS",
"OMB_SHARED_WORKSPACE_FULL_ACCESS", "OMB_SIGNIN_EMAILS", "OMB_SIGNIN_MEMBER_EMAILS", "OMB_SIGNIN_SMTP_FROM",
diff --git a/server/cli.test.ts b/server/cli.test.ts
index 92e8fa115e..57a6eea620 100644
--- a/server/cli.test.ts
+++ b/server/cli.test.ts
@@ -705,5 +705,7 @@ describe("serve readiness wait", () => {
expect(serveReadyTimeoutMs({ OMB_SERVE_READY_TIMEOUT_MS: "nonsense" })).toBe(60_000);
expect(serveReadyTimeoutMs({ OMB_SERVE_READY_TIMEOUT_MS: "1s" })).toBe(60_000);
expect(serveReadyTimeoutMs({ OMB_SERVE_READY_TIMEOUT_MS: " 5m " })).toBe(300_000);
+ expect(serveReadyTimeoutMs({ OMB_SERVE_READY_TIMEOUT_MS: "120000" })).toBe(120_000);
+ expect(serveReadyTimeoutMs({ OMB_SERVE_READY_TIMEOUT_MS: "90" })).toBe(60_000);
});
});
diff --git a/server/headless/args.ts b/server/headless/args.ts
index 13a6f6a129..3535072642 100644
--- a/server/headless/args.ts
+++ b/server/headless/args.ts
@@ -264,10 +264,11 @@ export function oneOf<T extends string>(raw: string | undefined, name: string, a
}
/** How long `serve` waits for the server's HTTP health before giving up: `OMB_SERVE_READY_TIMEOUT_MS`,
- * else 60s. An unreadable value keeps the default; a machine with a cold start needs this without a rebuild. */
+ * else 60s. A bare number is milliseconds, as the name says; `5m` and the like also read. An unreadable value keeps
+ * the default; a machine with a cold start needs this without a rebuild. */
export function serveReadyTimeoutMs(env: NodeJS.ProcessEnv): number {
const raw = env.OMB_SERVE_READY_TIMEOUT_MS?.trim();
if (!raw) return 60_000;
- try { return parseDuration(raw, "OMB_SERVE_READY_TIMEOUT_MS", { min: 5_000, max: 3_600_000 }); }
+ try { return parseDuration(/^\d+$/.test(raw) ? `${raw}ms` : raw, "OMB_SERVE_READY_TIMEOUT_MS", { min: 5_000, max: 3_600_000 }); }
catch { return 60_000; }
}