Skip to content

fix(core): RedactingFormatter NameError when verbose_logging=True#1700

Merged
teknium1 merged 1 commit intomainfrom
fix/redacting-formatter-import
Mar 17, 2026
Merged

fix(core): RedactingFormatter NameError when verbose_logging=True#1700
teknium1 merged 1 commit intomainfrom
fix/redacting-formatter-import

Conversation

@teknium1
Copy link
Copy Markdown
Contributor

Summary

RedactingFormatter was imported conditionally inside if not has_errors_log_handler: (line 461), but used unconditionally in the verbose_logging block (line 479).

When the error log handler already exists (second AIAgent instantiation in the same process, common in gateway and batch_runner) AND verbose_logging=True, the import was skipped and line 479 crashed with NameError: name 'RedactingFormatter' is not defined.

What changed

  • run_agent.py: Moved from agent.redact import RedactingFormatter one level up, before the if not has_errors_log_handler: block, so it's always available.

Test plan

  • Set verbose_logging: true in config
  • Start a second agent session in the same process (or use gateway)
  • Verify no NameError — verbose log handlers get RedactingFormatter applied correctly
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.
@teknium1 teknium1 merged commit 56e0c90 into main Mar 17, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant