mirror of
https://github.com/mudler/LocalAI.git
synced 2026-07-30 09:57:57 -04:00
Defensive follow-up to #11075; not the fix for the earlier longcat-video remote failure (that was a stale worker backend, fixed by upgrading it). The reconciler's scale-up path (ScheduleAndLoadModel) replays a ModelOptions proto blob captured at first load and never runs grpcModelOpts. So a companion resolved AFTER that blob was captured (e.g. the blob predates the companion's resolution) would never reach a scaled-up replica, which would then load without the companion option. applyCompanionOptions re-derives the model's managed companion options from its CURRENT config (via the new backend.CompanionArtifactOptions, wired through SmartRouterOptions.CompanionOptionsFor in distributed startup) and merges in only those the blob is missing — an option the blob already carries, including an author pin, always wins. nil-safe: single node and any caller that does not wire the resolver are an unchanged no-op. Also adds a regression guard for the controller->worker handoff: FileStagingClient (the client wrapping every distributed LoadModel) must forward ModelOptions.Options — the channel a managed companion option rides on — and ModelPath to the backend unchanged. The test pins that so a future refactor of the wrapper cannot silently drop options. Assisted-by: Claude Code:claude-opus-4-8[1m] [Read] [Edit] [Bash] Signed-off-by: Ettore Di Giacinto <mudler@localai.io>