agentHost: Fix Codex recovery for paginated threads - #336395
Merged
Giuseppe Cianci (Giuspepe) merged 1 commit intoSep 16, 2026
Merged
Conversation
Bound forks at creation with lastTurnId and use thread/revert for paginated truncation. This avoids deprecated rollback and prevents oversized history from surviving restore and fork operations.
Copilot started reviewing on behalf of
Giuseppe Cianci (Giuspepe)
September 16, 2026 10:10
View session
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
No unresolved review issues remain, with focused regression coverage included.
Review tier: Lite (auto)
Findings: None
Note
Copilot is running an experiment and ran this review at Lite.
What changed in this PR
Fixes Codex recovery for paginated threads by bounding forks and using the appropriate truncation protocol.
Changes:
- Bounds forks with
lastTurnId. - Uses
thread/revertfor paginated histories and retains legacy rollback. - Adds wire-level regression tests.
| File | Description |
|---|---|
src/vs/platform/agentHost/test/node/codex/codexCreateChat.test.ts |
Tests bounded forks and paginated reverts. |
src/vs/platform/agentHost/node/codex/codexForkPlan.ts |
Updates fork-boundary documentation. |
src/vs/platform/agentHost/node/codex/codexAgent.ts |
Implements bounded forks and mode-specific truncation. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Giuseppe Cianci (Giuspepe)
marked this pull request as ready for review
September 16, 2026 12:50
Giuseppe Cianci (Giuspepe)
enabled auto-merge (squash)
September 16, 2026 12:50
Ulugbek Abdullaev (ulugbekna)
approved these changes
Sep 16, 2026
Giuseppe Cianci (Giuspepe)
deleted the
agents/session-history-recovery-fix
branch
September 16, 2026 13:55
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
lastTurnIdinstead of copying full history and rolling it backthread/revertfor paginated checkpoint restoration while retainingthread/rollbackfor legacy historiesWhy
Paginated Codex threads reject
thread/rollback. Forking or restoring an earlier checkpoint therefore left the provider-visible history unchanged, which could trap oversized sessions in repeated HTTP 413 failures.Validation
npm run transpile-client./scripts/test.sh --run src/vs/platform/agentHost/test/node/codex/codexCreateChat.test.ts --run src/vs/platform/agentHost/test/node/codex/codexForkPlan.test.ts— 102 passing