BigPizzaV3/CodexPlusPlus · error · Error

当前 Codex 版本的对话读取接口不兼容

Error message

当前 Codex 版本的对话读取接口不兼容

What it means

nativeContext loads the versioned native runtime and requires two history-reading bindings, ESt and kr. If either is not a function, the current Codex version's conversation-reading interface is incompatible and this error is thrown. History reading is kept separate from the private side-chat submission API so it can work even when that API is absent.

Solutions

  1. Update the conversation canvas script to match the installed Codex version
  2. Confirm your Codex version is in the script's supported list
  3. Downgrade Codex to a supported release if no script update exists yet
  4. Extend the runtime binding map (ESt/kr) for the new Codex build

Example fix

// before
if(typeof native.ESt!=='function'||typeof native.kr!=='function')throw Error('当前 Codex 版本的对话读取接口不兼容');
// after
if(typeof native.ESt!=='function'||typeof native.kr!=='function')throw Error(`当前 Codex 版本的对话读取接口不兼容(缺少 ESt=${typeof native.ESt}, kr=${typeof native.kr}),请更新对话脉络脚本`);
Defensive patterns

Strategy: fallback

Validate before calling

async function canReadHistory(){try{const n=await loadNativeRuntime();return typeof n.ESt==='function'&&typeof n.kr==='function';}catch{return false;}}

Type guard

const historyBindingsOk=(n)=>typeof n?.ESt==='function'&&typeof n?.kr==='function';

Try / catch

try{await nativeContext(id);}catch(e){if(/不兼容/.test(e.message)){showUpdateBanner();useExportFallback();}else throw e;}

Prevention

When it happens

Trigger: nativeContext(threadId) called (directly or via readNativeHistory callers: navigation, manager, native/scope/manager/parent paths) on a Codex build whose runtime lacks ESt or kr.

Common situations: Codex app update renamed/removed the history-read bindings; canvas script's binding map out of date; running an unsupported Codex channel (beta/nightly).

Understand the failure class

Background: "is not a compatible type" / "cannot merge" errors: when a value's type doesn't match what the library requires — this error's family across 65 libraries.

Related errors


AI-assisted analysis of BigPizzaV3/CodexPlusPlus@b1ed92e5e4 (2026-09-19). Data as JSON: /api/errors/5178b375c1c5a1c8. Report an issue: GitHub.

Appendix: source

Thrown at tools/conversation-canvas/src/native-sidechat.js:5

// Runtime bindings are versioned separately. History reading does not require
// the private side-conversation submission API to be available.
async function nativeContext(threadId){
  const native=await loadNativeRuntime();
  if(typeof native.ESt!=='function'||typeof native.kr!=='function')throw Error('当前 Codex 版本的对话读取接口不兼容');
  native.kr();
  const scopes=[],callbacks=[],seeds=[],navigation=[];
  const visited=new Set(),domVisited=new Set();
  // ProseMirror owns the inner editable DOM. React's expando is on a wrapper,
  // not necessarily on the contenteditable itself. Start from native surfaces
  // too, so history reading remains available while the composer is hidden.
  for(const element of document.querySelectorAll('[contenteditable],textarea,main,[data-testid="app-shell-header-context-menu-surface"]')){
    for(let dom=element;dom&&!domVisited.has(dom);dom=dom.parentElement){
      domVisited.add(dom);
      for(const key of Object.keys(dom)){
        if(key.startsWith('__reactFiber$'))seeds.push(dom[key]);
        if(key.startsWith('__reactContainer$')){
          const root=dom[key];seeds.push(root?.stateNode?.current??root);
        }
      }
    }
  }
  const inspect=fiber=>{

View on GitHub (pinned to b1ed92e5e4)