From 4bb845679471b27722b6b53ca683e309a7c88f8a Mon Sep 17 00:00:00 2001 From: Jah-yee Date: Mon, 2 Mar 2026 23:54:42 +0800 Subject: [PATCH 1/5] fix: replace bare except with except Exception - src/biz_layer/mem_db_operations.py line 146 - src/infra_layer/.../episodic_memory_milvus_repository.py line 127 Bare except catches BaseException including KeyboardInterrupt and SystemExit. Using except Exception preserves fallback behavior while allowing system exceptions to propagate. Fixes #98 --- src/biz_layer/mem_db_operations.py | 2 +- .../out/search/repository/episodic_memory_milvus_repository.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/biz_layer/mem_db_operations.py b/src/biz_layer/mem_db_operations.py index 66519a42..03800bfd 100644 --- a/src/biz_layer/mem_db_operations.py +++ b/src/biz_layer/mem_db_operations.py @@ -143,7 +143,7 @@ def _convert_timestamp_to_time( try: dt = from_iso_format(timestamp) return to_iso_format(dt) - except: + except Exception: # If parsing fails, return string directly return timestamp else: diff --git a/src/infra_layer/adapters/out/search/repository/episodic_memory_milvus_repository.py b/src/infra_layer/adapters/out/search/repository/episodic_memory_milvus_repository.py index 4aad056b..7b1e7131 100644 --- a/src/infra_layer/adapters/out/search/repository/episodic_memory_milvus_repository.py +++ b/src/infra_layer/adapters/out/search/repository/episodic_memory_milvus_repository.py @@ -124,7 +124,7 @@ async def create_and_save_episodic_memory( metadata_json = metadata try: metadata_dict = json.loads(metadata) - except: + except Exception: metadata_dict = {} # Prepare entity data From a565dde445880d4528013d26428486bc9ffbd49e Mon Sep 17 00:00:00 2001 From: Jah-yee Date: Mon, 2 Mar 2026 23:56:12 +0800 Subject: [PATCH 2/5] fix: remove duplicate rrf mode in docstring In simple_memory_manager.py search() method docstring, the "rrf" retrieval mode was listed twice. Removed the first occurrence as the second is more descriptive. Fixes #97 --- demo/utils/simple_memory_manager.py | 1 - 1 file changed, 1 deletion(-) diff --git a/demo/utils/simple_memory_manager.py b/demo/utils/simple_memory_manager.py index f5526650..b0b2908e 100644 --- a/demo/utils/simple_memory_manager.py +++ b/demo/utils/simple_memory_manager.py @@ -244,7 +244,6 @@ async def search( query: Query text top_k: Number of results to return (default: 3) mode: Retrieval mode (default: "rrf") - - "rrf": RRF fusion (recommended) - "keyword": Keyword retrieval (BM25) - "vector": Vector retrieval - "hybrid": Keyword + Vector + Rerank From 5dd100474bbb893a998e3e72a86a721bc4be2275 Mon Sep 17 00:00:00 2001 From: Jah-yee Date: Mon, 2 Mar 2026 23:58:10 +0800 Subject: [PATCH 3/5] chore: remove unused MongoDB init script volume mount The ./docker/mongodb/init:/docker-entrypoint-initdb.d volume mount in docker-compose.yaml references a directory that never existed. MongoDB initialization is handled at the application layer (Beanie ODM + migration manager), not via Docker init scripts. Fixes #90 --- docker-compose.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/docker-compose.yaml b/docker-compose.yaml index 29407030..373f860b 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -14,7 +14,6 @@ services: - "27017:27017" volumes: - mongodb_data:/data/db - - ./docker/mongodb/init:/docker-entrypoint-initdb.d networks: - memsys-network healthcheck: From 240133a417ad61f61ed41244336e1bddad62384d Mon Sep 17 00:00:00 2001 From: Jah-yee Date: Tue, 3 Mar 2026 02:07:43 +0800 Subject: [PATCH 4/5] fix: enforce ISO 8601 timestamp format in episodic memory prompts Issue #48: Inconsistent timestamp formats in episodic memories Changes: - Updated EPISODE_GENERATION_PROMPT to enforce strict ISO 8601 format - Examples of correct format: 2026-01-23T02:19:25Z or 2026-01-23T10:07:00+08:00 - Explicitly prohibits Chinese characters, weekdays, and partial times This ensures consistent timestamp parsing, sorting, and filtering in downstream operations. --- src/memory_layer/prompts/en/episode_mem_prompts.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/memory_layer/prompts/en/episode_mem_prompts.py b/src/memory_layer/prompts/en/episode_mem_prompts.py index 3ff63378..364bf588 100644 --- a/src/memory_layer/prompts/en/episode_mem_prompts.py +++ b/src/memory_layer/prompts/en/episode_mem_prompts.py @@ -17,12 +17,12 @@ Custom instructions: {custom_instructions} -IMPORTANT TIME HANDLING: -- Use the provided "Conversation start time" as the exact time when this conversation/episode began -- When the conversation mentions relative times (e.g., "yesterday", "last week"), preserve both the original relative expression AND calculate the absolute date -- Format time references as: "original relative time (absolute date)" - e.g., "last week (May 7, 2023)" -- This dual format supports both absolute and relative time-based questions -- All absolute time calculations should be based on the provided start time +IMPORTANT TIME HANDLING (STRICT ISO 8601): +- Always use ISO 8601 format with timezone: YYYY-MM-DDTHH:MM:SSZ or YYYY-MM-DDTHH:MM:SS+HH:MM +- Example correct formats: 2026-01-23T02:19:25Z or 2026-01-23T10:07:00+08:00 +- NEVER use Chinese characters (年, 月, 日), weekdays, or partial times +- Example incorrect: "2026年1月22日11:25:33" or "2026年1月23日 02:19:25 UTC" +- Always convert relative times to absolute ISO 8601 format Please generate a structured episodic memory and return only a JSON object containing the following two fields: {{ From ea43b04f8320a7f31e5fd8c820a0af35fc8a1f80 Mon Sep 17 00:00:00 2001 From: Jah-yee Date: Tue, 3 Mar 2026 02:16:53 +0800 Subject: [PATCH 5/5] fix: enforce ISO 8601 timestamp format in Chinese prompts too Extends the timestamp format fix to Chinese language prompts as well. --- src/memory_layer/prompts/zh/episode_mem_prompts.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/memory_layer/prompts/zh/episode_mem_prompts.py b/src/memory_layer/prompts/zh/episode_mem_prompts.py index b32822d7..b9cbfe22 100644 --- a/src/memory_layer/prompts/zh/episode_mem_prompts.py +++ b/src/memory_layer/prompts/zh/episode_mem_prompts.py @@ -20,6 +20,12 @@ 自定义指令: {custom_instructions} +重要时间格式要求(必须遵守): +- 必须使用ISO 8601格式:YYYY-MM-DDTHH:MM:SSZ 或 YYYY-MM-DDTHH:MM:SS+HH:MM +- 正确示例:2026-01-23T02:19:25Z 或 2026-01-23T10:07:00+08:00 +- 禁止使用中文时间格式(如2026年1月22日11:25:33)、星期几、部分时间 +- 相对时间(如昨天、上周)必须转换为绝对ISO 8601格式 + 请遵循以下指导原则: 1. **叙事性与连贯性**: