fix(session_search): let unset mode flow to config-resolved default

The registry handler hardcoded mode=args.get("mode", "summary") and the
function signature defaulted to "summary", which together made the
tools.session_search.default_mode config knob structurally unreachable
from real tool calls — _resolve_user_default_mode() only fires when
mode is None/empty, but neither path ever delivered None.

Drop both "summary" fallbacks so an omitted mode flows through as None
and the config-resolution branch can run.

Adds two tests: a static guard on the registry handler source pattern
(mirroring the existing run_agent.py one) and an end-to-end regression
that dispatches through the registry with default_mode='fast' configured
and asserts result["mode"] == "fast".
This commit is contained in:
yoniebans
2026-05-13 16:40:43 +02:00
parent 8709e1ebec
commit 2bed2124a4
2 changed files with 58 additions and 2 deletions
+2 -2
View File
@@ -745,7 +745,7 @@ def session_search(
limit: int = 3,
db=None,
current_session_id: str = None,
mode: str = "summary",
mode: str = None,
# Guided-mode-only parameters: anchored drill-down into one or more
# session+message pairs. Required when mode='guided', ignored otherwise.
# Use either the single-anchor pair (session_id + around_message_id) or
@@ -1209,7 +1209,7 @@ registry.register(
query=args.get("query") or "",
role_filter=args.get("role_filter"),
limit=args.get("limit", 3),
mode=args.get("mode", "summary"),
mode=args.get("mode"),
session_id=args.get("session_id"),
around_message_id=args.get("around_message_id"),
window=args.get("window", 5),