Skip to content

fix(tools): browser handlers TypeError on unexpected LLM params + fuzzy_match docstring - #1735

Merged
teknium1 merged 1 commit into
mainfrom
fix/tool-handler-safety
Mar 17, 2026
Merged

fix(tools): browser handlers TypeError on unexpected LLM params + fuzzy_match docstring#1735
teknium1 merged 1 commit into
mainfrom
fix/tool-handler-safety

Conversation

@teknium1

Copy link
Copy Markdown
Contributor

Summary

1. Browser tool handler safety (browser_tool.py)

browser_click, browser_type, and browser_scroll handlers used **args spread which passed ALL dict keys as keyword arguments. If the LLM sent unexpected parameters (e.g. {"ref": "@e5", "timeout": 10}), the spread would cause a TypeError: unexpected keyword argument.

Fix: Extract only the expected parameters with .get() and safe defaults, matching the pattern used by all other browser tool handlers (navigate, snapshot, vision, etc.).

2. Fuzzy match docstring (fuzzy_match.py)

The module docstring listed block_anchor as strategy #3, but it's actually #7 in the code. Multi-occurrence was listed as strategy #9 but is just the replace_all flag. Updated to match actual code order.

Test plan

  • python -m pytest tests/tools/test_fuzzy_match.py -n0 -q → 9 passed ✔

1. browser_tool.py: Replace **args spread on browser_click, browser_type,
   and browser_scroll handlers with explicit parameter extraction. The
   **args pattern passed all dict keys as keyword arguments, causing
   TypeError if the LLM sent unexpected parameters. Now extracts only
   the expected params (ref, text, direction) with safe defaults.

2. fuzzy_match.py: Update module docstring to match actual strategy
   order in code. Block anchor was listed as #3 but is actually #7.
   Multi-occurrence is not a separate strategy but a flag. Updated
   count from 9 to 8.
@teknium1
teknium1 merged commit 23a3f01 into main Mar 17, 2026
1 check passed
angelburgosrosado pushed a commit to angelburgosrosado/hermes-agent that referenced this pull request Apr 27, 2026
…er-safety

fix(tools): browser handlers TypeError on unexpected LLM params + fuzzy_match docstring
02356abc pushed a commit to 02356abc/hermes-agent that referenced this pull request May 14, 2026
…er-safety

fix(tools): browser handlers TypeError on unexpected LLM params + fuzzy_match docstring
gweeteve pushed a commit to gweeteve/hermes-agent that referenced this pull request Jun 2, 2026
…er-safety

fix(tools): browser handlers TypeError on unexpected LLM params + fuzzy_match docstring
waefrebeorn pushed a commit to waefrebeorn/slermes that referenced this pull request Jul 2, 2026
…er-safety

fix(tools): browser handlers TypeError on unexpected LLM params + fuzzy_match docstring
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