{"record":{"id":"63f6ee2f88150e87","repo":"BigPizzaV3/CodexPlusPlus","slug":"codex-api-canvas-user","errorCode":null,"errorMessage":"当前 Codex 版本的 API 适配器不兼容，请更新对话脉络脚本","messagePattern":"当前 Codex 版本的 API 适配器不兼容，请更新对话脉络脚本","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"tools/conversation-canvas/public/canvas.user.js","lineNumber":766,"sourceCode":"      catch(error){\n        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;","sourceCodeStart":748,"sourceCodeEnd":784,"githubUrl":"https://github.com/BigPizzaV3/CodexPlusPlus/blob/b1ed92e5e4a2d74095d4b8db5af43cef7acba9c6/tools/conversation-canvas/public/canvas.user.js#L748-L784","documentation":"nativeApiRequest() relies on the Codex host's versioned native runtime bindings. If loadNativeRuntime() fails (binding missing/renamed in this Codex build), the script cannot do HTTP through the app host and throws this error telling the user to update the userscript.","triggerScenarios":"Channel 'native' request where loadNativeRuntime() rejects — the expected runtime module/binding is absent or incompatible with the running Codex version.","commonSituations":"Codex app updated and internal runtime APIs changed; userscript older than the installed Codex version; running in an environment without the app-host runtime (plain browser).","solutions":["Update the 对话脉络 (conversation canvas) userscript to the latest version","Check the installed Codex version against the script's supported versions","Fall back to the 'external' API channel, which uses direct HTTP","Reinstall/repair the Codex app if the runtime module is genuinely missing"],"exampleFix":"// before\nchannel: 'native' // old userscript + new Codex\n// after\nchannel: 'external' // bypass native runtime, or update userscript","handlingStrategy":"fallback","validationCode":"let native; try{ native=await loadNativeRuntime(); }catch{ useExternalChannel(); }","typeGuard":"function nativeRuntimeAvailable(){return typeof window!=='undefined' && !!window.__codexNativeRuntimeLoader__;}","tryCatchPattern":"try{ await nativeApiRequest(url,opts) }catch(e){ if(e.message.includes('适配器不兼容')){ fallbackToExternal(); } else throw e; }","preventionTips":["Keep the userscript updated with Codex","Pin tested Codex versions","Prefer the external channel when host compatibility is uncertain"],"tags":["compatibility","native-runtime","versioning"],"backgroundTag":"unsupported-platform","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"}