feat: create visible checkpoint before context management events #10502
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.
Related GitHub Issue
Closes: #9334
Description
This PR attempts to address Issue #9334, which requests creating visible checkpoints before each context-management event.
Background: A previous implementation (PR #9335) was closed because it used
suppressMessage=true, which hid the checkpoints from users. This new implementation fixes that by usingsuppressMessage=falseto make checkpoints visible in the chat.Key implementation details:
checkpointSave(true, false)) before context condensation in three locations:condenseContext()- Manual context compression triggered by the userattemptApiRequest()- Automatic context management whencontextManagementWillRun && autoCondenseContexthandleContextWindowExceededError()- Context compression triggered by context window exceeded errorsDesign choice: Using
suppressMessage=false(the second parameter tocheckpointSave) ensures the checkpoint notification appears in the chat, allowing users to see when a checkpoint was created and enabling them to revert to it if needed.Feedback and guidance are welcome.
Test Procedure
pnpm run check-typespnpm run test -- core/task(366 test files, 5122 tests)pnpm run lintManual testing approach:
Pre-Submission Checklist
Documentation Updates
Additional Notes
This implementation follows the same pattern as other
checkpointSavecalls in the codebase. Theforce=trueparameter ensures a checkpoint is created even if one was recently made, whilesuppressMessage=falsemakes the checkpoint visible to users.