Repository navigation
fix(compaction): recover the correct occurrence of reused tool calls - #7583
Open
LingYi-Liang wants to merge 1 commit into
Open
LingYi-Liang wants to merge 1 commit into
LingYi-Liang wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request refactors the _recover_compacted_function_calls function in _compaction.py to correctly handle cases where function call IDs are reused. It resolves ownership of responses to the latest preceding call with the same ID in source order, utilizing object IDs and composite keys to track events and prevent incorrect associations or duplicate reinjections. Additionally, comprehensive unit tests have been added to verify this behavior under various scenarios, including resumed responses and parallel calls. I have no feedback to provide as there are no review comments to address and the implementation looks solid.
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.
Link to Issue or Description of Change
Compaction recovery can pair a resumed result with an older call when IDs are reused, or recover a sibling's result from another call. Match responses to their original call occurrence before restoring events; preserve full call events and thought signatures.
Testing Plan
20 compaction tests pass on Python 3.11–3.14; seven fail on the baseline. Includes four-turn Runner replays with in-memory and SQLite sessions using
MockModel.Full tox is not green. Failures also occur on the baseline or in independent flaky checks; details below.
Full matrix results
Linux, base
cb47e7b, fulltests/unitteststhrough tox. Used the same--no-install-package lancedbexception as upstream CI. Failed nodes were rerun against the unchanged baseline implementation in each environment.The random sample fails on both trees with tracing enabled. The packaged-skill assertion is intermittent on both trees; the changed helper is never called in these probes. Telemetry and localhost HTTP failures also reproduce on the baseline.
Checklist