Codex 0.151 makes durable threads paginated by default, but T3's retry/edit fork path still truncates a completed native fork with the deprecated thread/rollback endpoint. Codex rejects that endpoint for paginated threads, leaving the provider-turn start failed and the T3 run stuck in its starting state.
What Changed#
- Resolve the selected durable provider turn to its native Codex turn ID before creating the fork.
- Pass that ID as
lastTurnId in the original thread/fork request so Codex omits later turns atomically.
- Skip the follow-up rollback whenever the native boundary is available.
- Preserve the existing rollback-count path only as a compatibility fallback for historical projected turns without a native turn reference.
- Cover the native-boundary mapping with a focused adapter test.
Why#
The existing flow first creates a complete native fork. If the user selected an earlier turn, T3 counts the terminal turns after that boundary and calls thread/rollback on the newly created thread. Forking at the current head works because the count is zero; retrying or editing an earlier turn reaches the rollback call.
Paginated Codex threads reject that second request with paginated threads do not support thread/rollback. Although Codex has already created the fork, T3 receives an error and fails the durable provider-turn.start effect, so the run appears unresponsive.
Codex already supports the intended operation directly: thread/fork.lastTurnId creates a fork through the specified turn, inclusive. Supplying the known native turn ID removes the incompatible second request without adding recovery, persistence, or provider-version detection machinery.
UI Changes#
None. This changes only the Codex provider adapter's native fork request.
Validation#
vp test run apps/server/src/orchestration-v2/Adapters/CodexAdapterV2.test.ts
vp run --filter t3 typecheck
vp fmt apps/server/src/orchestration-v2/Adapters/CodexAdapterV2.ts apps/server/src/orchestration-v2/Adapters/CodexAdapterV2.test.ts --check
Checklist#
Implemented with GPT-5.6 in the Codex desktop harness.
Note
Medium Risk
Changes native fork semantics for retry/edit-at-earlier-turn flows; incorrect boundary mapping could fork with wrong history, though fallback rollback preserves legacy behavior when native ids are missing.
Overview
Codex same-provider forks now cut history at the selected turn in one thread/fork call instead of forking at the head and calling thread/rollback, which paginated Codex threads reject.
The adapter adds resolveCodexForkBoundary, which maps the orchestrator’s source provider turn to its native Codex turn id when nativeTurnRef is present. forkThread includes that id as lastTurnId on thread/fork and sets rollback to zero so the post-fork thread/rollback path is skipped. When there is no native turn reference, behavior stays the same: fork latest state and roll back by the count of later terminal provider turns.
Unit tests cover native-boundary vs identityless fallback. Replay fixtures and orchestration docs were updated to expect lastTurnId and no rollback in the prior-turn fork scenario.
Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 8d034c858ea6a9d63cc4121fb14b9d41b89d0a2a. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).
Note
Fork Codex threads at native turn boundary instead of rollback#
- Adds
resolveCodexForkBoundary to CodexAdapterV2, which returns the source provider turn's native turn id as the fork boundary when available and resets rollback count to zero
- Updates the
forkThread handler to include the resolved native turn id in the native fork request and skip fork-local rollback in that case; turns without native identity still use the existing latest-state fork plus rollback fallback
- Updates replay fixtures in
thread_fork_native, thread_fork_native_prior_turn, thread_merge_back_continue, and thread_merge_back_siblings to expect native boundary fork requests and removes explicit rollback exchanges where applicable
- Behavioral Change: Codex forks with a native source turn id now fork directly at that turn; forks without native identity are unaffected and retain rollback fallback
Macroscope summarized 8d034c8.
Codex Review Summary#
This comment shows the latest Codex review activity on this pull request.
2822d10ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.