Repository navigation
Description
Someone runs an adapter-backed requirement and one day the adapter's output stops parsing. Mellea
handles that deliberately: Requirement.validate catches it, fails the check closed, and keeps the
exception on ValidationResult.error so a caller can tell it apart from an ordinary "requirement not
met" (mellea/core/requirement.py:341-360).
Telemetry is where the distinction disappears. Nothing in the traces or the metrics says the check
did not run, so an operator reading a dashboard sees a requirement failing and concludes the model is
not meeting it.
Current behaviour
Five things have to line up for this, and all five do.
- No log. The except block (
requirement.py:341-360) builds the result and returns it. There is
nologgercall. - The payload's exception field stays
None.mellea/stdlib/functional.py:1089initialises
exception = Noneand assigns it only inside theexcept BaseExceptionat:1109-1111, which
wrapsasyncio.gatherand re-raises. An errored-but-returnedValidationResultnever raises, so
theexception=exceptionhanded toValidationPostCheckPayloadat:1124isNone. - The span closes OK.
ValidationTracingPlugin.on_post_check
(mellea/telemetry/tracing_plugins.py:594-612) forwards thatNoneat:611, and
finish_validation_span(mellea/telemetry/tracing.py:957) branches onif exception is None
and takes the outcome-attributes path. The plugin's own docstring says so at:598: "Close the
validation span, ERROR only when validation raised." - The span records no reason either. The
failure_reasonscomprehension at:604is
[r.reason for r in payload.results if not bool(r) and r.reason], andreasonisNoneon this
path by design, so the requirement contributes nothing. - The metric says "LLM judgment".
mellea/telemetry/metrics_plugins.py:487-491readsreason
only whenreq.validation_fn is not None, which is false on the judge and adapter path where this
arises, sorecord_requirement_failureat:492records the literal string"LLM judgment", the
same value an ordinary judgment failure produces.
The observable record of a broken adapter is therefore a span with status OK, failed_count
incremented, an empty failure_reasons, and a requirement_failure metric attributed to LLM
judgment.
Why this is live today
ALoraRequirement produces errored results in shipped code and documents it at
mellea/stdlib/requirements/requirement.py:72-79. Any adapter-backed requirement whose adapter
drifts reaches this now.
Point 4 is a recent regression. #1591 set reason=None on this path so malformed judge output would
stop reaching repair prompts, which was the right call for prompts: before it, the raw unparsable
output appeared in failure_reasons, so the span at least carried a visible anomaly. Points 1, 2, 3
and 5 predate that change.
Proposal
Every ValidationResult in payload.results already carries .error, so the plugins can read it
and no payload change is needed. That keeps the fix inside the plugins, matching mellea's rule that
telemetry is emitted by hook-fired plugins rather than by direct calls from core.
- Log it. Add a warning in the except at
requirement.py:341naming the requirement and the
exception type. A log is not telemetry, so this one belongs in core. - Give the span a reason. In the
:604comprehension, contribute the exception's type name for a
result with.errorset. The type is safe to record where the raw output was not, so this does not
undo fix: surface validate parse errors as ValidationResult.error instead of propagating #1591. - Make the metric distinguishable. At
metrics_plugins.py:487-491, record a distinct reason when
result.erroris set instead of falling through to"LLM judgment". - Count them. An undetermined count on the validation span, so the condition is queryable rather
than something an operator has to infer.
Decision needed before implementation: span status
Whether the span should go ERROR is a real question rather than an oversight.
ValidationPostCheckPayload.exception is documented as the exception that ended validation, on a path
where "results and the counts are empty", so reusing it for a per-result error would conflict with
its stated meaning and with finish_validation_span's two branches. Validation did complete here.
One requirement inside it did not resolve.
Leaving the status OK, and adding an attribute plus a reason, keeps the existing semantics of both and
is enough to make the condition visible. Setting ERROR is louder and matches the intuition that a
broken validator is a fault, at the cost of a span status that no longer means "validation raised".
Either is defensible and it should be settled first.
Testing
Unit only, no GPU. A Requirement subclass whose output_to_bool raises reaches this path without an
adapter.
- The except emits a log naming the requirement and the exception type.
- With one errored requirement,
failure_reasonson the finished span is non-empty, names the
exception type, and does not contain the model's raw output. record_requirement_failurereceives a reason distinguishable from"LLM judgment".- Whichever span status is chosen, assert it, so the decision above is pinned by a test rather than by
the current shape of the branch.
Related
- fix: surface validate parse errors as ValidationResult.error instead of propagating #1591 (merged) implemented validate should surface parse errors as a third outcome rather than propagating exceptions #1358's
ValidationResult.error, and in fixing repair-prompt pollution
it removed the last trace of this from the span. - validate should surface parse errors as a third outcome rather than propagating exceptions #1358 (closed) is the issue fix: surface validate parse errors as ValidationResult.error instead of propagating #1591 implemented.
- bug(strategies): an undetermined validation is repaired as a failed requirement #1673 is the same gap on the sampling side: nothing under
mellea/stdlib/sampling/reads.error
either, so an undetermined verdict drives repair. This issue is the observability half, and the two
can ship independently. - docs(stdlib): document SamplingResult.sample_generations and sample_validations as stable public API #1499 lists the failure modes hidden behind
success=False. A validator that never ran is one an
operator currently cannot see at all.
Line references verified against e772c8857.
Activity
planetf1 commentedon Oct 5, 2026
Status: root cause confirmed (2026-10-05)
Verified the full chain against
mainat4c53add4e— five links, all as described:Requirement.validate'sexcept(mellea/core/requirement.py:447-453) returns a result witherror=exc,reason=None— deliberate, and the comment there explains why — so nothing ever raises.mellea/stdlib/functional.pysetsexceptiononly from the wrappingexcept BaseExceptionaround the gather; an errored-but-returned result never passes through it, sopayload.exceptionstaysNone.ValidationTracingPlugin.on_post_check(mellea/telemetry/tracing_plugins.py:592-610) forwards thatNone, andfinish_validation_span(mellea/telemetry/tracing.py:~957) branches onexception is None→ the OK path. The plugin's own docstring states the intent: "Close the validation span, ERROR only when validation raised."failure_reasonscomprehension (:602) collectsr.reasonfor failing results —Noneon this path by design — so the span records no reason either.mellea/telemetry/metrics_plugins.py:~487) falls through to the ordinary judgment-failure label without reading.error.Net effect: the one case where the check did not run — the adapter's output failed to parse — is indistinguishable in traces and metrics from "the model did not meet the requirement." A dashboard shows the requirement failing and points at the model; the adapter is the broken part.
Proposed fix: surface
.errorwhere the instruments already branch, leavingvalidate()untouched (its fail-closed contract is correct):on_post_check, append a marker tofailure_reasonswhen a failing result carries.error(e.g."validation error: {type(exc).__name__}: {exc}");finish_validation_span, treat "a result failed closed with an error" as the ERROR case alongside "validation raised" (the:596docstring's "only when validation raised" needs the matching wording);.errorand label this failure class distinctly from an ordinary judgment failure.Scope: two telemetry plugin files plus the span-finish helper. One behaviour change to flag: validation spans will now close ERROR for a new class of event, so dashboards/alerts on span status will see more errors — which is the point, but worth saying.
planetf1 commentedon Oct 20, 2026
Folded into #1720 as package 2 (telemetry distinguishes undetermined from failed). The five-link root-cause chain and the plugins-only fix are in the host body. Closing so there's one entry point; the full spec stays readable here.