Skip to content

fix(tools): report partial registry construction - #1129

Merged
warren618 merged 2 commits into
HKUDS:mainfrom
er-s-an:codex/report-partial-tool-registry
Aug 18, 2026
Merged

warren618 merged 2 commits into
HKUDS:mainfrom
er-s-an:codex/report-partial-tool-registry

Conversation

@er-s-an

@er-s-an er-s-an commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Summary

  • retain module import and tool registration failures on ToolRegistry
  • emit one aggregate warning when local registry construction is partial
  • make missing-tool responses explain matching startup failures while preserving partial startup

Root cause

Tool discovery logged and discarded import failures. Callers received an apparently healthy partial registry, and later requests only saw a generic Tool not found error.

Validation

  • PYTHONPATH=agent python3 -m pytest agent/tests/test_tool_registry_diagnostics.py agent/tests/test_tool_registry_security.py -q — 4 passed
  • ruff check --ignore E402 agent/src/agent/tools.py agent/src/tools/__init__.py agent/tests/test_tool_registry_diagnostics.py
  • python3 -m compileall -q agent/src/agent/tools.py agent/src/tools/__init__.py agent/tests/test_tool_registry_diagnostics.py

The broader MCP regression module was not fully runnable in the local system Python because fastmcp and the optional web-search dependency are not installed.

Fixes #1124

er-s-an and others added 2 commits August 18, 2026 01:42
The aggregate line reports how many tool sources failed; only the
per-module record says which one. Logging it at DEBUG leaves an operator
in front of the same silent partial registry HKUDS#1124 is about, so it stays
at WARNING and a guard test pins the level.
@warren618
warren618 merged commit 9b99e25 into HKUDS:main Aug 18, 2026
8 checks passed
@warren618

Copy link
Copy Markdown
Collaborator

Merged — thank you. The shape was right where it counts: keeping the _discover_subclasses() signature meant three call sites across test_investor_lenses_skill.py and test_institutional_commands.py stayed untouched, and the exact-match lookup (name in {module_name, module_name.removesuffix("_tool")}) will not blame a failed module for an unrelated typo.

I pushed one commit to your branch before merging, so you are not surprised by it: the per-module discovery failure is back at WARNING rather than DEBUG. The aggregate line reports how many sources failed; only the per-module record says which, and #1124 is precisely about an operator not being able to see that. A guard test now pins the level, and I checked it bites — restoring DEBUG fails it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

build_registry() silently returns a partial tool registry when a tool module fails to import

2 participants