Skip to content

Comments

Fix args_to_skip validation failure for dict type parameters#674

Merged
willccbb merged 3 commits intomainfrom
daniel/skip-oai-schema-validation
Jan 8, 2026
Merged

Fix args_to_skip validation failure for dict type parameters#674
willccbb merged 3 commits intomainfrom
daniel/skip-oai-schema-validation

Conversation

@rasdani
Copy link
Contributor

@rasdani rasdani commented Dec 31, 2025

Description

  • Filters function signature before schema generation to avoid strict JSON schema validation errors on skipped parameters
  • Parameters with dict type (which produce additionalProperties: true) no longer cause validation failures when listed in args_to_skip

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Test improvement

Testing

  • All existing tests pass when running uv run pytest locally.
  • New tests have been added to cover the changes

Checklist

  • My code follows the style guidelines of this project as outlined in AGENTS.md
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • Any dependent changes have been merged and published

Additional Notes


Note

Prevents schema validation issues when skipping non-JSON-friendly params by filtering function signatures prior to tool schema generation.

  • Adds filter_signature to create a non-mutating wrapper with a reduced signature and annotations
  • Updates StatefulToolEnv.add_tool to generate the OpenAI schema from the filtered signature
  • Ensures skipped dict-typed params are excluded from parameters.properties
  • Adds tests verifying dict-arg skipping and that original/bound method signatures and annotations remain unchanged

Written by Cursor Bugbot for commit 0860463. This will update automatically on new commits. Configure here.

@willccbb
Copy link
Member

willccbb commented Jan 3, 2026

looks good! can we fix ty pls :) @rasdani

@rasdani
Copy link
Contributor Author

rasdani commented Jan 7, 2026

@cursoragent please fix Ty ci check

@cursor
Copy link

cursor bot commented Jan 7, 2026

Excellent! The ty check now passes with exit code 0, which means the CI check will pass.

Summary

I've successfully fixed the Ty CI check failure. The issue was that the type checker (ty) couldn't recognize that we were setting the __signature__ attribute on a function object, which caused an unresolved-attribute error.

The fix:

  • Changed from direct attribute assignment (wrapper.__signature__ = ...) to using setattr(wrapper, "__signature__", ...)
  • Applied the same pattern to all four attribute assignments (__name__, __doc__, __signature__, __annotations__)
  • This approach is cleaner and avoids type checker errors while maintaining the same functionality

Verification:

  • ty check verifiers now passes with exit code 0 (no errors, only pre-existing warnings about optional dependencies)
  • ✅ All relevant tests pass (test_stateful_tool_env.py, test_tool_env.py, test_environment.py)
  • ✅ Ruff linter passes with no issues
  • ✅ The fix is minimal and non-invasive (only 4 lines changed)

Open in Cursor Open in Web

Learn more about Cursor Agents

Co-authored-by: daniel <daniel@ellamind.com>
@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ rasdani
❌ cursoragent
You have signed the CLA already but the status is still pending? Let us recheck it.

@rasdani rasdani requested a review from willccbb January 8, 2026 17:22
@willccbb willccbb merged commit 282294d into main Jan 8, 2026
6 checks passed
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.

4 participants