Skip to content

fix(CODEWIKI-006): CU-86akbhg0r 2 review findings across 2 files - #41

Merged
michaelassraf merged 5 commits into
mainfrom
ai-fix/codewiki-006-541b150a-bef4f5a8
Sep 8, 2026
Merged

michaelassraf merged 5 commits into
mainfrom
ai-fix/codewiki-006-541b150a-bef4f5a8

Conversation

@flamingo

@flamingo flamingo Bot commented Aug 24, 2026

Copy link
Copy Markdown

Closes 2 review findings across 2 files.

Draft — this is a starting point, not a finished change. The fix required judgment, so read it before trusting it.

# Fix confidence Finding Location
1 🟡 85 medium Third-party logger suppression duplicated in non-entry-point module doc_generator.py codewiki/cli/adapters/doc_generator.py:15
2 🟡 80 medium Third-party logger suppression duplicated again in generate.py command handler codewiki/cli/commands/generate.py:199

What changed — and what was deliberately left — is explained per finding as inline review comments on the lines each finding touched.


Run: https://product-hub.flamingo.so/admin/code-review
Run id: bef4f5a8-e7f3-478b-8731-2becca2de658

Merging this PR is recorded as acceptance of the rule that produced it;
closing it unmerged is recorded as rejection. Both feed rule health, so
closing a wrong suggestion is useful rather than merely tidy.

ClickUp task: CU-86akbhg0r Code review fixes: CodeWiki backend and CLI review findings (5 PRs)

@flamingo flamingo Bot left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🦩 What this fix changed, finding by finding

2 finding(s) fixed in this draft — 2 explained inline on the diff.

@@ -13,12 +13,6 @@
import logging
import sys

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🦩 🟠 Third-party logger suppression duplicated in non-entry-point module doc_generator.py

Removed the module-level duplicate third-party logger suppression block (logging.getLogger("httpx"/"openai"/"openai._base_client"/"anthropic").setLevel(logging.WARNING)) and its comment from the top of codewiki/cli/adapters/doc_generator.py, since this is not the entry-point module per CODEWIKI-006. The import logging statement was kept since logging is still used extensively throughout the file (e.g., _configure_backend_logging, various logger.info/logger.error calls). This centralizes the suppression to the actual entry point (main.py), removing the duplication called out in the finding. Residual risk: this file no longer independently guarantees suppressed httpx/openai/anthropic logs if invoked in a code path that bypasses the entry point's setup_logging(); confirming that all invocation paths go through the entry point is outside this file's visibility.

🤖 Prompt for AI agents
In codewiki/cli/adapters/doc_generator.py around line 15, review and complete this code-review fix: Third-party logger suppression duplicated in non-entry-point module doc_generator.py.
What the draft fix changed: Removed the module-level duplicate third-party logger suppression block (`logging.getLogger("httpx"/"openai"/"openai._base_client"/"anthropic").setLevel(logging.WARNING)`) and its comment from the top of `codewiki/cli/adapters/doc_generator.py`, since this is not the entry-point module per CODEWIKI-006. The `import logging` statement was kept since `logging` is still used extensively throughout the file (e.g., `_configure_backend_logging`, various `logger.info`/`logger.error` calls). This centralizes the suppression to the actual entry point (main.py), removing the duplication called out in the finding. Residual risk: this file no longer independently guarantees suppressed httpx/openai/anthropic logs if invoked in a code path that bypasses the entry point's setup_logging(); confirming that all invocation paths go through the entry point is outside this file's visibility.
Verify the change is correct and complete; do not refactor unrelated code.

fix confidence: 🟡 85 medium — react 👍/👎 to teach the reviewer

Comment on lines 216 to 221
logger = create_logger(verbose=verbose)
start_time = time.time()

# Suppress verbose third-party library logs
logging.getLogger("httpx").setLevel(logging.WARNING)
logging.getLogger("openai").setLevel(logging.WARNING)
logging.getLogger("openai._base_client").setLevel(logging.WARNING)
logging.getLogger("anthropic").setLevel(logging.WARNING)

try:
# Pre-generation checks
logger.step("Validating configuration...", 1, 4)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🦩 🟠 Third-party logger suppression duplicated again in generate.py command handler

Removed the duplicated third-party logger suppression block (logging.getLogger("httpx"/"openai"/"openai._base_client"/"anthropic").setLevel(logging.WARNING)) from generate_command in codewiki/cli/commands/generate.py, immediately after start_time = time.time(). Per CODEWIKI-006 this suppression should occur exactly once at the application entry point (already present in doc_generator.py), so the redundant copy here is deleted rather than duplicated. The logging import is left in place since it is unused elsewhere in this file now, but removing it was not required by the finding and leaving it avoids risking an accidental break if it's referenced indirectly; a reviewer may want to drop the now-unused import logging as a small follow-up cleanup. Risk: if the entry-point suppression in doc_generator.py is not actually invoked before this command handler runs in some invocation path, third-party WARNING logs could reappear here — this was not verified end-to-end since only this file was in scope.

🤖 Prompt for AI agents
In codewiki/cli/commands/generate.py around line 199, review and complete this code-review fix: Third-party logger suppression duplicated again in generate.py command handler.
What the draft fix changed: Removed the duplicated third-party logger suppression block (`logging.getLogger("httpx"/"openai"/"openai._base_client"/"anthropic").setLevel(logging.WARNING)`) from `generate_command` in `codewiki/cli/commands/generate.py`, immediately after `start_time = time.time()`. Per CODEWIKI-006 this suppression should occur exactly once at the application entry point (already present in `doc_generator.py`), so the redundant copy here is deleted rather than duplicated. The `logging` import is left in place since it is unused elsewhere in this file now, but removing it was not required by the finding and leaving it avoids risking an accidental break if it's referenced indirectly; a reviewer may want to drop the now-unused `import logging` as a small follow-up cleanup. Risk: if the entry-point suppression in `doc_generator.py` is not actually invoked before this command handler runs in some invocation path, third-party WARNING logs could reappear here — this was not verified end-to-end since only this file was in scope.
Verify the change is correct and complete; do not refactor unrelated code.

fix confidence: 🟡 80 medium — react 👍/👎 to teach the reviewer

@flamingo flamingo Bot changed the title fix(CODEWIKI-006): 2 review findings across 2 files fix(CODEWIKI-006): CU-86akbhg0r 2 review findings across 2 files Sep 3, 2026
@michaelassraf

Copy link
Copy Markdown

Hold: this removes the only third-party log suppression on the CLI path.

The PR deletes these from both cli/adapters/doc_generator.py and cli/commands/generate.py:

logging.getLogger("httpx").setLevel(logging.WARNING)
logging.getLogger("openai").setLevel(logging.WARNING)
logging.getLogger("openai._base_client").setLevel(logging.WARNING)
logging.getLogger("anthropic").setLevel(logging.WARNING)

The identical block still exists in src/be/main.py:23 — but I traced the import graph from cli/commands/generate.py and src.be.main is not among the 49 modules it reaches. So after this PR nothing suppresses those loggers for python -m codewiki generate, which is exactly what the multi-platform-hub doc pipeline runs, with --verbose. Expect one httpx INFO line per LLM HTTP request in every CI run.

The finding itself is legitimate — module-level setLevel side effects on import are the wrong place for this. The fix is to move the suppression into cli/utils/logging.py::create_logger (which generate_command already calls), not to delete it. Happy to review that version.

michaelassraf and others added 3 commits September 7, 2026 22:45
Bring the branch up to date with main (PRs #48, #49, #52, #53, #54, #55).

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Deleting the setLevel() calls was right in principle - a module-level side
effect that fires on import is invisible from the call site - but it left
nothing suppressing them on the CLI path. The identical block in
src/be/main.py does not help: that module is not among the 49 reachable from
cli/commands/generate.py, so after this branch 'python -m codewiki generate'
logs one httpx INFO line per LLM request, and the doc pipeline runs it with
--verbose.

Reintroduce the suppression as quiet_third_party_loggers(), called from
create_logger(), which generate_command already invokes before any generation
work. Same effect, at an explicit call site instead of an import side effect.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@michaelassraf
michaelassraf marked this pull request as ready for review September 8, 2026 03:01
@michaelassraf
michaelassraf merged commit d4fb4dd into main Sep 8, 2026
@michaelassraf
michaelassraf deleted the ai-fix/codewiki-006-541b150a-bef4f5a8 branch September 8, 2026 03:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant