fix(memos-local): L2 candidate stuck + bridge subprocess leak#1933
Open
a844810597 wants to merge 2 commits into
Open
fix(memos-local): L2 candidate stuck + bridge subprocess leak#1933a844810597 wants to merge 2 commits into
a844810597 wants to merge 2 commits into
Conversation
… recheck A candidate policy whose support/gain already satisfy the promotion thresholds (support >= minSupport && gain >= minGain) but is no longer cosine-matched by any trace in subsequent episodes will never enter 'touched' and therefore nextStatus() is never executed. Add Step 5 after Step 4 to scan all candidate policies and promote any whose stored support/gain already meet the thresholds. Fixes MemTensor#1932
…el__ The keepalive thread closure in _start_bridge_keepalive captured self directly, creating a reference cycle that prevented GC from collecting the provider. Combined with the missing __del__, a leaked provider would leave its bridge subprocess (Popen) and keepalive thread alive indefinitely. Two complementary fixes: 1. weakref — break the reference cycle so GC can collect the provider when all external references are dropped. 2. __del__ — safety net that calls shutdown() during GC when the caller forgot to invoke it explicitly (e.g. model/routing change paths that assign self.agent = None without calling shutdown). Both are required: weakref enables GC collection, __del__ ensures cleanup happens when collection occurs.
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.
Fix 1: L2 Candidate Policy stuck in candidate
A candidate policy whose support/gain satisfy thresholds but is no longer
cosine-matched by any trace never enters touched and nextStatus()
is never executed. Add Step 5 after Step 4 to scan all candidate policies.
File: apps/memos-local-plugin/core/memory/l2/l2.ts +42/-1
Fix 2: Bridge subprocess leak via weakref + del
The keepalive thread closure captured self directly, creating a reference
cycle that prevented GC. Combined with missing del, leaked providers
leave bridge subprocesses alive indefinitely.
File: apps/memos-local-plugin/adapters/hermes/memos_provider/init.py +41/-8
No interface changes. Normal paths unaffected.