@@ -85,10 +85,7 @@ const GATEWAY_LIVE_PROBE_TIMEOUT_MS = Math.max(
8585 30_000 ,
8686 toInt ( process . env . OPENCLAW_LIVE_GATEWAY_STEP_TIMEOUT_MS , 90_000 ) ,
8787) ;
88- const GATEWAY_LIVE_SETUP_TIMEOUT_MS = Math . max (
89- 1_000 ,
90- toInt ( process . env . OPENCLAW_LIVE_GATEWAY_SETUP_TIMEOUT_MS , 60_000 ) ,
91- ) ;
88+ const GATEWAY_LIVE_SETUP_TIMEOUT_MS = resolveGatewayLiveSetupTimeoutMs ( ) ;
9289const GATEWAY_LIVE_MODEL_TIMEOUT_MS = resolveGatewayLiveModelTimeoutMs ( ) ;
9390const GATEWAY_LIVE_SESSION_CONTROL_TIMEOUT_MS = resolveGatewayLiveSessionControlTimeoutMs ( ) ;
9491const GATEWAY_LIVE_TRANSCRIPT_TIMEOUT_MS = resolveGatewayLiveTranscriptTimeoutMs ( ) ;
@@ -214,6 +211,12 @@ function toInt(value: string | undefined, fallback: number): number {
214211 return Number . isFinite ( parsed ) ? parsed : fallback ;
215212}
216213
214+ function resolveGatewayLiveSetupTimeoutMs (
215+ raw = process . env . OPENCLAW_LIVE_GATEWAY_SETUP_TIMEOUT_MS ,
216+ ) : number {
217+ return Math . max ( 1_000 , toInt ( raw , 180_000 ) ) ;
218+ }
219+
217220function resolveGatewayLiveMaxModels ( ) : number {
218221 const gatewayRaw = process . env . OPENCLAW_LIVE_GATEWAY_MAX_MODELS ?. trim ( ) ;
219222 if ( gatewayRaw ) {
@@ -755,6 +758,14 @@ describe("resolveGatewayLiveTranscriptTimeoutMs", () => {
755758} ) ;
756759
757760describe ( "gateway live timeout floors" , ( ) => {
761+ it ( "defaults setup budget above slow ARM model discovery" , ( ) => {
762+ expect ( resolveGatewayLiveSetupTimeoutMs ( "" ) ) . toBe ( 180_000 ) ;
763+ } ) ;
764+
765+ it ( "keeps explicit shorter setup budgets available for targeted probes" , ( ) => {
766+ expect ( resolveGatewayLiveSetupTimeoutMs ( "60000" ) ) . toBe ( 60_000 ) ;
767+ } ) ;
768+
758769 it ( "never goes below the probe timeout" , ( ) => {
759770 expect ( resolveGatewayLiveModelTimeoutMs ( "45000" , undefined , 90_000 ) ) . toBe ( 90_000 ) ;
760771 expect ( resolveGatewayLiveTranscriptTimeoutMs ( 240_000 , 180_000 ) ) . toBe ( 240_000 ) ;
0 commit comments