Skip to content

fix: filter LLM-hallucinated parameters in skill execution#362

Open
LegionInterns wants to merge 1 commit intomainfrom
fix/skill-param-filter
Open

fix: filter LLM-hallucinated parameters in skill execution#362
LegionInterns wants to merge 1 commit intomainfrom
fix/skill-param-filter

Conversation

@LegionInterns
Copy link
Collaborator

Problem

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.

Changes

  • src/agent/skills.py: Added parameter filtering in SkillRegistry.execute() — checks function signature and drops unknown args before calling
  • tests/test_skills.py: Added 4 tests covering: zero-param functions, mixed valid+extra params, **kwargs passthrough, and async functions

Testing

All existing tests pass + 4 new tests added.

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.
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