Skip to content

Make thread history projection resilient to malformed rollouts - #36188

Merged
copyberry[bot] merged 1 commit into
mainfrom
copyberry/codex-internal-to-codex-oss/374beda316c605d562bd9526abed19916598d69f
Jul 30, 2026
Merged

copyberry[bot] merged 1 commit into
mainfrom
copyberry/codex-internal-to-codex-oss/374beda316c605d562bd9526abed19916598d69f

Conversation

@copyberry

@copyberry copyberry Bot commented Jul 30, 2026 •

Copy link
Copy Markdown

Make thread history projection resilient to malformed rollouts

Why

A failed rollout append can leave a rejected line before a valid same-ordinal
retry. Advancing the byte checkpoint past that line without also advancing the
ordinal checkpoint can prevent subsequent history from being projected.

What changed

  • Defer rejected and unknown rollout lines until a later valid ordinal shows
    whether they were replaced by a retry or consumed an ordinal.
  • Advance skipped ordinal ranges together with the durable byte checkpoint,
    while rejecting gaps that cannot be explained by rejected lines.
  • Prefer item event timestamps and parse the rollout timestamp only when an
    item needs it as a fallback.

Testing

Added coverage for same-ordinal retries, inferred ordinal gaps, unknown and
malformed records, invalid fallback timestamps, and unexplained gaps.

## Why

A failed rollout append can leave a rejected line before a valid same-ordinal
retry. Advancing the byte checkpoint past that line without also advancing the
ordinal checkpoint can prevent subsequent history from being projected.

## What changed

- Defer rejected and unknown rollout lines until a later valid ordinal shows
  whether they were replaced by a retry or consumed an ordinal.
- Advance skipped ordinal ranges together with the durable byte checkpoint,
  while rejecting gaps that cannot be explained by rejected lines.
- Prefer item event timestamps and parse the rollout timestamp only when an
  item needs it as a fallback.

## Testing

Added coverage for same-ordinal retries, inferred ordinal gaps, unknown and
malformed records, invalid fallback timestamps, and unexplained gaps.

GitOrigin-RevId: 374beda316c605d562bd9526abed19916598d69f
@copyberry
copyberry Bot force-pushed the copyberry/codex-internal-to-codex-oss/374beda316c605d562bd9526abed19916598d69f branch from 671162c to 6256a7c Compare July 30, 2026 16:50
@copyberry
copyberry Bot merged commit 6256a7c into main Jul 30, 2026
31 of 32 checks passed
@copyberry
copyberry Bot deleted the copyberry/codex-internal-to-codex-oss/374beda316c605d562bd9526abed19916598d69f branch July 30, 2026 16:51
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 30, 2026

This branch was previously deployed

1 inactive deployment
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants