Skip to content

fix(type-annotation): replace Optional[callable] with proper Callable types - #50176

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

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

Conversation

@blut-agent

Copy link
Copy Markdown
Contributor

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 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):

File Change
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 Optional[callable]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]]

Verification: grep -rn 'Optional\[callable\]' --include='*.py' returns zero matches.

… 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]]
@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/cli CLI entry point, hermes_cli/, setup wizard comp/gateway Gateway runner, session dispatch, delivery 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 21, 2026
@alt-glitch

Copy link
Copy Markdown

Duplicate of #45651 — same author's third re-file of the identical Optional[callable]Optional[Callable[...]] cleanup across the same 6 files. #45651 (2026-06-13) is the earliest-open canonical version; #49072 and #49639 are the intervening twins. Bug is still live on main (all 7 sites present), so the fix is valid — it just needs the canonical PR merged rather than another resubmission.

@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