fix: clear CodeQL alerts on agent_tools tool registration - #397
Merged
Conversation
Addresses the remaining code-scanning comments from the main->staging PR #396 (alerts 417-419 were already fixed on main by b6a95a8/7a0a51b8): - harness/base.py: replace the ineffectual "..." ellipsis placeholder in the Harness Protocol with "raise NotImplementedError", matching the convention used by other Protocols in this repo (CodeQL: statement has no effect). - agent_tools/__init__.py: perform the tools side-effect import (which registers every corpus.* tool via @register_tool) here, so any consumer importing a name from this package is guaranteed a fully populated REGISTRY; list "_tools" in __all__ as a deliberate re-export. - drop the now-redundant per-consumer side-effect imports of "agent_tools.tools" in dynamic_tools.py, cursor_harness.py, and openai_harness.py (CodeQL: unused import). Removing them outright would have broken tool registration - REGISTRY.all() would be empty.
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.
Closes the remaining CodeQL findings that were auto-posted as comments on the main→staging PR #396. Three of the seven alerts (417–419: redundant
stop_reasonassignment, 2× implicit string concatenation) were already fixed onmainby the Copilot-Autofix commitsb6a95a8f/7a0a51b8— no further work needed there.Changes
harness/base.py— CodeQL statement has no effect (alert 420): the...placeholder inside theHarnessProtocol method is dead code. Replaced withraise NotImplementedError, matching the convention used by other Protocols in this repo.agent_tools/__init__.py— the tool-registration side-effect import (each module undertools/calls@register_toolat import time) is now performed by the package itself, so any consumer importing a name from this package (e.g.REGISTRY) is guaranteed a fully populated registry._toolsis listed in__all__as a deliberate re-export (ruff already ignores F401 in__init__.py).Dropped the 3 redundant
import tools as _agent_tools_registered # noqa: F401lines indynamic_tools.py,cursor_harness.py,openai_harness.py— CodeQL unused import alerts 421/422/423. These were false positives in the sense that the imports are load-bearing (deleting them outright would leaveREGISTRY.all()empty at runtime), but after change 2 they are genuinely redundant.Verification
ruff checkclean on all affected files and packages.pyrightclean on changed files (only pre-existing optionalcursor-sdkmissing-import note).import agent_toolsnow registers all 8corpus.*tools;openai_harness,cursor_harness,dynamic_tools, andretrieval_serverall import cleanly with a populated registry (no import-cycle introduced).