Skip to content

[Bug]: CLI prints DEBUG "deepcode_config.json not found... skipping layer" noise - setup_logging() never called by CLI entrypoints #167

Description

@AnaheimEX

Bug description

The interactive CLI prints DEBUG noise on every config load:

2026-08-07 07:03:11.495 | DEBUG    | core.config:_load_raw:577 - deepcode_config.json not found at /Users/anaheim/deepcode_config.json; skipping layer

The same line appears twice per turn start and around /effort etc. It happens in every directory that has no project-level deepcode_config.json (the common case — the home layer at ~/.deepcode/deepcode_config.json loads fine).

Root cause

setup_logging() in core/observability/bus.py is never called by any CLI entrypoint — it is only defined, never invoked (grep for setup_logging( finds no callers in cli/ or core/). Therefore loguru keeps its built-in default sink (stderr, DEBUG level), and every missing config layer probed by _load_raw() (core/config.py:577) prints a DEBUG line.

Additionally:

  • LoggerConfig (core/config.py, incl. logger.level) has no consumer — nothing reads the config's logger section to configure loguru, so users cannot silence this via ~/.deepcode/deepcode_config.json.
  • DEEPCODE_LOG_LEVEL env var is only read in cli/mcp_server.py (MCP server only), not the main CLI.
  • The Desktop app is unaffected (it wires logging.basicConfig in app_server/__main__.py).

Expected behavior

The CLI should call setup_logging(load_config().logger) at startup (TUI and loop entrypoints), defaulting to INFO, and respect logger.level from the config. Note the ordering matters: setup_logging must run before load_config(), because load_config() itself emits the DEBUG lines.

Environment

  • deepcode 2.0.0 (via uv tool install deepcode-hku)
  • macOS arm64
  • Reproduced with the interactive TUI (deepcode) and in loop mode

Suggested fix

# in cli/tui/app.py main() and cli/loop_cli.py main(), before anything loads config:
from core.config import LoggerConfig, load_config
from core.observability import setup_logging

setup_logging(LoggerConfig(transports=["console"]))
cfg = load_config()
if cfg.logger.level.upper() != "INFO":
    setup_logging(LoggerConfig(level=cfg.logger.level, transports=["console"]), force=True)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions