{"record":{"id":"020dbc0b4ea37109","repo":"jackwener/OpenCLI","slug":"timeout-waiting-for-antigravity-reply-after-time","errorCode":null,"errorMessage":"Timeout waiting for Antigravity reply after ${timeout / 1000}s","messagePattern":"Timeout waiting for Antigravity reply after (.+?)s","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"clis/antigravity/serve.js","lineNumber":338,"sourceCode":"                reconnectCount++;\n                console.error(`[serve] CDP session loss detected (${msg}), attempting to reconnect (${reconnectCount}/2)...`);\n                try {\n                    page = await opts.reconnect();\n                    // Reset stability tracking after reconnect\n                    stableCount = 0;\n                    lastText = beforeText;\n                    continue;\n                }\n                catch (reconnectErr) {\n                    console.error(`[serve] Reconnection failed: ${reconnectErr.message}`);\n                    throw err; // Throw original error if reconnection itself fails\n                }\n            }\n            throw err;\n        }\n        await sleep(pollInterval);\n    }\n    throw new Error(`Timeout waiting for Antigravity reply after ${timeout / 1000}s`);\n}\n// ─── Request Handlers ────────────────────────────────────────────────\nasync function handleMessages(body, page, opts = {}) {\n    const { bridge, timeout, reconnect } = opts;\n    // Extract the last user message\n    const userMessages = body.messages.filter(m => m.role === 'user');\n    if (userMessages.length === 0) {\n        throw new Error('No user message found in request');\n    }\n    const lastUserMsg = userMessages[userMessages.length - 1];\n    const userText = extractTextContent(lastUserMsg.content);\n    if (!userText.trim()) {\n        throw new Error('Empty user message');\n    }\n    // Optimization 1: New conversation if this is the first message in the session\n    if (body.messages.length === 1) {\n        console.error(`[serve] New session detected (1 message). Starting new conversation in UI.`);\n        await startNewConversation(page);","sourceCodeStart":320,"sourceCodeEnd":356,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/antigravity/serve.js#L320-L356","documentation":"waitForReply polls the Antigravity UI for a reply until the caller-supplied timeout elapses; if no reply is detected it throws with the timeout in seconds. The request was typed and Enter pressed, but the assistant response never appeared (or was never recognized) in time.","triggerScenarios":"waitForReply loops polling for the reply DOM/bridge signal; timeout expires and control reaches the final throw.","commonSituations":"timeout option set too low for a long agent response; Antigravity reply markup changed so the poller's detection selector never matches; Antigravity failed to respond (error shown in UI, rate limit, not signed in); the prompt never actually submitted (silent send failure); machine under heavy load slowing both reply and polling.","solutions":["Increase the timeout option for long-running agent requests","Verify the reply-detection selector still matches the current Antigravity DOM after updates","Check the Antigravity window for UI errors (auth, quota, crashed conversation) and retry","Confirm the message was actually submitted (input box emptied) before waiting","Retry the request; transient slowness often resolves on a second attempt"],"exampleFix":"// before\nawait handleMessages(body, page, { timeout: 30000 });\n// after\nawait handleMessages(body, page, { timeout: 120000 });","handlingStrategy":"retry","validationCode":"if (timeout < 60000) console.warn('timeout below 60s may be too short for agent replies');\nconst editorGone = await page.evaluate(() =>\n  document.querySelector('#antigravity.agentSidePanelInputBox [data-lexical-editor=\"true\"]')?.textContent === '');\nif (!editorGone) throw new Error('Message may not have been submitted');","typeGuard":null,"tryCatchPattern":"try {\n  const reply = await waitForReply(page, { timeout: 120000 });\n} catch (err) {\n  if (err.message.startsWith('Timeout waiting for Antigravity reply')) {\n    // check Antigravity UI for errors, then retry with longer timeout\n  } else throw err;\n}","preventionTips":["Use a generous timeout (2-5 min) for agent tasks","Verify the reply-detection selector after Antigravity updates","Confirm the prompt was submitted (input emptied) before waiting","Watch for auth/quota errors in the Antigravity window"],"tags":["timeout","polling","automation","antigravity"],"backgroundTag":"response-timeout","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}