fix: replay undo histories that exceed the rollback boundary - #939
Merged
Conversation
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.
Undo previously resumed at a matching prefix and delivered only the final user message even when the request contained edited intermediate turns. Those turns disappeared from the SDK input. Require the preserved prefix to cover every message before the final user turn, and replay the full request otherwise. If the adjacent rollback UUID is unavailable, use the existing full-replay fallback instead of an older checkpoint that omits intervening turns.
Adds content-free
undo-gapdiagnostics, five pure regression tests, four HTTP cases, and a repeatable real-SDK E2E gate. Ordinary undo retains its rollback behavior; unsafe boundaries incur a fresh replay to preserve the supplied history.Validation:
npm test: 3,306 passed, one existing skip, zero failures.npm run typecheckandnpm run buildpassed.CI also exposed an existing test race: the cancellation test assumed request setup finished within 40 ms. A separate test-only commit reproduces it with a 75 ms delayed body, waits for actual SDK queue admission before cancelling, and always releases the holder. The delayed case failed before that correction and passes afterward. The final full local suite again passes all 3,306 tests (one existing skip).
Fixes #817.