BigPizzaV3/CodexPlusPlus · warning · Error
当前任务的原生接口尚未就绪,请等待任务加载后点击刷新
Error message
当前任务的原生接口尚未就绪,请等待任务加载后点击刷新
What it means
After scanning DOM nodes and React fibers, nativeContext() must find both a scope object and a conversation manager for the current task. If either is missing, the app's native state for the task has not hydrated yet, so the script throws and tells the user to wait and refresh.
Solutions
- Wait for the task to fully load, then click refresh again (exactly what the message advises).
- Reload the Codex app page and reopen the task before running history import.
- Run the diagnostic event ('native_context_lookup') output to see whether DOM/fiber counts are zero and adjust when the script is invoked.
- If it persists, update canvas.user.js — the fiber/manager detection heuristics may need new anchors for the current Codex build.
Example fix
// before
if(!scope||!manager)throw Error('当前任务的原生接口尚未就绪,请等待任务加载后点击刷新');
// after
if(!scope||!manager){await new Promise(r=>setTimeout(r,1000));({scope,manager}=probe());
if(!scope||!manager)throw Error('当前任务的原生接口尚未就绪,请等待任务加载后点击刷新');} Defensive patterns
Strategy: retry
Validate before calling
const diag={scopeFound:false,managerFound:false};// run probe; only proceed when both true
if(!diag.scopeFound||!diag.managerFound)await waitForTaskReady(); Type guard
const isReady=ctx=>ctx!=null&&ctx.scope!=null&&ctx.manager!=null;
Try / catch
try{return await nativeContext(threadId);}catch(e){if(e.message.includes('尚未就绪')){await sleep(1500);return nativeContext(threadId);}throw e;} Prevention
- Invoke history import only after the task view finishes rendering
- Debounce refresh clicks during route transitions
- Use the native_context_lookup diagnostic to tune wait conditions
- Add a bounded retry with backoff around nativeContext
When it happens
Trigger: nativeContext() runs while the task view is not mounted/hydrated: the fiber walk finds no matching scope or manager (diagnostic 'native_context_lookup' shows scopeCount 0 or manager null) — e.g. clicking history refresh immediately after opening a task or during route transition.
Common situations: Clicking refresh before the task page finishes loading; SPA route change leaving stale fibers; React tree not yet containing the conversation manager for a newly opened task.
Understand the failure class
Background: "Invalid state transition" errors: "status must be X, actually Y", "already rejected/charging/uninstalled", "cannot ... while running" — what they mean when a library rejects your call — this error's family across 31 libraries.
Related errors
AI-assisted analysis of BigPizzaV3/CodexPlusPlus@b1ed92e5e4 (2026-09-19).
Data as JSON: /api/errors/c2f0d7d5599f81e3.
Report an issue: GitHub.
Appendix: source
Thrown at tools/conversation-canvas/public/canvas.user.js:529
if(fiber.tag===22&&fiber.memoizedState!==null)continue;
inspect(fiber);if(fiber.child)stack.push(fiber.child);
}
}
// Prefer a callback sharing the matching route-scope subtree. History reads
// do not require a composer or a side-conversation callback at all.
let scope=null,create=null,manager=null,parent=null;
for(const candidate of scopes){
const found=native.ESt(candidate.scope,threadId),conversation=found?.getConversation(threadId);
if(!conversation)continue;
scope=candidate.scope;manager=found;parent=conversation;
const matching=callbacks.find(entry=>{
for(let fiber=entry.fiber;fiber;fiber=fiber.return)if(fiber===candidate.fiber)return true;
return false;
});
if(matching){create=matching.create;break;}
}
if(typeof diagnostic==='function')diagnostic('native_context_lookup',{domCount:domVisited.size,fiberCount:visited.size,scopeCount:scopes.length,callbackFound:!!create,managerFound:!!manager});
if(!scope||!manager)throw Error('当前任务的原生接口尚未就绪,请等待任务加载后点击刷新');
// The thread list can use the app-wide scope while the composer uses a
// derived route scope. Its memo dependency still identifies the exact task.
const matchingNavigation=navigation.find(entry=>entry.scope===scope)||(navigation.length===1?navigation[0]:null);
return {native,scope,create,manager,parent,navigation:matchingNavigation?.adapter};
}
function nativeMessageTarget(doc,id){
const direct=doc.getElementById(id);if(direct)return direct;
const encoded=encodeURIComponent(id);
return [...doc.querySelectorAll('[data-local-conversation-item-target-ids]')].find(element=>(element.getAttribute('data-local-conversation-item-target-ids')||'').split(' ').includes(encoded))||null;
}
function nativeTurns(conversation){
if(!conversation)return [];
const history=conversation.turnHistory;
const turns=history?.kind==='canonical'?Object.values(history.history.entitiesByKey):conversation.turns||[];
return [...turns,...(conversation.turns||[])];
}
const organizerModel='gpt-5.6-luna';
const organizerEffort='medium';View on GitHub (pinned to b1ed92e5e4)