Skip to content

fix(type-annotation): replace lowercase callable with proper Callable types - #49639

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

fix(type-annotation): replace lowercase callable with proper Callable types#49639
blut-agent wants to merge 1 commit into
NousResearch:mainfrom
blut-agent:fix/type-annotation-callable-june20

Conversation

@blut-agent

Copy link
Copy Markdown
Contributor

Summary

The Python 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.

This was previously fixed in PR #45651 (June 13) but re-introduced in PR #49072 (June 19).

Changes

Replaced 7 instances of Optional[callable] with proper Callable types across 6 files:

File Type
tools/delegate_tool.py Callable[..., None] (generic callback)
hermes_cli/dingtalk_auth.py Callable[[], None] (no-arg callback)
plugins/disk-cleanup/disk_cleanup.py Callable[[Dict[str, Any]], bool] (confirm callback)
run_agent.py Callable[[Optional[str]], None] (stream delta callback, 2 instances)
agent/conversation_loop.py Callable[[Optional[str]], None] (stream delta callback)
gateway/stream_consumer.py Callable[[], None] (no-arg callback)

Verification

  • grep -rn "Optional\[callable\]" returns zero matches
  • All files pass lint checks
  • Diff is minimal: 6 files, 11 insertions, 11 deletions

… types

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

Replaced 7 instances across 6 files with proper Callable types:
- tools/delegate_tool.py: Callable[..., None] (generic callback)
- hermes_cli/dingtalk_auth.py: Callable[[], None] (no-arg callback)
- plugins/disk-cleanup/disk_cleanup.py: Callable[[Dict[str, Any]], bool] (confirm callback)
- run_agent.py: Callable[[Optional[str]], None] (stream delta callback, 2 instances)
- agent/conversation_loop.py: Callable[[Optional[str]], None] (stream delta callback)
- gateway/stream_consumer.py: Callable[[], None] (no-arg callback)

This is a regression fix — the type was fixed in PR NousResearch#45651 (June 13) but
re-introduced in PR NousResearch#49072 (June 19).
@alt-glitch alt-glitch added type/refactor Code restructuring, no behavior change 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 comp/plugins Plugin system and bundled plugins tool/delegate Subagent delegation P3 Low — cosmetic, nice to have duplicate This issue or pull request already exists labels Jun 20, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Duplicate of #45651 — same author (blut-agent), same Optional[callable] -> Callable[...] mechanism at the same call sites. #45651 (opened June 13) is the earliest open twin and covers a superset of these files (it also includes agent/image_routing.py + a test). The 7 lowercase-callable annotations are still live on main (none of the prior PRs merged), so the fix is valid — it just duplicates the earlier open PR. Related: #49072, #45641.

@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 comp/plugins Plugin system and bundled plugins duplicate This issue or pull request already exists 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