bug(routing): knn backend drops generation settings (temperature / max_tokens / reasoning_effort) on per-model endpoints
Summary
The knn routing backend routes calls to per-model endpoints through PerModelProvider, but the per-model sub-providers it builds never receive .generation. As a result, the configured agents.defaults.temperature / max_tokens / reasoning_effort are silently ignored for any call that routes to a knn endpoint; those calls fall back to the hardcoded GenerationSettings() defaults (temperature=0.7, max_tokens=4096).
Introduced by #163 (opt-in knn backend). Off by default, so impact is limited to users who set routing.enabled=true and routing.backend=knn.
Mechanism
- Generation defaults reach a call via
chat_with_retry, which readsself.generation.{temperature,max_tokens,reasoning_effort}and injects them intochat()(raven/providers/base.py:516-521). The low-levelchat()itself does not readself.generation. - On the normal path,
make_providersetsprovider.generationfrom config (raven/cli/_helpers.py:134), so the values reach calls. - On the knn path,
PerModelProvider.__init__builds oneCustomProviderper model with onlyapi_key/api_base/default_modeland never assigns.generation(raven/providers/per_model_provider.py:23-30).PerModelProvider.chat_with_retrydelegates to the sub-provider (per_model_provider.py:49), whose.generationis the default, so the configured values are lost. gateway_commands.py:50also never sets.generationon thePerModelProvideritself.
Impact
- knn-routed calls ignore user-configured
temperature/max_tokens/reasoning_effort. - Low severity: knn is opt-in and off by default (
routing.enabled=false,routing.backend=ecoclaw).
Fix
PerModelProvider should inherit the fallback provider's .generation and propagate it to the per-model sub-providers (the fallback is already configured by make_provider before knn wrapping at gateway_commands.py:196):
# in PerModelProvider.__init__, after building self._by_model
self.generation = fallback.generation
for sub in self._by_model.values():
sub.generation = self.generation
Note
This same wiring gap also blocks the configurable llm_call_timeout proposed in #150 from reaching knn endpoints. The #150 fix will apply the 3-line propagation above as a side effect, which incidentally corrects the temperature / max_tokens loss described here. Filing this separately to record the root cause; the cross-reference on #163 keeps attribution clear.
Related: #150, #163.
Resolved by #204 (merged): PerModelProvider now propagates its .generation to the per-model sub-providers, so knn-routed calls honor the configured temperature / max_tokens / reasoning_effort (and the new llm_call_timeout). Closing as fixed.