Conversation
Co-authored-by: openhands <openhands@all-hands.dev>
|
@OpenHands please fix all checks on this PR. |
|
I'm on it! simonrosenberg can track my progress at all-hands.dev |
- Updated MCP tests to extract single tool from Sequence returned by create() - Fixed MCP utils._list_tools to properly flatten tool sequences into list - Fixed agent serialization test helper function - All MCP tests now pass and pre-commit checks pass Co-authored-by: openhands <openhands@all-hands.dev>
SummaryI have successfully fixed all the failing checks on PR #461 for typing issue #460. The problem was that Changes Made:
Results:✅ All pre-commit checks now pass: formatting, linting, and strict type checking The changes have been committed and pushed to the |
|
Looks like there are a few issues preventing this PR from being merged!
If you'd like me to help, just leave a comment, like Feel free to include any additional details that might help me get this PR into a better state. You can manage your notification settings |
The TYPE_CHECKING import was not needed because: - BashExecutor is not used in any type annotations in this file - Only runtime usage is in the create() method with local import - Circular import is already handled by the local import pattern Co-authored-by: openhands <openhands@all-hands.dev>
…ition FileEditorExecutor is not used in any type annotations in this file. The only usage is in docstrings and runtime imports in the create() method. The conditional TYPE_CHECKING import pattern was leftover from a previous version and is no longer needed. Co-authored-by: openhands <openhands@all-hands.dev>
The InitializedTool protocol was adding complexity beyond the core typing improvements. This change focuses the PR on the essential typing fixes: - Tool.create() returns Sequence[Tool] instead of Self | list[Self] - Eliminates consumer-side type narrowing - Maintains backward compatibility Co-authored-by: openhands <openhands@all-hands.dev>
…-AI/agent-sdk into openhands/fix-typing-issue-460
|
Agent Server image for this PR Pull (multi-arch manifest): docker pull ghcr.io/all-hands-ai/agent-server:656f63fRun: docker run -it --rm \
-p 8000:8000 \
--name agent-server-656f63f \
ghcr.io/all-hands-ai/agent-server:656f63fThis tag is a multi-arch manifest (amd64/arm64). Your client pulls the right arch automatically. |
Summary
This PR addresses issue #460 by tightening typing throughout the codebase to eliminate vague unions, optional runtime fields, and consumer-side narrowing patterns.
Changes Made
1. Fixed Union Return Types
Tool.create()signature: Changed fromSelf | list[Self]toSequence["Self"]for consistent collection returnsSequence[Tool]consistently2. Removed Optional Runtime Fields
3. Eliminated Consumer-Side Type Narrowing
isinstance()checksSequence[Tool]consistentlySequence[Tool]4. Added Comprehensive Tests
test_typing_improvements.py: 5 new tests covering:Technical Details
Before (problematic patterns):
After (clean patterns):
Testing
Impact
isinstance()checks needed in hot pathsBackward Compatibility
Fixes #460
@simonrosenberg can click here to continue refining the PR