From 8a1aeef58015d2512d8227a0413534182ba8619d Mon Sep 17 00:00:00 2001 From: sa-buc Date: Wed, 5 Aug 2026 18:49:44 +0800 Subject: [PATCH] fix(search_v2): use existence check for strict_date_filter boolean override Replace 'context_value or yaml_value' with an existence-based check so that a runtime-injected False can explicitly disable a YAML-true strict_date_filter flag, consistent with the read_step_format_session fix. --- reme/steps/index/search.py | 9 ++++++--- reme/steps/index/search_v2.py | 12 +++++++----- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/reme/steps/index/search.py b/reme/steps/index/search.py index 9fee48a5..707359c4 100644 --- a/reme/steps/index/search.py +++ b/reme/steps/index/search.py @@ -158,9 +158,12 @@ class SearchStep(BaseStep): expand_links_enabled: bool = bool(self.kwargs.get("expand_links", True)) max_links_per_direction: int = int(self.kwargs.get("max_links_per_direction", 10)) tool_context_id: str = (self.context.get("tool_context_id", "") or "").strip() - strict_date_filter: bool = bool( - self.context.get("strict_date_filter") or self.kwargs.get("strict_date_filter", False), - ) + # Injected value takes precedence over YAML kwargs; check existence + # (not truthiness) so an explicit False can disable a YAML-true flag. + _strict_date_filter = self.context.get("strict_date_filter") + if _strict_date_filter is None: + _strict_date_filter = self.kwargs.get("strict_date_filter", False) + strict_date_filter: bool = bool(_strict_date_filter) if not query: self.context.response.success = False diff --git a/reme/steps/index/search_v2.py b/reme/steps/index/search_v2.py index 0ea4b2ed..bdeb91e0 100644 --- a/reme/steps/index/search_v2.py +++ b/reme/steps/index/search_v2.py @@ -118,9 +118,12 @@ class SearchV2Step(_ToolContextDedupMixin, BaseStep): expand_links_enabled: bool = bool(self.kwargs.get("expand_links", True)) max_links_per_direction: int = int(self.kwargs.get("max_links_per_direction", 10)) tool_context_id: str = (self.context.get("tool_context_id", "") or "").strip() - strict_date_filter: bool = bool( - self.context.get("strict_date_filter") or self.kwargs.get("strict_date_filter", False), - ) + # Injected value takes precedence over YAML kwargs; check existence + # (not truthiness) so an explicit False can disable a YAML-true flag. + _strict_date_filter = self.context.get("strict_date_filter") + if _strict_date_filter is None: + _strict_date_filter = self.kwargs.get("strict_date_filter", False) + strict_date_filter: bool = bool(_strict_date_filter) if not query: self.context.response.success = False @@ -302,8 +305,7 @@ class SearchV2Step(_ToolContextDedupMixin, BaseStep): response = await self.run_job("compressor", text=body, queries=queries) except Exception as exc: # pylint: disable=broad-except self.logger.warning( - f"[{self.name}] session body compression raised path={path!r} " - f"error={exc!r}; keeping original", + f"[{self.name}] session body compression raised path={path!r} " f"error={exc!r}; keeping original", ) return compressed = str(response.answer or "").strip()