Skip to content

bug(codex): a resumed rollout that starts with compacted hides its retained earlier prompts #1393

Open

Description

@Juliusolsson05

Found by review a of #1386.

Evidence

  • In the local corpus, 82 rollout files (68 native sessions, 19 of them source: "cli") have a first compacted record that comes before every response_item and event_msg.
  • In each of those files, replacement_history holds plain, non-bootstrap user text. That text is the only copy of the earlier conversation in the file.
  • 58 of those sessions have no other rollout file locally.
  • One concrete 0.149.0 CLI file: two session_meta records, then a compacted record holding 17 retained user messages, then world_state, turn_context and the later responses.

Current behaviour

Why the mapper cannot fix it alone

mapCodexRolloutToFeedEntries maps one line at a time. A paged older-history load can start a page with a compacted line whose predecessors sit in the previous page, so "first line in this mapping pass" is not the same as "first line in the file".

Direction

Where the history loader (initial, older-page and preview paths) knows it is mapping from file offset 0, map the retained user messages of a compacted record that no conversation record precedes. Mark them as retained history, and skip developer instructions and the encrypted compaction item. Add a recorded initial-compacted regression case, with fixtures redacted at the same length.

Activity

  1. Juliusolsson05 commented on Sep 27, 2026

    @Juliusolsson05
    OwnerAuthor

    Closed attempt: #1410 (branch fix/codex-resumed-compaction, kept; main merged at b0e9ae8f; reopenable). It mapped a rollout's head compacted record's retained user prompts, gated on a session_meta head marker (atFileHead in mapper.ts, mapCodexRetainedUserHistory). The recorded fixture testing/fixtures/codex/compaction/resumed-head-compacted.json and the corpus counts in its plan are reusable. Open findings from round 1 (reviews a, b, c):

    • P1: retained runtime messages are promoted to user prompts. Injected context (AGENTS, environment, <recommended_plugins>) inside the retained history renders as user rows. The role filter is untested; removing it passes the suite.
    • P1: live one-record bursts, and pagination that splits session_meta from the head compacted line, permanently lose the prompts. Head state is per-mapper, and history pages and live bursts each build their own. A fix needs head state seeded from the loader (e.g. offsets[0] === 0), which touches useIpcSubscriptions.ts.
    • P2: inherited fork context counts as the child's prompts. 63 of 82 target files are forks carrying the parent's context.
    • P2: some retained prompts are replayed later in the same file (duplicates).
    • P2: mixed bootstrap blocks remain visible inside retained user rows.
    • Low: <recommended_plugins> double-renders in 4 corpus files; one residue class of page boundaries is still lost.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingclass:C3-silent-failureThe app knows it failed and does not sayprovider:codexAffects Codex integrationsev:P3Minortype:bugSomething works wrong

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions