Repository navigation
Conversation
Collaborator
|
Closing: the bundled Hindsight provider this PR patches has moved out of this repo. Thanks @zayn-0101 for this contribution. In #119888 (merge Triage notes:
If you believe this was closed in error, comment and we will reopen. (Bulk-closed in the hindsight-move close pass.) |
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.
Summary
Two small consumer-side fixes in
plugins/memory/hindsight/__init__.py:Prefetch result can leak across turns.
prefetch()unconditionallyconsumes
_prefetch_result, so a slow background recall queued at the endof turn N can surface in turn N+1's context as stale memory. This PR binds
the cached result to the exact query that produced it (
_prefetch_query+_prefetch_doneunder the existing lock) and truncates the queryidentically in both
prefetch()andqueue_prefetch()so the match holds.Results from an earlier turn are simply not consumed.
Buffered turns can be lost at shutdown. When
retain_every_n_turns > 1and a session ends below the retain cadence, the turns sitting in
_session_turnsare never handed to the retain writer.shutdown()nowcalls a new
_flush_pending_turns()before setting the shutdown flag, sothe final partial batch is retained. The append watermark is advanced for
both update modes so legacy (overwrite) servers do not re-ship turns that
were already submitted by
sync_turn().Related upstream work:
scope, not yet merged). This PR is a complementary, lighter-weight
query-level guard on the consumer side and also fixes the same-session
cross-turn case that session binding does not cover.
fix Support passing morph snapshot id #2 addresses the buffered-turns half of that class of loss.
Verification
tests/plugins/memory/test_hindsight_provider.py: 57 passedpython -m py_compile plugins/memory/hindsight/__init__.py: passedgit diff --check: passed