Repository navigation
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Problem
PR #232 documentation (run-log template, execution procedure, PR description) listed tokens_per_sec as a captured metric. However, OpenAICompatibleClient.generate() returns only str — the usage field from the LLM response JSON is parsed inside generate() and then discarded. The external wrapper InstrumentedLLMClient cannot recover token counts that were already thrown away.
The result: every smoke run would report tokens_per_sec: null and total_completion_tokens: null, while the docs implied these were measured metrics.
Root Cause
- Did not trace the data flow end-to-end: The agent saw that the LLM response includes
usageand assumed it was available for capture. It did not verify thatgenerate()actually returns or exposes this data. - Documented intent, not reality: The run-log template listed metrics that the implementation could not deliver. The "record as null if unavailable" fallback masked the fact that the data was structurally impossible to obtain.
- Silent failure mode: The code recorded
Nonefor token counts without any warning or fail-fast check. A reader of the smoke output would see "not measured" and assume it was a transient issue, not a structural impossibility.
Prevention
For the agent
- Before adding a metric to docs/templates, trace the data path from source to collection point. If the data does not flow through the instrumented boundary, either:
- Add a minimal hook to expose it (preferred), or
- Explicitly mark it as "structurally unavailable" in the docs and do not list it as a captured metric.
- Fail fast on impossible metrics. If the instrumentation code is designed to capture X but X cannot flow to the collector, raise an error or log a prominent warning. Do not silently return
None. - Distinguish "not measured this run" from "cannot be measured by this instrumentation." Use different sentinel values:
nullfor "available but not observed" vs."unavailable"for "structurally impossible."
For the review checklist
- Metric traceability: Every metric in the run-log template must have a corresponding code path that can produce a non-null value. If the code path cannot produce the value, the template must not list it as a standard metric.
- Fail-fast for zero-capture: If an instrumentation PR completes a non-trivial run with zero captured data points for a claimed metric, it must fail (not just log
null).
References
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working
Activity