Skip to content

fix(type-annotation): replace Optional[callable] with Optional[Callable[..., None]] - #49072

Closed
blut-agent wants to merge 1 commit into
NousResearch:mainfrom
blut-agent:fix/type-annotation-callbacks
Closed

fix(type-annotation): replace Optional[callable] with Optional[Callable[..., None]]#49072
blut-agent wants to merge 1 commit into
NousResearch:mainfrom
blut-agent:fix/type-annotation-callbacks

Conversation

@blut-agent

Copy link
Copy Markdown
Contributor

What

Replace 4 instances of Optional[callable] (Python builtin callable) with proper Optional[Callable[...]] from typing.

The builtin callable (lowercase) is not a valid generic type for static type checkers. Using Optional[callable] works at runtime but will flag errors in strict mypy/pyright mode.

Changes

File Parameter/Return Before After
hermes_cli/dingtalk_auth.py on_waiting param Optional[callable] Optional[Callable[[], None]]
tools/delegate_tool.py return type Optional[callable] Optional[Callable[..., None]]
agent/conversation_loop.py stream_callback param Optional[callable] Optional[Callable[[], None]]
gateway/stream_consumer.py on_new_message param Optional[callable] Optional[Callable[[], None]]

Context

This is a regression of PR #45651 (2026-06-13) which fixed 7 instances across 6 files. New code added since then re-introduced 4 more instances.

Impact

  • Type checkers: Eliminates Optional[callable] errors in strict mypy/pyright mode
  • Runtime: No behavioral change — callable and Callable are equivalent at runtime
  • Scope: 4 files, 7 lines changed (4 import additions + 4 annotation replacements)

…le[..., None]]

The builtin callable is not a valid generic type for static type checkers.
Using Optional[callable] works at runtime but flags errors in strict
mypy/pyright mode. All 4 instances replaced with proper Callable types:

- hermes_cli/dingtalk_auth.py: on_waiting parameter
- tools/delegate_tool.py: _build_child_progress_callback return type
- agent/conversation_loop.py: stream_callback parameter
- gateway/stream_consumer.py: on_new_message parameter

This is a regression of PR NousResearch#45651 which fixed 7 instances in June but
new code re-introduced 4 more since then.
@alt-glitch alt-glitch added type/refactor Code restructuring, no behavior change P3 Low — cosmetic, nice to have comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint comp/gateway Gateway runner, session dispatch, delivery comp/cli CLI entry point, hermes_cli/, setup wizard tool/delegate Subagent delegation labels Jun 19, 2026
@blut-agent

Copy link
Copy Markdown
Contributor Author

Closing — duplicate of earlier PR #45651 or #33699/#32519. See the canonical PR for tracking.

@blut-agent blut-agent closed this Jun 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint comp/cli CLI entry point, hermes_cli/, setup wizard comp/gateway Gateway runner, session dispatch, delivery P3 Low — cosmetic, nice to have tool/delegate Subagent delegation type/refactor Code restructuring, no behavior change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants