{"record":{"id":"586b19244993d0c6","repo":"openclaw/openclaw","slug":"codex-thread-loaded-list-exceeded-max-compat-pag","errorCode":null,"errorMessage":"Codex thread/loaded/list exceeded ${MAX_COMPAT_PAGINATION_PAGES} pages with a continuation cursor","messagePattern":"Codex thread/loaded/list exceeded (.+?) pages with a continuation cursor","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"extensions/codex/src/supervision-tools.ts","lineNumber":612,"sourceCode":"        if (!isLoadedThreadReadMiss(error)) {\n          throw error;\n        }\n      }\n    }\n    const nextCursor = readCompatNextCursor(listed.nextCursor, \"thread/loaded/list\");\n    if (nextCursor && seenCursors.has(nextCursor)) {\n      throw new Error(`Codex thread/loaded/list returned repeated cursor ${nextCursor}`);\n    }\n    if (nextCursor) {\n      seenCursors.add(nextCursor);\n    }\n    cursor = nextCursor;\n    if (!cursor) {\n      break;\n    }\n  }\n  if (cursor) {\n    throw new Error(\n      `Codex thread/loaded/list exceeded ${MAX_COMPAT_PAGINATION_PAGES} pages with a continuation cursor`,\n    );\n  }\n  return sessions;\n}\n\nasync function listStoredSessions(params: {\n  request: EndpointRequest;\n  endpoint: ResolvedSupervisionEndpoint;\n  limit: number;\n}): Promise<CodexSupervisorSession[]> {\n  const sessions: CodexSupervisorSession[] = [];\n  const seenCursors = new Set<string>();\n  let cursor: string | undefined;\n  for (let pageIndex = 0; pageIndex < MAX_COMPAT_PAGINATION_PAGES; pageIndex += 1) {\n    const remaining = params.limit - sessions.length;\n    if (remaining <= 0) {\n      break;","sourceCodeStart":594,"sourceCodeEnd":630,"githubUrl":"https://github.com/openclaw/openclaw/blob/01804a75319da4b69c9ab98ceaa30477e22b8c0b/extensions/codex/src/supervision-tools.ts#L594-L630","documentation":"Thrown by listLoadedSessions when pagination exceeds MAX_COMPAT_PAGINATION_PAGES (100) without terminating. Loaded-thread listing has no caller limit, so the only stop conditions are an empty cursor or a repeated cursor; this guard catches runaway pagination.","triggerScenarios":"More than 100 pages x 100 entries (>10,000 loaded threads) returned with always-fresh cursors.","commonSituations":"A very large number of loaded (active) Codex threads; or an app-server pagination bug returning endless cursors.","solutions":["Close unused loaded threads in Codex to reduce the active set below ~10,000.","Confirm the app-server isn't returning empty pages with fresh cursors.","Use codex_session_read with a known thread id instead of listing when possible."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep the loaded-thread count under ~10,000 (100 pages x 100 entries).","Close idle threads in Codex Sessions.","Prefer codex_session_read with a known thread id over bulk listing."],"tags":["codex","app-server","pagination","limits"],"backgroundTag":null,"analyzedSha":"01804a75319da4b69c9ab98ceaa30477e22b8c0b","analyzedAt":"2026-08-12T04:37:58.197Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}