fix(gateway): restore lazy import of RedactingFormatter after #7991 - #8101
Closed
fancydirty wants to merge 1 commit into
Closed
fix(gateway): restore lazy import of RedactingFormatter after #7991#8101fancydirty wants to merge 1 commit into
fancydirty wants to merge 1 commit into
Conversation
…earch#7991 The import was removed by the component-separated logging refactor (NousResearch#7991), but the stderr handler block added in bacc86d still references it. Add the lazy import back at the point of use. Fixes NousResearch#8090
Contributor
There was a problem hiding this comment.
Pull request overview
Restores a lazy import of RedactingFormatter in gateway.run.start_gateway() to prevent a startup crash introduced by the component-separated logging refactor (#7991), matching the project’s existing lazy-import pattern and fixing #8090.
Changes:
- Reintroduce
from agent.redact import RedactingFormatterinside theverbosity is not Nonestderr-handler setup block.
Comments suppressed due to low confidence (1)
gateway/run.py:8477
- Consider adding a regression test that exercises the
verbosity is not Nonebranch ofstart_gateway()to ensure the stderr handler setup does not raise (e.g.,NameError) and that the handler’s formatter is aRedactingFormatter. There are already tests covering otherstart_gateway()paths, but none validate this verbosity-driven stderr configuration.
if verbosity is not None:
from agent.redact import RedactingFormatter
_stderr_level = {0: logging.WARNING, 1: logging.INFO}.get(verbosity, logging.DEBUG)
_stderr_handler = logging.StreamHandler()
_stderr_handler.setLevel(_stderr_level)
_stderr_handler.setFormatter(RedactingFormatter('%(levelname)s %(name)s: %(message)s'))
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
Author
|
Upstream main has already restored the |
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.
Add lazy
from agent.redact import RedactingFormatterimport back to the stderr handler setup block that was orphaned by the component-separated logging refactor.Fixes #8090