fix: preserve full conversation history when restoring checkpoints before context compression #9311
+267
−2
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
This PR attempts to address Issue #9308. When context compression occurs (either manually or automatically), the checkpoint system now preserves the full API conversation history alongside file checkpoints, allowing users to restore to the pre-compression state.
Problem
Previously, when context was compressed, the API conversation history was permanently modified. Restoring checkpoints would only restore file changes but not the conversation state, leaving users stuck with compressed context even when rolling back to earlier checkpoints.
Solution
Changes
saveApiHistorySnapshot()andrestoreApiHistorySnapshot()methods to the checkpoint serviceTesting
Fixes #9308
Feedback and guidance are welcome!
Important
This PR enhances the checkpoint system to save and restore full API conversation history, ensuring restoration of pre-compression states.
saveApiHistorySnapshot()andrestoreApiHistorySnapshot()toShadowCheckpointService.checkpointSave()andcheckpointRestore()inindex.tsto handle API history snapshots.api-snapshots.spec.tsfor API history snapshot functionality.checkpoint.test.tsto mock new methods and test fallback behavior.This description was created by
for 5b4dedb. You can customize this summary. It will automatically update as commits are pushed.