Repository navigation
Decide the runtime response to routing-suppressed OpenAI-compat models (matrix now exists) - #1842
Conversation
…e Stage-2 injection (closes #1830) Widened the OpenAI-compat routing matrix from one served model to three (llama3.1:8b, mistral:7b, gemma4:e4b), settling the prerequisite ADR-056 left open: 2 of 3 measured served models route cleanly, so the mistral:7b failure is a per-model property rather than a native-vs-served split. Implements Option C from the decision: a one-time routing-reliability probe (nodespace_agent::local_agent::routing_probe) runs at OpenAI-compat model load, caches a routing_ok verdict on OpenAiCompatConfig in daemon.toml, and disables Stage-2 candidate-block injection (session.routing_disabled) for a model that fails it while leaving tool-surface scoping untouched — the matrix implicates the injected block, not the scoped tool list. A disabled turn logs a visible warning and a stage2_routing_disabled field on the turn's structured log rather than degrading silently. The probe cache is keyed on the (base_url, model) pair actually measured, not on the opaque model_id used for engine-swap dedup — a single-model server config with no /models discovery resolves every load to the same model_id regardless of the config's model field, so an in-place model edit needed its own invalidation path. Co-Authored-By: Claude <[email protected]>
Code Review — PR #1842 (closes #1830)Review Type: Initial Review SummaryThis is a well-argued implementation of Option C, and the reasoning quality is unusually high — the comments consistently explain why a mechanism is shaped the way it is, and the One blocking correctness gap: the on-disk verdict cache is keyed per config, but the probe is per model, and a single config exposes many discovered models. Details below. Requirements Check (issue #1830)
Findings🔴 Critical: The on-disk
|
…one config Critical fix from review: OpenAiCompatConfig.routing_ok was a single scalar, but one config can discover several served models via /models (openai-compat:<uuid>:<model>). A scalar let one model's probe verdict overwrite another's — e.g. mistral:7b measuring suppressed would silently disable injection for llama3.1:8b, discovered through the same config and never itself probed as failing. Switched to BTreeMap<String, bool> keyed by served model; updated the read/write paths and carry-forward logic in set_open_ai_compat_configs accordingly (carries forward on unchanged base_url, drops entirely on a base_url change). Added a regression test reproducing the collision. Also: bounded the probe's wall-clock time with a 60s timeout wrapper (not a token cap, which would diverge from the real uncapped production request), logged Stage-1 probe failures instead of swallowing them silently, corrected a doc comment describing the probe-write/Settings-save race's actual worst case, and updated the routing matrix's module docs to the widened three-model result. Co-Authored-By: Claude <[email protected]>
|
Addressed all findings from the review (commit 12288a0): 🔴 Critical — fixed. 🟡 Stale matrix docs — fixed. Module doc comment in 🟡 Unbounded probe latency — fixed, but not via a token cap. Capping 🟢 Stage-1 silent failure — fixed. Now logs at 🟢 Write-lock race doc comment — fixed. Corrected to describe the actual worst case (a lost concurrent Settings-GUI edit, not just a lost cache entry) rather than the benign framing. All new and existing tests pass ( |
Code Review — PR #1842 (Re-review)Review Type: Re-review SummaryAll five items are genuinely addressed, not papered over. The 🔴 fix is the right shape and — importantly — the author found and closed a second, subtler half of the bug that the original review only half-identified: the read-side guard in The 🟡 latency item was addressed by rejecting the review's suggested remedy in favor of a better one, with the reasoning stated. That's the correct response to a review suggestion that turns out to be wrong, and the justification holds up (see verification below). Verification of each finding🔴 Critical —
|
Closes #1830