UAT: configure_structlog() raises ValueError for TRACE log level — spec-required -vvvvv verbosity level is broken #3644

Open
opened 2026-04-05 21:03:30 +00:00 by freemo · 1 comment
Owner

Background

The specification (docs/specification.md, "Global Options" section) defines a 6-level verbosity system:

-v = ERROR, -vv = WARN, -vvv = INFO, -vvvv = DEBUG, -vvvvv = TRACE

The spec also defines core.log.level accepted values as: FATAL, ERROR, WARN, INFO, DEBUG, TRACE.

Expected Behavior

Setting core.log.level=TRACE (or using -vvvvv) should enable TRACE-level logging without error.

Actual Behavior

The configure_structlog() function in src/cleveragents/config/logging.py (lines 30–82) uses Python's standard logging module to resolve level names:

numeric_level = getattr(logging, log_level.upper(), None)
if not isinstance(numeric_level, int):
    raise ValueError(f"Invalid log level: {log_level!r}")

Python's logging module does not have a TRACE level — getattr(logging, 'TRACE', None) returns None. This causes configure_structlog(log_level="TRACE") to raise:

ValueError: Invalid log level: 'TRACE'

Note: FATAL works because Python's logging module defines FATAL = 50 as an alias for CRITICAL. But TRACE has no equivalent.

Code location: src/cleveragents/config/logging.py, lines 45–47 — the level resolution does not handle TRACE.

Impact

  1. agents -vvvvv <command> (TRACE verbosity) crashes with ValueError instead of enabling trace logging
  2. agents config set core.log.level TRACE followed by any command crashes
  3. The most granular debugging level is completely non-functional

Steps to Reproduce

  1. Call configure_structlog(log_level="TRACE")
  2. Observe: ValueError: Invalid log level: 'TRACE'

Metadata

  • Branch: fix/logging-trace-level
  • Commit Message: fix(logging): register TRACE level and alias WARN to support all spec-defined log levels
  • Milestone: (none — backlog)
  • Parent Epic: #397

Subtasks

  • Register TRACE as a custom logging level in src/cleveragents/config/logging.py (e.g., logging.addLevelName(5, "TRACE") with level value 5, below DEBUG=10)
  • Handle WARN as an alias for WARNING (Python uses WARNING not WARN)
  • Update configure_structlog() to map TRACE → custom level 5 and WARNWARNING before resolving via getattr(logging, ...)
  • Write Behave unit test scenarios verifying all 6 spec-defined log levels work: FATAL, ERROR, WARN, INFO, DEBUG, TRACE
  • Verify nox -e typecheck passes
  • Verify nox -e unit_tests passes with coverage >= 97%

Definition of Done

  • configure_structlog(log_level="TRACE") succeeds without raising ValueError
  • configure_structlog(log_level="WARN") succeeds (maps to WARNING)
  • All 6 spec-defined log levels (FATAL, ERROR, WARN, INFO, DEBUG, TRACE) are accepted
  • Behave unit tests cover all 6 levels
  • All nox stages pass
  • Coverage >= 97%

Backlog note: This issue was discovered during autonomous operation
on milestone v3.5.0. It does not block milestone completion and has been
placed in the backlog for human review and future milestone assignment.


Automated by CleverAgents Bot
Supervisor: UAT Testing | Agent: ca-new-issue-creator

## Background The specification (`docs/specification.md`, "Global Options" section) defines a 6-level verbosity system: > `-v` = ERROR, `-vv` = WARN, `-vvv` = INFO, `-vvvv` = DEBUG, `-vvvvv` = TRACE The spec also defines `core.log.level` accepted values as: `FATAL`, `ERROR`, `WARN`, `INFO`, `DEBUG`, `TRACE`. ## Expected Behavior Setting `core.log.level=TRACE` (or using `-vvvvv`) should enable TRACE-level logging without error. ## Actual Behavior The `configure_structlog()` function in `src/cleveragents/config/logging.py` (lines 30–82) uses Python's standard `logging` module to resolve level names: ```python numeric_level = getattr(logging, log_level.upper(), None) if not isinstance(numeric_level, int): raise ValueError(f"Invalid log level: {log_level!r}") ``` Python's `logging` module does **not** have a `TRACE` level — `getattr(logging, 'TRACE', None)` returns `None`. This causes `configure_structlog(log_level="TRACE")` to raise: ``` ValueError: Invalid log level: 'TRACE' ``` Note: `FATAL` works because Python's `logging` module defines `FATAL = 50` as an alias for `CRITICAL`. But `TRACE` has no equivalent. **Code location**: `src/cleveragents/config/logging.py`, lines 45–47 — the level resolution does not handle `TRACE`. ## Impact 1. `agents -vvvvv <command>` (TRACE verbosity) crashes with `ValueError` instead of enabling trace logging 2. `agents config set core.log.level TRACE` followed by any command crashes 3. The most granular debugging level is completely non-functional ## Steps to Reproduce 1. Call `configure_structlog(log_level="TRACE")` 2. Observe: `ValueError: Invalid log level: 'TRACE'` ## Metadata - **Branch**: `fix/logging-trace-level` - **Commit Message**: `fix(logging): register TRACE level and alias WARN to support all spec-defined log levels` - **Milestone**: *(none — backlog)* - **Parent Epic**: #397 ## Subtasks - [ ] Register `TRACE` as a custom logging level in `src/cleveragents/config/logging.py` (e.g., `logging.addLevelName(5, "TRACE")` with level value 5, below DEBUG=10) - [ ] Handle `WARN` as an alias for `WARNING` (Python uses `WARNING` not `WARN`) - [ ] Update `configure_structlog()` to map `TRACE` → custom level 5 and `WARN` → `WARNING` before resolving via `getattr(logging, ...)` - [ ] Write Behave unit test scenarios verifying all 6 spec-defined log levels work: `FATAL`, `ERROR`, `WARN`, `INFO`, `DEBUG`, `TRACE` - [ ] Verify `nox -e typecheck` passes - [ ] Verify `nox -e unit_tests` passes with coverage >= 97% ## Definition of Done - [ ] `configure_structlog(log_level="TRACE")` succeeds without raising `ValueError` - [ ] `configure_structlog(log_level="WARN")` succeeds (maps to `WARNING`) - [ ] All 6 spec-defined log levels (`FATAL`, `ERROR`, `WARN`, `INFO`, `DEBUG`, `TRACE`) are accepted - [ ] Behave unit tests cover all 6 levels - [ ] All nox stages pass - [ ] Coverage >= 97% > **Backlog note:** This issue was discovered during autonomous operation > on milestone v3.5.0. It does not block milestone completion and has been > placed in the backlog for human review and future milestone assignment. --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: ca-new-issue-creator
Author
Owner

Issue triaged by project owner:

  • State: Verified
  • Priority: Backlog — TRACE log level crashes with ValueError. The spec defines 6 log levels; one of them is completely broken.
  • Story Points: 2 — S — Register a custom TRACE level and add WARN alias. Small code change with test scenarios for all 6 levels.
  • MoSCoW: Should Have — The spec defines TRACE as a required log level. Using -vvvvv crashes the application. This is a spec compliance issue that affects debugging capability.
  • Parent Epic: #397

Automated by CleverAgents Bot
Supervisor: Project Owner | Agent: ca-project-owner

Issue triaged by project owner: - **State**: Verified - **Priority**: Backlog — TRACE log level crashes with ValueError. The spec defines 6 log levels; one of them is completely broken. - **Story Points**: 2 — S — Register a custom TRACE level and add WARN alias. Small code change with test scenarios for all 6 levels. - **MoSCoW**: Should Have — The spec defines TRACE as a required log level. Using `-vvvvv` crashes the application. This is a spec compliance issue that affects debugging capability. - **Parent Epic**: #397 --- **Automated by CleverAgents Bot** Supervisor: Project Owner | Agent: ca-project-owner
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Blocks
#397 Epic: Server & Autonomy Infrastructure
cleveragents/cleveragents-core
Reference
cleveragents/cleveragents-core#3644
No description provided.