fix(bridge): stop root logger gating INFO out of bot.log#323
Merged
Conversation
setup_logging() did `logging.basicConfig(level=WARNING)` in non-debug mode, which sets the ROOT logger level to WARNING. The root level is a hard gate applied before any handler's own level — records below it are dropped and never dispatched. So every INFO record (boot banners AND operational markers like the "Ignoring persisted session_id" session-resume trace) was discarded before it could reach the INFO-level bot.log file handler. bot.log only ever captured WARNING+, which is why a quiet node's bot.log sits at 0 bytes and INFO-level diagnostics are invisible. Set the root to log_level (INFO) so the file handler receives INFO, and gate the console StreamHandler per-handler at console_level (WARNING in non-debug) so stdout stays quiet. Verified: INFO markers now reach the file while the console still suppresses them. (+ regression test, skips where pydantic isn't installed) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017rAPKfsLfaYqNY8iPXWX34
seoseo-ai
approved these changes
Jul 8, 2026
seoseo-ai
left a comment
Collaborator
There was a problem hiding this comment.
검증 완료: CI pass, local targeted logging test pass, harness pass, diff/secret scan clean. Reviewer fix added to force root logger level under existing handlers.
seoseo-ai
approved these changes
Jul 8, 2026
seoseo-ai
left a comment
Collaborator
There was a problem hiding this comment.
Approved after diff review and green CI. Local verification: ruff on changed files passed; bridge regression test passed; full bridge pytest passed.
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
bot.logon quiet nodes sits at 0 bytes and INFO-level operational markers never appear — which made a memory-loss investigation impossible to diagnose from logs. Root cause:setup_logging()gates the root logger at WARNING in non-debug mode, so every INFO record is dropped before it can reach the INFO-level file handler.The bug
The root logger's level is a hard gate applied before any handler's own level — a record below it is discarded and never dispatched. Setting the root to WARNING therefore defeats
fh.setLevel(INFO): the file handler can only filter records the logger already passed, and it never receives INFO. Net effect:bot.logcaptures WARNING+ only. A quiet node produces no WARNING+, so the file stays empty, and INFO diagnostics (boot banners, theIgnoring persisted session_idsession-resume trace, etc.) are invisible.Reproduced directly: with the root at WARNING,
logger.info("Ignoring persisted session_id …")is absent from the file while alogger.warning(...)on the same run is present.The fix
Set the root to
log_level(INFO) so the file handler receives INFO, and gate the console StreamHandler per-handler atconsole_level(WARNING in non-debug) so stdout stays quiet:Verified after the change: INFO markers reach
bot.logwhile the console still suppresses them (only WARNING+ on stdout).Test plan
bridge/tests/test_logging_levels.pypins the invariant (root ≤ INFO, a file handler at ≤ INFO, console handlers ≥ WARNING). Skips cleanly where pydantic isn't installed; runs on CI.Context
This unblocks the follow-up investigation into within-conversation memory loss on Termux nodes: the smoking-gun marker for the suspected cause (
Ignoring persisted session_id, logged at INFO) was being silently discarded, so the log-based diagnostic could not see it. With INFO restored tobot.log, re-running the diagnostic after a repro will show whether the bridge is restarting between messages and refusing to resume the persisted session.🤖 Generated with Claude Code
https://claude.ai/code/session_017rAPKfsLfaYqNY8iPXWX34
Generated by Claude Code