BigPizzaV3/CodexPlusPlus · error · Error
记录中的任务 ID 与当前任务不一致
Error message
记录中的任务 ID 与当前任务不一致
What it means
bridge-data.mjs's graphFromExport, after parsing all rollout lines, throws '记录中的任务 ID 与当前任务不一致' when the rollout's session_meta payload.id (declaredId) differs from the requested threadId. This prevents graphing another session's transcript under the current thread.
Solutions
- Refresh so the bridge re-reads the rollout matching the current threadId
- Fix the host's rollout-path resolution for the requested id
- If the id legitimately changed on resume, remap the canvas task id to declaredId
- Ensure only one session_meta with the correct id exists in the file
Example fix
// before
if(declaredId&&declaredId!==threadId)throw new Error('记录中的任务 ID 与当前任务不一致');
// after
if(declaredId&&declaredId!==threadId){ console.warn(`rollout ${declaredId} != thread ${threadId}`); throw new Error('记录中的任务 ID 与当前任务不一致'); } Defensive patterns
Strategy: validation
Validate before calling
function declaredSessionId(content){ for (const line of content.split('\n')) { try { const r=JSON.parse(line); if (r.type==='session_meta') return r.payload?.id; } catch {} } return null; }
if (declaredSessionId(result.content) !== threadId) throw new Error('记录中的任务 ID 与当前任务不一致'); Try / catch
try { return graphFromExport(result, threadId, ann); } catch (e) { if (String(e.message).includes('不一致')) { console.warn('stale rollout for', threadId); return resync(); } throw e; } Prevention
- Resolve the rollout file strictly by thread id
- Re-read after task resume/fork since ids can change
- Validate session_meta before long-running parses
When it happens
Trigger: graphFromExport called via sync with rollout content whose session_meta declares a different id than the threadId argument — wrong rollout file served, thread forked/resumed with a new id, or merged/renamed rollout files.
Common situations: Host serving a cached rollout for an old task; resuming a session that writes a new session_meta id; consumers reading the wrong .jsonl in ~/.codex/sessions.
Related errors
- 记录中的任务 ID 与当前任务不一致
- 会话接口返回了不匹配的数据
- 会话接口返回了不匹配的数据
- Message without an ID requires a stable fallback ID
- result?.message||'Codex++ 会话读取失败'
AI-assisted analysis of BigPizzaV3/CodexPlusPlus@b1ed92e5e4 (2026-09-19).
Data as JSON: /api/errors/f7b64802d739d650.
Report an issue: GitHub.
Appendix: source
Thrown at tools/conversation-canvas/bridge-data.mjs:17
import {parseMessage,buildGraph} from './model.mjs';
export function graphFromExport(result, threadId, annotations={nodes:[]}) {
if(result?.status!=='ok')throw new Error(result?.message||'Codex++ 会话读取失败');
if(result.kind!=='codex-rollout'||result.session_id!==threadId||typeof result.content!=='string')throw new Error('会话接口返回了不匹配的数据');
const messages=[],seen=new Set();
let declaredId=null;
// Ignore an unfinished JSONL tail; the next refresh will read the completed line.
const lines=result.content.slice(0,result.content.lastIndexOf('\n')+1).split('\n');
for(let i=0;i<lines.length;i++){
if(!lines[i].trim())continue;
let r;try{r=JSON.parse(lines[i]);}catch{continue;}
if(r.type==='session_meta')declaredId=r.payload?.id;
const m=parseMessage(r,`message-${threadId}-line-${i}`);
if(m&&!seen.has(m.id)){seen.add(m.id);messages.push(m);}
}
if(declaredId&&declaredId!==threadId)throw new Error('记录中的任务 ID 与当前任务不一致');
return {threadId,title:annotations.title||'当前对话',messages,...buildGraph(messages,annotations)};
}
View on GitHub (pinned to b1ed92e5e4)