BigPizzaV3/CodexPlusPlus · error · Error
后台整理会话已失效,已完成批次仍保留;点击继续可重新处理本批
Error message
后台整理会话已失效,已完成批次仍保留;点击继续可重新处理本批
What it means
During the background polling loop, each iteration re-fetches the organizer side conversation by session.sideId. If the conversation can no longer be found in the manager (it was evicted, closed, or the host dropped it), the library throws, telling the user that completed batches are preserved and clicking continue will reprocess the current batch.
Solutions
- Click continue to reprocess the current batch — completed batches are retained in the session.
- Increase session.batches bookkeeping confidence by checking persistence: the session file still holds finished batch results.
- Avoid closing/reloading the Codex window while background organization is running.
- If evictions are caused by idle GC, keep the host active or reduce batch size/organize duration.
Example fix
// before
if(!conversation)throw Error('后台整理会话已失效,已完成批次仍保留;点击继续可重新处理本批');
// after
if(!conversation){await createOrganizerSide(native,scope,manager,parent,threadId,session,save);return nativeSideChat(threadId,prompt,onProgress,signal,{...options,session});} Defensive patterns
Strategy: try-catch
Validate before calling
const conversation=manager.getConversation(session.sideId);if(!conversation){markBatchResumable(session,save);} Type guard
const conversationExists=(m,id)=>!!m.getConversation(id);
Try / catch
try{await nativeSideChat(...);}catch(e){if(String(e.message).includes('后台整理会话已失效')){showResumeBanner();return null;}throw e;} Prevention
- Warn users not to close the window during background organization
- Persist completed batch results incrementally so resume is cheap
- Re-create the side conversation automatically when it vanishes mid-job
- Set keep-alive/foreground policies for ephemeral conversations during active turns
When it happens
Trigger: manager.getConversation(session.sideId) returns undefined/null inside the polling loop — the ephemeral side conversation disappeared from the manager while its turn was still considered in progress.
Common situations: The user closed the side conversation or its parent window; the host garbage-collected ephemeral tasks after an idle timeout; an app reload cleared the in-memory conversation map while a background job was running.
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
AI-assisted analysis of BigPizzaV3/CodexPlusPlus@b1ed92e5e4 (2026-09-19).
Data as JSON: /api/errors/544e63fd163a4890.
Report an issue: GitHub.
Appendix: source
Thrown at tools/conversation-canvas/src/native-sidechat.js:148
if(session.requestId===requestId&&session.phase==='submitting'&&!session.turnId){
const accepted=nativeTurns(side).find(t=>t.clientUserMessageId===session.messageId);
if(!accepted?.turnId)throw Error('上次提交结果尚未确认,请稍后点击继续');
session.turnId=accepted.turnId;session.phase='waiting';await save();
}
if(session.requestId!==requestId||!session.turnId){
signal?.throwIfAborted();
Object.assign(session,{requestId,turnId:null,messageId:crypto.randomUUID(),phase:'submitting'});await save();
session.turnId=await native.Mr({scope,turnTrigger:'side_chat',manager,hostId,targetConversationId:session.sideId,cwd:parent.cwd,agentMode:'auto',permissionProfileId:null,shouldSendPermissionOverrides:false,activeCollaborationMode:mode,clientUserMessageId:session.messageId,
context:{prompt,collaborationMode:mode,workspaceRoots:[parent.cwd],imageAttachments:[],fileAttachments:[],addedFiles:[],commentAttachments:[],selectedTextAttachments:[],pastedTextAttachments:[],threadReferences:[]}});
session.phase='waiting';await save();
}
onProgress('GPT-5.6 Luna · 中 · 正在后台整理,可暂停后继续…');
// No fixed whole-job deadline: retain the turn identity when paused so that
// resume reads the existing response instead of launching duplicate work.
for(;;){
signal?.throwIfAborted();
const conversation=manager.getConversation(session.sideId);
if(!conversation)throw Error('后台整理会话已失效,已完成批次仍保留;点击继续可重新处理本批');
const turn=nativeTurns(conversation).find(t=>t.turnId===session.turnId);
if(turn&&turn.status!=='inProgress'){
if(turn.status!=='completed'||turn.error){session.requestId=null;session.turnId=null;session.phase='ready';await save();throw Error('本批整理中断,已完成批次已保存,可点击继续');}
if(session.phase!=='completed')session.batches=(session.batches||0)+1;
session.phase='completed';await save();
return turn.items.filter(i=>i.type==='agentMessage'&&(i.phase==null||i.phase==='final_answer')).map(i=>i.text??'').join('\n');
}
await new Promise(resolve=>setTimeout(resolve,1000));
}
}
View on GitHub (pinned to b1ed92e5e4)