fix(gateway): add module-level logger to gateway.py (salvage #27154)#27246
Merged
Conversation
Contributor
🔎 Lint report:
|
| Rule | Count |
|---|---|
invalid-argument-type |
3 |
First entries
run_agent.py:14078: [invalid-argument-type] invalid-argument-type: Argument to function `len` is incorrect: Expected `Sized`, found `(str & ~AlwaysFalsy) | (dict[Unknown, Unknown] & ~AlwaysFalsy) | (Any & ~AlwaysFalsy) | ... omitted 3 union elements`
run_agent.py:7770: [invalid-argument-type] invalid-argument-type: Argument to function `build_anthropic_client` is incorrect: Expected `str`, found `str | dict[Unknown, Unknown] | Any | ... omitted 3 union elements`
run_agent.py:14075: [invalid-argument-type] invalid-argument-type: Argument to function `_is_oauth_token` is incorrect: Expected `str`, found `str | dict[Unknown, Unknown] | Any | ... omitted 3 union elements`
✅ Fixed issues (4):
| Rule | Count |
|---|---|
invalid-argument-type |
3 |
unresolved-reference |
1 |
First entries
run_agent.py:14075: [invalid-argument-type] invalid-argument-type: Argument to function `_is_oauth_token` is incorrect: Expected `str`, found `str | dict[Unknown | str, Unknown | str | dict[str, str]] | Any | ... omitted 3 union elements`
run_agent.py:14078: [invalid-argument-type] invalid-argument-type: Argument to function `len` is incorrect: Expected `Sized`, found `(str & ~AlwaysFalsy) | (dict[Unknown | str, Unknown | str | dict[str, str]] & ~AlwaysFalsy) | (Any & ~AlwaysFalsy) | ... omitted 3 union elements`
hermes_cli/gateway.py:3702: [unresolved-reference] unresolved-reference: Name `logger` used when not defined
run_agent.py:7770: [invalid-argument-type] invalid-argument-type: Argument to function `build_anthropic_client` is incorrect: Expected `str`, found `str | dict[Unknown | str, Unknown | str | dict[str, str]] | Any | ... omitted 3 union elements`
Unchanged: 4363 pre-existing issues carried over.
Diagnostics are surfaced as warnings — this check never fails the build.
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as spam.
…all_platforms hermes_cli/gateway.py:3702 referenced logger.debug() but 'logger' was never defined in the module, causing a NameError at runtime if the try/except around discover_plugins() caught an exception. Added import logging and logger = logging.getLogger(__name__) at module level to resolve the undefined name.
3284c37 to
ceeef63
Compare
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.
Summary
Salvage of #27154 — adds the missing module-level
loggerinhermes_cli/gateway.pyso_all_platforms()'sexceptblock canlogger.debug(...)without aNameErrorwhen plugin discovery fails.Changes
hermes_cli/gateway.py— addimport loggingandlogger = logging.getLogger(__name__)at module scope.tests/hermes_cli/test_gateway.py— regression smoke test asserting the logger exists.scripts/release.py— AUTHOR_MAP entries for @0xchainer and @kronexoi (used by upcoming salvage PRs too).Validation
scripts/run_tests.sh tests/hermes_cli/test_gateway.py -q→ 28/28 pass.Original PR: #27154 — credit preserved via rebase-merge.