UAT: LLMTrace.latency_ms declared as float — spec requires int #6843

Open
opened 2026-04-10 02:58:17 +00:00 by HAL9000 · 0 comments
Owner

Bug Report

What Was Tested

Code-level analysis of src/cleveragents/domain/models/observability/llm_trace.py against the LLMTrace schema defined in docs/specification.md §Observability → LLM Call Tracing.

Expected Behavior (from spec)

The specification (docs/specification.md line ~46134) defines:

class LLMTrace(BaseModel):
    ...
    latency_ms: int
    ...

The latency_ms field must be an integer (whole milliseconds). This is consistent with industry practice of recording latency as an integer millisecond value, and allows lossless storage in integer columns in the database.

Actual Behavior

The implementation in src/cleveragents/domain/models/observability/llm_trace.py declares latency_ms as float:

latency_ms: float = Field(
    ...,
    ge=0.0,
    description="Wall-clock latency in milliseconds",
)

This creates a type mismatch with the spec, which explicitly requires int.

Impact

  • Database schema / ORM column for latency_ms may be typed as FLOAT instead of INTEGER, creating a subtle schema mismatch
  • Downstream code computing LLM_AVG_LATENCY_MS metric (sum(t.latency_ms for t in traces) / call_count) silently treats an int-typed value as float
  • Inconsistency with the spec makes the codebase harder to trust for contributors following the specification

Steps to Reproduce

from cleveragents.domain.models.observability.llm_trace import LLMTrace
import inspect, typing

hints = typing.get_type_hints(LLMTrace)
print(hints['latency_ms'])  # → <class 'float'>  (should be int per spec)

Code Location

  • File: src/cleveragents/domain/models/observability/llm_trace.py
  • Field: latency_ms (approximately line 110)

Fix Required

Change the field type from float to int:

latency_ms: int = Field(
    ...,
    ge=0,
    description="Wall-clock latency in milliseconds",
)

Any ORM column mapping for this field should likewise use Integer rather than Float.


Automated by CleverAgents Bot
Supervisor: UAT Testing | Agent: uat-tester

## Bug Report ### What Was Tested Code-level analysis of `src/cleveragents/domain/models/observability/llm_trace.py` against the `LLMTrace` schema defined in `docs/specification.md` §Observability → LLM Call Tracing. ### Expected Behavior (from spec) The specification (`docs/specification.md` line ~46134) defines: ```python class LLMTrace(BaseModel): ... latency_ms: int ... ``` The `latency_ms` field must be an **integer** (whole milliseconds). This is consistent with industry practice of recording latency as an integer millisecond value, and allows lossless storage in integer columns in the database. ### Actual Behavior The implementation in `src/cleveragents/domain/models/observability/llm_trace.py` declares `latency_ms` as `float`: ```python latency_ms: float = Field( ..., ge=0.0, description="Wall-clock latency in milliseconds", ) ``` This creates a type mismatch with the spec, which explicitly requires `int`. ### Impact - Database schema / ORM column for `latency_ms` may be typed as FLOAT instead of INTEGER, creating a subtle schema mismatch - Downstream code computing `LLM_AVG_LATENCY_MS` metric (`sum(t.latency_ms for t in traces) / call_count`) silently treats an int-typed value as float - Inconsistency with the spec makes the codebase harder to trust for contributors following the specification ### Steps to Reproduce ```python from cleveragents.domain.models.observability.llm_trace import LLMTrace import inspect, typing hints = typing.get_type_hints(LLMTrace) print(hints['latency_ms']) # → <class 'float'> (should be int per spec) ``` ### Code Location - **File**: `src/cleveragents/domain/models/observability/llm_trace.py` - **Field**: `latency_ms` (approximately line 110) ### Fix Required Change the field type from `float` to `int`: ```python latency_ms: int = Field( ..., ge=0, description="Wall-clock latency in milliseconds", ) ``` Any ORM column mapping for this field should likewise use `Integer` rather than `Float`. --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: uat-tester
HAL9000 added this to the v3.6.0 milestone 2026-04-10 02:59:21 +00:00
HAL9000 self-assigned this 2026-04-10 06:07:50 +00:00
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.

Dependencies

No dependencies set.

Reference
cleveragents/cleveragents-core#6843
No description provided.