From a85f6af9c2cfd5e48b60688ee77392527d973938 Mon Sep 17 00:00:00 2001 From: Graham Neubig Date: Thu, 26 Jun 2025 23:46:37 -0400 Subject: [PATCH] Fix typing in memory module --- openhands/memory/memory.py | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/openhands/memory/memory.py b/openhands/memory/memory.py index 74ae47148b..b21063ccbf 100644 --- a/openhands/memory/memory.py +++ b/openhands/memory/memory.py @@ -292,20 +292,10 @@ class Memory: USER_MICROAGENTS_DIR ) - # Add user microagents to the collections - # User microagents can override global ones with the same name - # See https://github.com/python/mypy/issues/18440 for type narrowing issue with dict items - for name, agent_obj in knowledge_agents_dict.items(): # type: ignore[assignment] - if isinstance(agent_obj, KnowledgeMicroagent): - self.knowledge_microagents[name] = agent_obj - logger.debug(f'Loaded user knowledge microagent: {name}') - - # Process repo agents - # See https://github.com/python/mypy/issues/18440 for type narrowing issue with dict items - for name, agent_obj in repo_agents_dict.items(): # type: ignore[assignment] - if isinstance(agent_obj, RepoMicroagent): - self.repo_microagents[name] = agent_obj - logger.debug(f'Loaded user repo microagent: {name}') + for name, agent_knowledge in knowledge_agents_dict.items(): + self.knowledge_microagents[name] = agent_knowledge + for name, agent_repo in repo_agents_dict.items(): + self.repo_microagents[name] = agent_repo if repo_agents_dict or knowledge_agents_dict: logger.info(