mirror of
https://github.com/mudler/LocalAI.git
synced 2026-07-06 22:37:03 -04:00
* fix(reasoning): don't persist request-scoped reasoning_effort into model config When a model sets `reasoning_effort: none` (or any default) in its YAML without an explicit `reasoning.disable`, ApplyReasoningEffort resolves that default at request time and sets ReasoningConfig.DisableReasoning on the request-scoped config copy. The post-load thinking/marker probe then wrote that request-scoped value back into the loader's persistent config via UpdateModelConfig, making it look as though the operator had explicitly set reasoning.disable=true. From then on, per-request `reasoning_effort` overrides were silently ignored (an explicit operator disable wins over a request asking to think). DetectThinkingSupportFromBackend only fills reasoning slots that are still nil, so a slot already set here came from ApplyReasoningEffort, not the probe. Snapshot which slots were nil before the probe and only persist those, so the probe's genuine backend detection is still saved while request-time reasoning effort never leaks into the persistent config. Fixes #10622 Signed-off-by: Tai An <antai12232931@outlook.com> * test(reasoning): cover persist-guard added in this PR, extract for testability ModelInference's post-probe persistence of ReasoningConfig.DisableReasoning / DisableReasoningTagPrefill had no test: the guard logic lived inline in a closure only reachable through a live gRPC backend. Extract it into persistProbedReasoning (pure refactor, no behavior change) so it can be exercised directly against a ModelConfigLoader, then add specs covering: - a probe-filled slot (nil beforehand) gets persisted - a slot that already carried a request-scoped value (e.g. from reasoning_effort: none) is left alone, i.e. the #10622 regression stays fixed - an operator's explicit persisted disable is preserved when the guard is false - the media marker still persists unconditionally Verified red/green: reverting persistProbedReasoning to the old unconditional copy fails exactly the two guard specs. Assisted-by: Claude:claude-sonnet-5 go vet Signed-off-by: Ettore Di Giacinto <mudler@localai.io> * test(reasoning): ignore os.Remove error in temp file cleanup (errcheck) Signed-off-by: Tai An <antai12232931@outlook.com> * chore: empty commit to re-trigger flaky Agent Jobs CI test Signed-off-by: Tai An <antai12232931@outlook.com> --------- Signed-off-by: Tai An <antai12232931@outlook.com> Signed-off-by: Ettore Di Giacinto <mudler@localai.io> Co-authored-by: Ettore Di Giacinto <mudler@localai.io> Co-authored-by: Ettore Di Giacinto <mudler@users.noreply.github.com>