@@ -221,6 +221,7 @@ function resolveGatewayActionOptions(gateway?: MessageActionRunnerGateway) {
221221
222222const MESSAGE_ACTION_RECONCILIATION_TIMEOUT_MS = 60_000 ;
223223const MESSAGE_ACTION_RECONCILIATION_MAX_MS = 9 * 60_000 ;
224+ const MESSAGE_ACTION_INITIAL_SEND_TIMEOUT_MAX_MS = 30_000 ;
224225
225226async function callGatewayMessageAction < T > ( params : {
226227 gateway ?: MessageActionRunnerGateway ;
@@ -231,12 +232,18 @@ async function callGatewayMessageAction<T>(params: {
231232 await loadMessageActionGatewayRuntime ( ) ;
232233 const gateway = resolveGatewayActionOptions ( params . gateway ) ;
233234 const agentRuntimeIdentityToken = await params . gateway ?. resolveAgentRuntimeIdentityToken ?.( ) ;
235+ // A timed-out send is reattached with the same idempotency key. Cap only the
236+ // initial wait so the 9-minute join remains inside Codex's 10-minute tool envelope.
237+ const timeoutMs =
238+ params . actionParams . action === "send"
239+ ? Math . min ( gateway . timeoutMs , MESSAGE_ACTION_INITIAL_SEND_TIMEOUT_MAX_MS )
240+ : gateway . timeoutMs ;
234241 const call = {
235242 url : gateway . url ,
236243 token : gateway . token ,
237244 method : "message.action" ,
238245 params : params . actionParams ,
239- timeoutMs : gateway . timeoutMs ,
246+ timeoutMs,
240247 signal : params . abortSignal ,
241248 clientName : gateway . clientName ,
242249 clientDisplayName : gateway . clientDisplayName ,
0 commit comments