fix: exclude current session from session_search results
session_search was returning the current session if it matched the query, which is redundant — the agent already has the current conversation context. This wasted an LLM summarization call and a result slot. Added current_session_id parameter to session_search(). The agent passes self.session_id and the search filters out any results where either the raw or parent-resolved session ID matches. Both the raw match and the parent-resolved match are checked to handle child sessions from delegation. Two tests added verifying the exclusion works and that other sessions are still returned.
This commit is contained in:
parent
021f62cb0c
commit
70a0a5ff4a
3 changed files with 70 additions and 2 deletions
|
|
@ -2476,6 +2476,7 @@ class AIAgent:
|
|||
role_filter=function_args.get("role_filter"),
|
||||
limit=function_args.get("limit", 3),
|
||||
db=self._session_db,
|
||||
current_session_id=self.session_id,
|
||||
)
|
||||
tool_duration = time.time() - tool_start_time
|
||||
if self.quiet_mode:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue