fix(type-annotations): replace Optional[callable] with Optional[Callable[...]] in 6 files - #45651
Closed
blut-agent wants to merge 2 commits into
Closed
fix(type-annotations): replace Optional[callable] with Optional[Callable[...]] in 6 files#45651blut-agent wants to merge 2 commits into
blut-agent wants to merge 2 commits into
Conversation
added 2 commits
June 11, 2026 09:09
When the main model supports vision (supports_vision=True), images now go through the native path even if auxiliary.vision is explicitly configured. The aux override is now a fallback for non-vision models only, not a blanket override that blocks native vision. This fixes the bug where providers like Xiaomi MiMo (which has supports_vision=True) were incorrectly routed to text-only mode when auxiliary.vision was configured. Also updates the module docstring to reflect the new priority order.
…ble[...]] in 6 files The builtin callable (lowercase) is not a valid generic type for static type checkers (mypy/pyright). Replace all 7 instances of Optional[callable] with the proper typing.Callable variant across: - run_agent.py (2 instances: run_conversation forwarder + chat method) - agent/conversation_loop.py (1 instance: run_conversation signature) - gateway/stream_consumer.py (1 instance: StreamConsumer.__init__) - hermes_cli/dingtalk_auth.py (1 instance: wait_for_registration_success) - tools/delegate_tool.py (1 instance: _build_child_progress_callback return) - plugins/disk-cleanup/disk_cleanup.py (1 instance: deep() confirm param)
tonydwb
approved these changes
Jun 14, 2026
tonydwb
left a comment
There was a problem hiding this comment.
Code Review Summary
Verdict: Approved
Correctness
- Replaces bare
Optional[callable]with properly parameterizedOptional[Callable[...]]across 6 files. - Fixes type annotation correctness for Python type checkers.
Code Quality
- Changes are consistent across
conversation_loop.py,image_routing.py,gateway/stream_consumer.py,hermes_cli/dingtalk_auth.py,plugins/disk-cleanup/disk_cleanup.py, anddelegate_tool.py. - Tests updated accordingly.
No Issues Found
- No secrets, no debug artifacts.
Reviewed by Hermes Agent
This was referenced Jun 19, 2026
This was referenced Jun 22, 2026
Contributor
Author
|
Closing and recreating — this PR was opened from the fork's main branch, which is risky (future commits to main would leak into this PR). Recreating on a proper feature branch. |
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
The Python builtin
callable(lowercase) is not a valid generic type for static type checkers (mypy, pyright). UsingOptional[callable]works at runtime but flags errors in strict mode.This has been a known issue in the codebase — documented in
references/type-annotation-pitfalls.md— and affects 7 locations across 6 files.Fix
Replace all instances of
Optional[callable]with the propertyping.Callablevariant:Optional[Callable[..., None]]for no-arg callbacks (stream_callback, on_new_message, on_waiting, return type of _build_child_progress_callback)Optional[Callable[[Any], bool]]for the confirm callback in disk-cleanup (takes an item, returns bool)Files Changed
Testing
tests/hermes_cli/test_config.py— 95 passedtests/hermes_cli/test_env_load_cache.py— 6 passed