Skip to content

agentHost: Fix Codex recovery for paginated threads - #336395

Merged
Giuseppe Cianci (Giuspepe) merged 1 commit into
mainfrom
agents/session-history-recovery-fix
Sep 16, 2026
Merged

Giuseppe Cianci (Giuspepe) merged 1 commit into
mainfrom
agents/session-history-recovery-fix

Conversation

@Giuspepe

Copy link
Copy Markdown
Contributor

Summary

  • bound Codex forks at creation with lastTurnId instead of copying full history and rolling it back
  • use thread/revert for paginated checkpoint restoration while retaining thread/rollback for legacy histories
  • add focused wire-level regressions for both recovery paths

Why

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
  • targeted ESLint on all three changed files
  • pre-commit hygiene hook

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 AI balanced review requested due to automatic review settings September 16, 2026 10:10

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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/revert for 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.

@Giuspepe
Giuseppe Cianci (Giuspepe) merged commit 4df534b into main Sep 16, 2026
34 checks passed
@Giuspepe
Giuseppe Cianci (Giuspepe) deleted the agents/session-history-recovery-fix branch September 16, 2026 13:55
@vs-code-engineering vs-code-engineering Bot added this to the 1.139.0 milestone Sep 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants