fix: filter LLM-hallucinated parameters in skill execution#362
Open
LegionInterns wants to merge 1 commit intomainfrom
Open
fix: filter LLM-hallucinated parameters in skill execution#362LegionInterns wants to merge 1 commit intomainfrom
LegionInterns wants to merge 1 commit intomainfrom
Conversation
When the LLM hallucinates parameters not accepted by a skill function
(e.g. passing {"raw": ""} to vault_list()), the skill crashes with
TypeError. This was causing persistent failures on all zero-parameter
tools: vault_list, browser_snapshot, browser_reset, browser_solve_captcha,
reload_skills, and list_subagents.
Fix: Before calling the skill function, inspect its signature and filter
out any arguments it doesn't accept. Functions with **kwargs still
receive all arguments. Extra params are logged at debug level.
Adds 4 tests covering: zero-param functions, mixed valid+extra params,
**kwargs passthrough, and async functions.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When the LLM hallucinates parameters not accepted by a skill function (e.g. passing
{"raw": ""}tovault_list()), the skill crashes withTypeError. This was causing persistent failures on all zero-parameter tools:vault_list,browser_snapshot,browser_reset,browser_solve_captcha,reload_skills, andlist_subagents.Fix
Before calling the skill function, inspect its signature and filter out any arguments it doesn't accept. Functions with
**kwargsstill receive all arguments. Extra params are logged at debug level.Changes
src/agent/skills.py: Added parameter filtering inSkillRegistry.execute()— checks function signature and drops unknown args before callingtests/test_skills.py: Added 4 tests covering: zero-param functions, mixed valid+extra params,**kwargspassthrough, and async functionsTesting
All existing tests pass + 4 new tests added.