fix(type-annotation): replace Optional[callable] with proper Callable types - #50176
Closed
blut-agent wants to merge 1 commit into
Closed
blut-agent wants to merge 1 commit into
blut-agent wants to merge 1 commit into
Conversation
… types The Python builtin callable (lowercase) is not a valid generic type for static type checkers like mypy/pyright. Using Optional[callable] works at runtime but produces type-checking errors in strict mode. This bug has persisted since the original fix attempt on 2026-06-13. All 7 instances across 6 files replaced with proper Callable types. Files: - tools/delegate_tool.py — Optional[callable] → Optional[Callable[..., None]] - hermes_cli/dingtalk_auth.py — Optional[callable] → Optional[Callable[[], None]] - plugins/disk-cleanup/disk_cleanup.py — Optional[callable] → Optional[Callable[[Dict[str, Any]], bool]] - run_agent.py — 2 instances → Optional[Callable[[Optional[str]], None]] - agent/conversation_loop.py — Optional[callable] → Optional[Callable[[Optional[str]], None]] - gateway/stream_consumer.py — Optional[callable] → Optional[Callable[[], None]]
|
Duplicate of #45651 — same author's third re-file of the identical |
Contributor
Author
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.
The Python builtin
callable(lowercase) is not a valid generic type for static type checkers like mypy/pyright. UsingOptional[callable]works at runtime but produces type-checking errors in strict mode.This has been a persistent bug — the original fix on 2026-06-13 was never merged, and all 7 instances across 6 files still use the invalid annotation.
Files changed (6 files, 11 insertions, 11 deletions):
tools/delegate_tool.pyOptional[callable]→Optional[Callable[..., None]]hermes_cli/dingtalk_auth.pyOptional[callable]→Optional[Callable[[], None]]plugins/disk-cleanup/disk_cleanup.pyOptional[callable]→Optional[Callable[[Dict[str, Any]], bool]]run_agent.pyOptional[callable]→Optional[Callable[[Optional[str]], None]]agent/conversation_loop.pyOptional[callable]→Optional[Callable[[Optional[str]], None]]gateway/stream_consumer.pyOptional[callable]→Optional[Callable[[], None]]Verification:
grep -rn 'Optional\[callable\]' --include='*.py'returns zero matches.