{"record":{"id":"84d97eff00bd137b","repo":"paperclipai/paperclip","slug":"codex-history-incomplete","errorCode":"codex_history_incomplete","errorMessage":"codex_history_incomplete: ${method} omitted data","messagePattern":"codex_history_incomplete: (.+?) omitted data","errorType":"error_code","errorClass":"HarnessReconciliationError","httpStatus":null,"severity":"error","filePath":"packages/paperclip-runner/src/drivers/codex/codex-history.ts","lineNumber":31,"sourceCode":"): Promise<Record<string, unknown>[]> {\n  const values = new Map<string, Record<string, unknown>>();\n  const cursors = new Set<string>();\n  let cursor: string | undefined;\n  for (let page = 0; page < 10_000; page += 1) {\n    let response: Record<string, unknown>;\n    try {\n      response = await transport.request(method, {\n        ...params,\n        limit: 100,\n        ...(cursor ? { cursor } : {}),\n      });\n    } catch (error) {\n      throw new HarnessReconciliationError(\n        `codex_history_read_failed: ${method} requires supported paginated history; ${String(error)}`,\n      );\n    }\n    if (!Array.isArray(response.data))\n      throw new HarnessReconciliationError(\n        `codex_history_incomplete: ${method} omitted data`,\n      );\n    for (const raw of response.data) {\n      const value = record(raw);\n      const id = identity(value);\n      if (!id)\n        throw new HarnessReconciliationError(\n          `codex_history_incomplete: ${method} omitted an identity`,\n        );\n      // Later pages can repeat the cursor anchor with its newly completed state.\n      values.set(id, value);\n    }\n    const next = response.nextCursor;\n    if (next == null) return [...values.values()];\n    if (typeof next !== \"string\" || !next || cursors.has(next)) {\n      throw new HarnessReconciliationError(\n        `codex_history_incomplete: ${method} repeated or invalid cursor`,\n      );","sourceCodeStart":13,"sourceCodeEnd":49,"githubUrl":"https://github.com/paperclipai/paperclip/blob/01ad8584922b5d85292b1723cae71fa0d9b07a19/packages/paperclip-runner/src/drivers/codex/codex-history.ts#L13-L49","documentation":"pages() requires every page response from the history RPC to contain a data array. When the provider omits the data field, the library throws HarnessReconciliationError with code codex_history_incomplete rather than treating the missing data as an empty page, since a partial read cannot prove the thread is idle.","triggerScenarios":"A thread/turns/list or thread/items/list response object has no array-valued data field — e.g. an app-server version returning a different envelope shape, or an error object returned as a successful response.","commonSituations":"Codex app-server API drift: a provider upgrade changed the response contract; a proxy or middleware stripping/renaming fields; mocking layers returning wrong shapes in tests.","solutions":["Pin or upgrade the Codex app-server to a version whose list methods return { data, nextCursor } envelopes.","Log the full raw response to confirm the actual envelope shape and compare against the expected app-server protocol.","If a proxy/wrapper sits in front of the app-server, fix it to pass through the response unchanged.","Catch HarnessReconciliationError and fail the recovery run; never assume an empty history on this error."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":"function isHistoryIncomplete(e: unknown): e is HarnessReconciliationError { return e instanceof HarnessReconciliationError && e.message.includes('codex_history_incomplete'); }","tryCatchPattern":"try { const turns = await readCodexTurnMetadata(transport, threadId); } catch (e) { if (isHistoryIncomplete(e)) { reportReconciliationFailure(e); return null; } throw e; }","preventionTips":["Pin app-server and runner versions together","Test the response envelope shape once at transport startup (expect { data, nextCursor })","Avoid proxies that rewrite provider responses","Treat envelope-shape drift as a deployment/upgrade signal"],"tags":["codex","history","schema","api-drift"],"backgroundTag":"unexpected-response-shape","analyzedSha":"01ad8584922b5d85292b1723cae71fa0d9b07a19","analyzedAt":"2026-09-10T03:14:50.855Z","contentChangedAt":"2026-09-10T03:14:50.855Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}