Skip to content

Comments

Fix use_partial_bind=True default causing unexpected MissingParameterError in agent.py#82

Open
Copilot wants to merge 2 commits intomainfrom
copilot/fix-missingparametererror-issue
Open

Fix use_partial_bind=True default causing unexpected MissingParameterError in agent.py#82
Copilot wants to merge 2 commits intomainfrom
copilot/fix-missingparametererror-issue

Conversation

Copy link
Contributor

Copilot AI commented Feb 19, 2026

Summary

@require_non_blank_strings("name") on ExampleAgent.run() used the default use_partial_bind=True, causing omitted calls like agent.run() to raise MissingParameterError (decorator-owned) instead of Python's native TypeError. This silently changes the public call contract of the method.

Fix: explicitly pass use_partial_bind=False so the decorator delegates missing-argument detection to Python's own signature binding:

# before
@require_non_blank_strings("name")
def run(self, name: str) -> str: ...

# after
@require_non_blank_strings("name", use_partial_bind=False)
def run(self, name: str) -> str: ...

Test: added test_run_raises_type_error_when_name_omitted to assert agent.run() raises TypeError, pinning the correct call contract.

Testing

  • Not run (why?)
  • uv run poe check
  • Other: python3 -m pytest agents/agent1/tests/ -v — 12/12 passed

Checklist

  • Linked issue or task reference
  • Added/updated tests where relevant
  • Updated docs/README if needed
  • No secrets or sensitive data added
  • Considered backward compatibility and deployment impact

Additional context

Original prompt

This section details on the original issue you should resolve

<issue_title>Fix use_partial_bind=True default causing unexpected MissingParameterError in agent.py</issue_title>
<issue_description>## Summary

Using @require_non_blank_strings("name") with the decorator's default use_partial_bind=True changes the error surfaced for missing arguments. Calling run() without name will raise MissingParameterError (from the decorator) instead of Python's usual TypeError for a missing required parameter. This changes the public call contract of the method unexpectedly.

File and Location

  • File: agents/agent1/src/python_agent_template/agents/agent1/agent.py
  • Line: 24

Original Review Comment

Using @require_non_blank_strings("name") with the decorator's default use_partial_bind=True changes the error surfaced for missing arguments: calling run() without name will now raise MissingParameterError (from the decorator) instead of Python's usual TypeError for a missing required parameter. If preserving the standard call contract matters for this public method, set use_partial_bind=False here (or change the decorator default) and add/adjust a test accordingly.

Suggested fix:

    `@require_non_blank_strings`("name", use_partial_bind=False)

Suggested Fix

Set use_partial_bind=False explicitly on the decorator (or change the decorator's default), and add/adjust a test to verify that calling run() without name raises the expected error type.

References

Generated by PR Review Comment — Create Issue for issue #51

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

…Error in agent.py

Co-authored-by: pmalarme <686568+pmalarme@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix use_partial_bind default causing MissingParameterError in agent.py Fix use_partial_bind=True default causing unexpected MissingParameterError in agent.py Feb 19, 2026
Copilot AI requested a review from pmalarme February 19, 2026 22:11
@pmalarme pmalarme marked this pull request as ready for review February 19, 2026 22:14
Copilot AI review requested due to automatic review settings February 19, 2026 22:14
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR restores the expected public call contract for ExampleAgent.run() by ensuring missing required arguments surface as Python’s native TypeError rather than the decorator’s MissingParameterError.

Changes:

  • Set use_partial_bind=False on @require_non_blank_strings for ExampleAgent.run() to avoid decorator-owned missing-argument errors.
  • Added a regression test asserting agent.run() (without name) raises TypeError.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
agents/agent1/src/python_agent_template/agents/agent1/agent.py Updates the validator decorator invocation to use full binding so omitted required args raise TypeError.
agents/agent1/tests/test_agent.py Adds a test to pin the intended TypeError behavior when name is omitted.

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.

Fix use_partial_bind=True default causing unexpected MissingParameterError in agent.py

2 participants