fix(core): RedactingFormatter NameError when verbose_logging=True#1700
Merged
fix(core): RedactingFormatter NameError when verbose_logging=True#1700
Conversation
RedactingFormatter was imported inside 'if not has_errors_log_handler:' (line 461) but also used unconditionally in the verbose_logging block (line 479). When the error log handler already exists (e.g. second AIAgent in the same process) AND verbose_logging=True, the import was skipped and line 479 raised NameError. Fix: Move the import one level up so it's always available regardless of whether the error log handler already exists.
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
RedactingFormatterwas imported conditionally insideif not has_errors_log_handler:(line 461), but used unconditionally in theverbose_loggingblock (line 479).When the error log handler already exists (second
AIAgentinstantiation in the same process, common in gateway and batch_runner) ANDverbose_logging=True, the import was skipped and line 479 crashed withNameError: name 'RedactingFormatter' is not defined.What changed
run_agent.py: Movedfrom agent.redact import RedactingFormatterone level up, before theif not has_errors_log_handler:block, so it's always available.Test plan
verbose_logging: truein config