Skip to content

fix(memory): offline_update_trigger=True raises TypeError (wrong keyword for offline_update_all_entries) - #80

Open
Anai-Guo wants to merge 1 commit into
zjunlp:mainfrom
Anai-Guo:fix/offline-update-kwarg
Open

fix(memory): offline_update_trigger=True raises TypeError (wrong keyword for offline_update_all_entries)#80
Anai-Guo wants to merge 1 commit into
zjunlp:mainfrom
Anai-Guo:fix/offline-update-kwarg

Conversation

@Anai-Guo

Copy link
Copy Markdown

Problem

LightMemory.offline_update() triggers the offline update pass with a keyword the callee does not accept:

https://github.com/zjunlp/LightMem/blob/main/src/lightmem/memory/lightmem.py#L453-L457

if offline_update_trigger:
    self.logger.info(f"[{call_id}] Triggering offline update for all entries")
    self.offline_update_all_entries(
        update_sim_threshold = 0.8
    )

but the method is declared as (lightmem.py:541):

def offline_update_all_entries(self, score_threshold: float = 0.9, max_workers: int = 5):

So any call to offline_update(..., offline_update_trigger=True) raises

TypeError: LightMemory.offline_update_all_entries() got an unexpected keyword argument 'update_sim_threshold'

right after the "Triggering offline update for all entries" line is logged — the offline update never runs.

Why score_threshold is the intended name

update_sim_threshold appears exactly once in the whole repository — at this call site. Every other caller of the same method uses score_threshold, and two of them use the same 0.8 value:

call site keyword
experiments/longmemeval/offline_update.py:41 score_threshold=0.8
experiments/locomo/add_locomo.py:447 score_threshold=0.9
mcp/server.py:200 score_threshold=score_threshold
README.md:327 score_threshold=0.8

The sibling trigger immediately above (construct_update_queue_all_entries(top_k=20, keep_top_n=10)) already uses the callee's real parameter names, which makes this the one call site that drifted.

Fix

One-line rename of the keyword at the call site. The intended value (0.8, overriding the 0.9 default) is preserved.

Verification

Signature replay against the real source (parameters extracted from lightmem.py with ast, annotations/defaults stripped, then inspect.Signature.bind):

signature: (self, score_threshold=None, max_workers=None)
  update_sim_threshold=0.8 -> TypeError: got an unexpected keyword argument 'update_sim_threshold'
  score_threshold=0.8      -> OK

I do not have the vector-store/LLM backends configured locally, so this is a static verification of the call rather than an end-to-end offline-update run.

🤖 Generated with Claude Code

offline_update() passes update_sim_threshold=0.8, but
offline_update_all_entries() takes score_threshold. Setting
offline_update_trigger=True therefore raises TypeError before any
offline update runs. score_threshold is the name used by every other
call site in the repo (experiments/, mcp/server.py, README).

Signed-off-by: Tai An <antai12232931@outlook.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant