{"record":{"id":"537cab11ed404427","repo":"BigPizzaV3/CodexPlusPlus","slug":"codex-http","errorCode":null,"errorMessage":"当前 Codex 版本未提供兼容的 HTTP 服务","messagePattern":"当前 Codex 版本未提供兼容的 HTTP 服务","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"tools/conversation-canvas/public/canvas.user.js","lineNumber":767,"sourceCode":"        clearInterval(heartbeat);\n        signal?.throwIfAborted();\n        if(!error.retryable||attempt>=maxRetries)throw error;\n        const delay=retryDelayMs*2**attempt;\n        progress(`${error.message}；${Math.ceil(delay/1000)} 秒后自动重试 ${attempt+1}/${maxRetries}（可能重复计费）…`);\n        // Pausing during backoff must not submit another request.\n        let timer;try{await waitForApi(new Promise(resolve=>{timer=setTimeout(resolve,delay);}),signal);}finally{clearTimeout(timer);}\n      }finally{clearInterval(heartbeat);}\n    }\n  }\n  return {run,dispose};\n}\n\n// HTTP uses the app host, with versioned runtime bindings, not renderer fetch/CSP.\nasync function nativeApiRequest(url,options){\n  const localError=message=>Object.assign(Error(message),{canvasApiLocal:true});\n  let native;\n  try{native=await loadNativeRuntime();}catch{throw localError('当前 Codex 版本的 API 适配器不兼容，请更新对话脉络脚本');}\n  if(typeof native.lGt!=='function')throw localError('当前 Codex 版本未提供兼容的 HTTP 服务');\n  native.lGt();\n  const client=native.cGt?.getInstance?.();\n  if(typeof client?.fetch!=='function'||!native.jR?.httpFetch)throw localError('当前 Codex 的 HTTP 服务尚未就绪，请稍后重试');\n  const {onProgress,...fetchOptions}=options;\n  const response=await client.fetch(url,fetchOptions);\n  return readApiResponse(response,options.signal,onProgress);\n}\n\n\nconst canvasNodeSize={width:268,height:132,gapX:88,gapY:34};\n\n// Iterative preorder/reverse traversal keeps deep histories off the JS call stack.\nfunction layoutTaskCanvas(nodes,currentNodeId,collapsed=new Set()){\n  const view=visibleTreeRows(nodes,currentNodeId,collapsed),children=new Map(),positions=new Map();\n  const {width,height,gapX,gapY}=canvasNodeSize;\n  for(const row of view.rows){const list=children.get(row.node.parent)||[];list.push(row.node.id);children.set(row.node.parent,list);}\n  let leaf=0;\n  for(const row of view.rows)if(!children.has(row.node.id))positions.set(row.node.id,leaf++*(height+gapY));","sourceCodeStart":749,"sourceCodeEnd":785,"githubUrl":"https://github.com/BigPizzaV3/CodexPlusPlus/blob/b1ed92e5e4a2d74095d4b8db5af43cef7acba9c6/tools/conversation-canvas/public/canvas.user.js#L749-L785","documentation":"After loading the native runtime, nativeApiRequest() verifies the expected binding native.lGt is a function. If it is missing, this Codex build does not expose the compatible HTTP service and the error is thrown with canvasApiLocal set.","triggerScenarios":"loadNativeRuntime() succeeded but the returned object lacks a callable lGt (binding renamed or removed in this Codex version).","commonSituations":"Codex internal API surface changed between versions; script pinning outdated binding names; partial/failed host update leaving mismatched runtime.","solutions":["Update the userscript to a version matching your Codex build","Downgrade/align Codex to a version the script supports","Use the external API channel instead of native","Inspect the runtime object to confirm which bindings exist and report/patch the script"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"const native=await loadNativeRuntime().catch(()=>null);\nif(typeof native?.lGt!=='function') alert('update userscript');","typeGuard":"function hasHttpBinding(n){return !!n && typeof n.lGt==='function';}","tryCatchPattern":"try{ await nativeApiRequest(url,opts) }catch(e){ if(e.message.includes('兼容的 HTTP 服务')){ reportVersionMismatch(); useExternalChannel(); } }","preventionTips":["Match userscript version to Codex build","Check binding names after each Codex update","Document supported Codex versions in the script header"],"tags":["compatibility","native-runtime","api-surface"],"backgroundTag":"module-init-failed","analyzedSha":"b1ed92e5e4a2d74095d4b8db5af43cef7acba9c6","analyzedAt":"2026-09-19T23:35:21.129Z","contentChangedAt":"2026-09-19T23:35:21.129Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}