Skip to content

Feat/local search tool#893

Open
suluyana wants to merge 17 commits intomodelscope:mainfrom
suluyana:feat/local_search_tool
Open

Feat/local search tool#893
suluyana wants to merge 17 commits intomodelscope:mainfrom
suluyana:feat/local_search_tool

Conversation

@suluyana
Copy link
Copy Markdown
Collaborator

Change Summary

Related issue number

Checklist

  • The pull request title is a good summary of the changes - it will be used in the changelog
  • Unit tests for the changes exist
  • Run pre-commit install and pre-commit run --all-files before git commit, and passed lint check.
  • Documentation reflects the changes where applicable

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors the sirchmunk local search from a pre-turn RAG injection into an on-demand tool, adding support for streaming tool logs and detailed UI outputs. Key feedback identifies a fragile heuristic for detecting log lines that could cause hangs, suggesting a more robust protocol by wrapping final results in dictionaries. Other points include concerns over the simplified system prompt potentially degrading performance and the addition of unused dead code in the CLI.

Comment on lines +561 to +562
if isinstance(item, dict) or not isinstance(item, str) or \
not self._is_log_line(item):
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

This logic to differentiate between intermediate log lines and final tool results is fragile. It relies on _is_log_line, a heuristic that assumes any string not matching specific error patterns is a log. This can cause the agent to hang if a tool's final result is a simple string (e.g., "OK"), as it would be misinterpreted as a log line. The agent would then wait indefinitely for a final result. This is especially problematic for non-streaming tools that use the default ToolBase.call_tool_streaming implementation.

Comment on lines +51 to +66
def load_env_file(self):
"""Load environment variables from .env file in current directory."""
env_file = os.path.join(os.getcwd(), '.env')
if os.path.exists(env_file):
with open(env_file, 'r') as f:
for line in f:
line = line.strip()
if line and not line.startswith('#') and '=' in line:
key, value = line.split('=', 1)
key = key.strip()
value = value.strip()
# Only set if not already set in environment
if key not in os.environ:
os.environ[key] = value
logger.debug(f'Loaded {key} from .env file')

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The method load_env_file is defined but appears to be unused. The _execute_with_config method calls Env.load_dotenv_into_environ to load environment variables. This new method seems to be dead code and should be removed to avoid confusion and code clutter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant