{"record":{"id":"b2daee1c4ce436fe","repo":"jackwener/OpenCLI","slug":"chatgpt-detail-b2daee","errorCode":null,"errorMessage":"chatgpt detail","messagePattern":"chatgpt detail","errorType":"exception","errorClass":"TimeoutError","httpStatus":null,"severity":"error","filePath":"clis/chatgpt/utils.js","lineNumber":1305,"sourceCode":"                            wantMarkdown,\n                            generating: false,\n                            stableSeconds: elapsedSeconds,\n                        }),\n                        generating: false,\n                    };\n                }\n            } else {\n                lastKey = key;\n                stableStartedAt = Date.now();\n            }\n        } else {\n            lastKey = key;\n            stableStartedAt = 0;\n        }\n        await page.sleep(3);\n    }\n\n    throw new TimeoutError(\n        'chatgpt detail',\n        timeoutSeconds,\n        'Conversation did not finish or stabilize before timeout. Re-run with a higher --timeout if it is still generating.',\n    );\n}\n\nfunction normalizeDeepResearchText(value) {\n    return String(value || '')\n        .replace(/\\u00a0/g, ' ')\n        .replace(/[ \\t]+\\n/g, '\\n')\n        .replace(/\\n{3,}/g, '\\n\\n')\n        .trim();\n}\n\nfunction looksLikeDeepResearchReport(text) {\n    const normalized = normalizeDeepResearchText(text);\n    if (normalized.length < 500) return false;\n    return /(^|\\n)\\s*#{1,3}\\s+\\S|Sources|References|参考|来源|结论|建议|Executive Summary|摘要/i.test(normalized);","sourceCodeStart":1287,"sourceCodeEnd":1323,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/chatgpt/utils.js#L1287-L1323","documentation":"The chatgpt conversation-detail/wait routine polls the page for the conversation to finish and reach a stable state (unchanged lastKey for the stability window). If it does not stabilize within timeoutSeconds, a TimeoutError is thrown with a hint to raise --timeout.","triggerScenarios":"Calling a chatgpt command that waits for a completed/stable conversation while the model is still generating a long response, the stream stalls, the session is rate-limited or logged out mid-run, or the stability detection key keeps changing due to live UI updates.","commonSituations":"Very long generations exceeding the default --timeout; slow network or throttled account; ChatGPT UI showing a captcha/login prompt so the conversation never progresses; polling a conversation that keeps auto-updating.","solutions":["Re-run with a higher --timeout value, as the error hint suggests","Check the ChatGPT session is still logged in and not blocked by captcha/rate limits","Retry on a more stable network connection","If the conversation is genuinely stuck, send a new message to unstick it before re-running"],"exampleFix":"// before\nopencli chatgpt read --url 'https://chatgpt.com/c/abc' --timeout 30\n// after\nopencli chatgpt read --url 'https://chatgpt.com/c/abc' --timeout 120","handlingStrategy":"retry","validationCode":"if (typeof timeoutSeconds !== 'number' || timeoutSeconds < 60) {\n  timeoutSeconds = 120; // long generations need headroom\n}","typeGuard":null,"tryCatchPattern":"try {\n  const detail = await getChatGPTDetail(page, { timeoutSeconds: 120 });\n} catch (err) {\n  if (err instanceof TimeoutError && err.operation === 'chatgpt detail') {\n    const detail = await getChatGPTDetail(page, { timeoutSeconds: 300 });\n  } else throw err;\n}","preventionTips":["Set --timeout generously (120s+) for long conversations","Check the session is authenticated and not rate-limited before starting long waits","Retry once with a doubled timeout before giving up","Verify the conversation has actually stopped streaming if it times out repeatedly"],"tags":["timeout","chatgpt","polling","stability"],"backgroundTag":"operation-timeout","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}