Skip to content

extract.py cannot read a Codex rollout transcript, so a Codex session silently saves zero memory #443

Closed

Description

@fdaviddpt

Observed against a live Codex install, not reasoned. codex-cli 0.150.1 (brew install --cask codex), macOS 15.3.2 arm64, plugin installed with codex plugin marketplace add . then codex plugin add remember@dpt-plugins, which resolved to the cached root ~/.codex/plugins/cache/dpt-plugins/remember/0.23.0.

What happens

The install works and the hooks fire. SessionStart, UserPromptSubmit and SessionEnd all ran, .remember/ was created in the Codex working directory, and the save path reached extraction. Extraction then found nothing:

07:04:00 [hook] save-session: PROJECT_DIR=... PIPELINE_DIR=/Users/<user>/.codex/plugins/cache/dpt-plugins/remember/0.23.0 PYTHON=python3 REMEMBER_DIR=.../.remember
07:04:00 [force] bypassing cooldown + min msgs
07:04:00 [extract] session 01a04be7-2a87-7101-886a-552832fb8eaf
07:04:00 [extract] 0 exchanges (0 human)
07:04:00 [extract] 0 exchanges, skip -- position -> 15

The session contained one human prompt and one assistant reply. The transcript file has 15 lines. 0 exchanges (0 human) is not a quiet session; it is a schema the parser does not recognise.

Why

Codex writes a different envelope. Every line of ~/.codex/sessions/2026/08/29/rollout-2026-08-29T07-03-56-01a04be7-....jsonl is:

{"timestamp": ..., "ordinal": ..., "type": ..., "payload": {...}}

with type drawn from session_meta, event_msg, response_item, world_state, turn_context. The 15 lines of the session above were, in order: session_meta, event_msg, four response_item, world_state, turn_context, two response_item, two event_msg, response_item, two event_msg.

pipeline/extract.py matches Claude Code's shape -- a top-level type of user or assistant with the content under message. Nothing in the Codex file matches, so every line is skipped and the count is zero. The role and the text live one level down, inside payload.

Why this is priority:high rather than an enhancement

This is the silent failure the project exists to prevent. The install reports success, codex plugin list reports installed, enabled, the hooks log that they ran, and .remember/ appears with a plausible logs/ and tmp/ inside it. A user has every signal that memory is being captured, and the store stays empty. 0 exchanges, skip is indistinguishable, from outside, from a session that genuinely had nothing to say.

It also advances the position marker on the way out (position -> 15), so the lines it failed to read are marked as read. A later fix would not recover them on a resume.

Scope

Part of #406. #407 already landed the two pieces this depends on: the host-supplied transcript_path (Codex's filename is rollout-<date>-<uuid>.jsonl, which no reconstruction would find) and the session_id-over-basename fix for the incremental position key. Both were built without a Codex install and are now confirmed working against one -- the position file for this session is position.01a04be7-2a87-7101-886a-552832fb8eaf, keyed correctly. Reading the rollout schema is the remaining piece.

Suggested shape, matching how #407 handled the path: a host adapter in pipeline/host.py that normalises a transcript line to a role and a text body, with the Claude and Codex envelopes as two implementations, rather than branching inside extract.py.

A test needs a real captured rollout fixture. The one above can be committed; it is a prompt and a reply with no repository content in it.

What is not yet known

  • Whether PostToolUse fires and what its payload carries -- the probe session ran no tools.
  • Whether resume (codex resume) and the incremental save path behave once extraction returns a non-zero count.
  • Summarization still shells claude -p, so even a correct extraction leaves the Codex-native execution path from Add official OpenAI Codex support #406 open.

Metadata

Metadata

Assignees

Labels

bugpriority:high

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions