fix(llm-test): an unreported reasoning-token counter is not a warning

Measured against the gateway this deployment actually uses (ai.lago.dev), a
"Reply with OK" request comes back with usage.completion_tokens_details: {} --
the provider does not report a reasoning counter at all. Thinking is
verifiably off there (2 completion tokens, 424 ms, versus ~235 tokens and
~3.5x latency when on), but reasoning_tokens is undefined, not 0.

The verdict had two states, so a healthy production connection rendered amber
with "the model is still thinking" -- the button would have reported a working
configuration as broken. The reasoning verdict is now three-state:

- reported 0        -> reasoning_disabled: true, green
- not reported      -> reasoning_tokens: null, no warning, neutral card that
                       says it cannot be confirmed from the usage block
- reported and > 0  -> amber + the existing warning

Only a reported 0 asserts reasoning_disabled, so the UI still never claims
thinking is off without evidence.

Sidecar 34 -> 35 tests (all three unreported shapes assert no warning); new
e2e/tests/llm-connection-test.spec.ts, 6 tests, covering the three verdict
tones, the failure case, the dirty-form lock and the in-flight state.

Co-authored-by: Stephan Charles <[email protected]>
Co-authored-by: Amelia Hernandez <[email protected]>
Co-authored-by: Markus Franz <[email protected]>
Co-authored-by: Sabrina Hota <[email protected]>
Co-authored-by: Nilüfer Doğan <[email protected]>
This commit is contained in:
committed 2026-10-19 20:35:13 +02:00
1 parent d3083b7940
commit b715e414dc
8 files changed
+317 -27

No files matched your search

+20 -8
View File
@@ -121,28 +121,40 @@ export function Settings() {
{testing && <p className="muted small" role="status" data-testid="llm-test-progress">Sending one request to {model.trim() || 'the configured model'}…</p>}
{/* The verdict stays on the page rather than in a toast: the latency and
the reasoning-token line are the parts people need to read twice. */}
{testResult && (
<div className={`llm-test-result ${testResult.ok ? (testResult.reasoning_disabled ? 'good' : 'warn') : 'bad'}`}
{testResult && (() => {
// Three states, not two. Our gateway reports no reasoning-token
// counter at all (`completion_tokens_details: {}`), so "null" is the
// normal healthy answer here — colouring it amber and saying "still
// thinking" would flag a working configuration as broken.
const unknown = testResult.ok && testResult.reasoning_tokens === null;
const tone = !testResult.ok ? 'bad' : testResult.reasoning_disabled ? 'good' : unknown ? 'neutral' : 'warn';
return (
<div className={`llm-test-result ${tone}`}
role="status" data-testid="llm-test-result" data-ok={String(testResult.ok)}
data-reasoning-disabled={String(testResult.reasoning_disabled)}>
<strong data-testid="llm-test-headline">
{testResult.ok
? testResult.reasoning_disabled
{!testResult.ok
? 'Connection failed'
: testResult.reasoning_disabled
? `Connection works — replied in ${testResult.latency_ms} ms`
: 'Connection works, but the model is still thinking'
: 'Connection failed'}
: unknown
? `Connection works — replied in ${testResult.latency_ms} ms`
: 'Connection works, but the model is still thinking'}
</strong>
{testResult.model && <p className="muted small">{testResult.model} at {testResult.endpoint}</p>}
{testResult.error && <p className="feedback-error" data-testid="llm-test-error">{testResult.error}</p>}
{testResult.warning && <p data-testid="llm-test-warning">{testResult.warning}</p>}
{testResult.ok && (
<p className="muted small" data-testid="llm-test-reasoning">
Reasoning tokens: {testResult.reasoning_tokens === null ? 'not reported by this endpoint' : testResult.reasoning_tokens}
{testResult.reasoning_tokens === null
? 'This endpoint does not report a reasoning-token count, so thinking cannot be confirmed from here — the request was still sent with thinking disabled.'
: `Reasoning tokens: ${testResult.reasoning_tokens}`}
{testResult.content ? ` · reply: “${testResult.content.slice(0, 60)}”` : ''}
</p>
)}
</div>
)}
);
})()}
</div>
</form>}
</div>