Skip to content

fix(server): preserve provider history across repeated rollbacks - #12676

Merged
juliusmarminge merged 1 commit into
pingdotgg:t3code/codex-turn-mappingfrom
Derpedyea:fix/repeated-checkpoint-rollback
Sep 21, 2026
Merged

juliusmarminge merged 1 commit into
pingdotgg:t3code/codex-turn-mappingfrom
Derpedyea:fix/repeated-checkpoint-rollback

Conversation

@Derpedyea

@Derpedyea Derpedyea commented Sep 20, 2026

Copy link
Copy Markdown
Contributor

What Changed

Exclude turns from already rolled-back runs when preparing a provider rollback. The audit history stays intact, and the existing rollback test now covers a previous rewind and both rollback targets.

Targets the orchestration V2 branch from #2829.

Fixes #12679.

Why

In a Codex legacy-history thread with turns A, B, C, rewinding to B and then A makes Codex discard A too: T3 still shows one completed turn, but the provider has none. The second rollback incorrectly counts C again even though it was already removed.

Pi hits the same stale-history problem after rewinding to A, adding D, and rewinding to A again: it tries to fork at an already-removed entry. Filtering those turns makes both providers use the current conversation.

Validation

  • Regression fails without the fix; all 13 tests in CheckpointRollbackService.test.ts pass with it.
  • Server typecheck and changed-file lint/format checks pass.
  • Retested in real workspaces with Codex CLI 0.155.1 and GPT-6 Astra (gpt-6-astra). Legacy-history baseline: 3 → 2 → 0 native turns. Fixed: 3 → 2 → 1 → 2 → 1, with matching files and retained turn IDs. All three fixed rollback receipts succeed on the first attempt.
  • Pi 0.86.0 independently reproduced the stale-entry failure and passed with the fix.

The isolated test launcher explicitly requests the supported thread/start.historyMode: "legacy"; all other requests pass unchanged to Codex 0.155.1. Default new sessions use paginated history and hit a separate V2 adapter rejection on the first rewind, before this repeated-rollback bug can be exercised.

Reproduction

New recording: Codex CLI 0.155.1, GPT-6 Astra, legacy history, original rollback implementation. After the second rewind, T3 retains A while the native provider history is empty.

Repeated rollback removes Codex history that T3 still displays

repeated-rollback-0.155.1-astra.mp4

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I included a video for the rollback interaction

Built and verified with GPT-6 Astra in Codex CLI 0.155.1.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:S 10-29 changed lines (additions + deletions). labels Sep 20, 2026
@macroscopeapp

macroscopeapp Bot commented Sep 20, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at 82396a6

Macroscope's review found this PR approvable — This focused rollback bug fix filters stale turns from already-rolled-back runs while retaining the durable audit history, preventing repeated rollbacks from acting on provider entries that no longer exist. It includes a targeted regression test and does not alter schemas, defaults, configuration, or deployment behavior.

You can add or adjust custom eligibility rules. Learn more.

@juliusmarminge
juliusmarminge force-pushed the fix/repeated-checkpoint-rollback branch from 82396a6 to 8e4829f Compare September 21, 2026 20:10
@juliusmarminge
juliusmarminge merged commit 3853888 into pingdotgg:t3code/codex-turn-mapping Sep 21, 2026
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S 10-29 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants