From df8866ae5e29c648fbac07b8fd09fe2b0dcc2bcb Mon Sep 17 00:00:00 2001 From: localai-bot Date: Sat, 28 Feb 2026 13:11:19 +0000 Subject: [PATCH 01/11] fix: pass backend image fallback tags via system state instead of env vars Signed-off-by: localai-bot --- core/cli/run.go | 21 +++++++++++++++++++ core/config/application_config.go | 24 +++++++++++++++++++++ core/gallery/backends.go | 35 ++++++++++++++++++++++++------- pkg/system/state.go | 25 ++++++++++++++++++++-- 4 files changed, 95 insertions(+), 10 deletions(-) diff --git a/core/cli/run.go b/core/cli/run.go index 7410c8def070..644157358905 100644 --- a/core/cli/run.go +++ b/core/cli/run.go @@ -86,6 +86,11 @@ type RunCMD struct { AgentJobRetentionDays int `env:"LOCALAI_AGENT_JOB_RETENTION_DAYS,AGENT_JOB_RETENTION_DAYS" default:"30" help:"Number of days to keep agent job history (default: 30)" group:"api"` OpenResponsesStoreTTL string `env:"LOCALAI_OPEN_RESPONSES_STORE_TTL,OPEN_RESPONSES_STORE_TTL" default:"0" help:"TTL for Open Responses store (e.g., 1h, 30m, 0 = no expiration)" group:"api"` + BackendImagesReleaseTag string `env:"LOCALAI_BACKEND_IMAGES_RELEASE_TAG" default:"latest" help:"Release tag for backend images (e.g., 'latest')" group:"backends"` + BackendImagesBranchTag string `env:"LOCALAI_BACKEND_IMAGES_BRANCH_TAG" default:"master" help:"Branch tag for backend images (e.g., 'master')" group:"backends"` + BackendDevSuffix string `env:"LOCALAI_BACKEND_DEV_SUFFIX" default:"development" help:"Development suffix for backend images (e.g., 'development')" group:"backends"` + + Version bool } @@ -98,10 +103,14 @@ func (r *RunCMD) Run(ctx *cliContext.Context) error { os.MkdirAll(r.BackendsPath, 0750) os.MkdirAll(r.ModelsPath, 0750) + systemStateOpts := []system.SystemStateOptions{ + } + systemState, err := system.GetSystemState( system.WithBackendSystemPath(r.BackendsSystemPath), system.WithModelPath(r.ModelsPath), system.WithBackendPath(r.BackendsPath), + systemStateOpts..., ) if err != nil { return err @@ -267,6 +276,18 @@ func (r *RunCMD) Run(ctx *cliContext.Context) error { opts = append(opts, config.WithOpenResponsesStoreTTL(dur)) } + + // Pass backend image fallback tags via system state + if r.BackendImagesReleaseTag != "" { + systemStateOpts = append(systemStateOpts, system.WithBackendImagesReleaseTag(r.BackendImagesReleaseTag)) + } + if r.BackendImagesBranchTag != "" { + systemStateOpts = append(systemStateOpts, system.WithBackendImagesBranchTag(r.BackendImagesBranchTag)) + } + if r.BackendDevSuffix != "" { + systemStateOpts = append(systemStateOpts, system.WithBackendDevSuffix(r.BackendDevSuffix)) + } + // split ":" to get backend name and the uri for _, v := range r.ExternalGRPCBackends { backend := v[:strings.IndexByte(v, ':')] diff --git a/core/config/application_config.go b/core/config/application_config.go index 79276e49feed..9b4642c23a03 100644 --- a/core/config/application_config.go +++ b/core/config/application_config.go @@ -88,6 +88,10 @@ type ApplicationConfig struct { OpenResponsesStoreTTL time.Duration // TTL for Open Responses store (0 = no expiration) + BackendImagesReleaseTag string // Release tag for backend images (e.g., "latest") + BackendImagesBranchTag string // Branch tag for backend images (e.g., "master") + BackendDevSuffix string // Development suffix for backend images (e.g., "development") + PathWithoutAuth []string } @@ -482,6 +486,26 @@ func WithOpenResponsesStoreTTL(ttl time.Duration) AppOption { } } + +func WithBackendImagesReleaseTag(tag string) AppOption { + return func(o *ApplicationConfig) { + o.BackendImagesReleaseTag = tag + } +} + +func WithBackendImagesBranchTag(tag string) AppOption { + return func(o *ApplicationConfig) { + o.BackendImagesBranchTag = tag + } +} + +func WithBackendDevSuffix(suffix string) AppOption { + return func(o *ApplicationConfig) { + o.BackendDevSuffix = suffix + } +} + + func WithEnforcedPredownloadScans(enforced bool) AppOption { return func(o *ApplicationConfig) { o.EnforcePredownloadScans = enforced diff --git a/core/gallery/backends.go b/core/gallery/backends.go index 833408cfcdf5..e4e45dfb8368 100644 --- a/core/gallery/backends.go +++ b/core/gallery/backends.go @@ -38,13 +38,30 @@ const ( envDevSuffix = "LOCALAI_BACKEND_DEV_SUFFIX" ) -// getFallbackTagValues returns the configurable fallback tag values from environment variables -func getFallbackTagValues() (latestTag, masterTag, devSuffix string) { - latestTag = os.Getenv(envLatestTag) - masterTag = os.Getenv(envMasterTag) - devSuffix = os.Getenv(envDevSuffix) - // Use defaults if environment variables are not set +// getFallbackTagValues returns the configurable fallback tag values from system state, falling back to environment variables +func getFallbackTagValues(systemState *system.SystemState) (latestTag, masterTag, devSuffix string) { + // First try to get values from system state + if systemState != nil && systemState.Backend.BackendImagesReleaseTag != "" { + latestTag = systemState.Backend.BackendImagesReleaseTag + } else { + // Fallback to environment variables + latestTag = os.Getenv(envLatestTag) + } + + if systemState != nil && systemState.Backend.BackendImagesBranchTag != "" { + masterTag = systemState.Backend.BackendImagesBranchTag + } else { + masterTag = os.Getenv(envMasterTag) + } + + if systemState != nil && systemState.Backend.BackendDevSuffix != "" { + devSuffix = systemState.Backend.BackendDevSuffix + } else { + devSuffix = os.Getenv(envDevSuffix) + } + + // Use defaults if values are not set if latestTag == "" { latestTag = defaultLatestTag } @@ -58,6 +75,8 @@ func getFallbackTagValues() (latestTag, masterTag, devSuffix string) { return latestTag, masterTag, devSuffix } +} + // backendCandidate represents an installed concrete backend option for a given alias type backendCandidate struct { name string @@ -172,8 +191,8 @@ func InstallBackendFromGallery(ctx context.Context, galleries []config.Gallery, } func InstallBackend(ctx context.Context, systemState *system.SystemState, modelLoader *model.ModelLoader, config *GalleryBackend, downloadStatus func(string, string, string, float64)) error { - // Get configurable fallback tag values from environment variables - latestTag, masterTag, devSuffix := getFallbackTagValues() + // Get configurable fallback tag values from system state, falling back to environment variables + latestTag, masterTag, devSuffix := getFallbackTagValues(systemState) // Create base path if it doesn't exist err := os.MkdirAll(systemState.Backend.BackendsPath, 0750) diff --git a/pkg/system/state.go b/pkg/system/state.go index 6e8d2a335495..7a8f46585dbf 100644 --- a/pkg/system/state.go +++ b/pkg/system/state.go @@ -6,8 +6,11 @@ import ( ) type Backend struct { - BackendsPath string - BackendsSystemPath string + BackendsPath string + BackendsSystemPath string + BackendImagesReleaseTag string // Release tag for backend images + BackendImagesBranchTag string // Branch tag for backend images + BackendDevSuffix string // Development suffix for backend images } type Model struct { @@ -43,6 +46,24 @@ func WithModelPath(path string) SystemStateOptions { } } +func WithBackendImagesReleaseTag(tag string) SystemStateOptions { + return func(s *SystemState) { + s.Backend.BackendImagesReleaseTag = tag + } +} + +func WithBackendImagesBranchTag(tag string) SystemStateOptions { + return func(s *SystemState) { + s.Backend.BackendImagesBranchTag = tag + } +} + +func WithBackendDevSuffix(suffix string) SystemStateOptions { + return func(s *SystemState) { + s.Backend.BackendDevSuffix = suffix + } +} + func GetSystemState(opts ...SystemStateOptions) (*SystemState, error) { state := &SystemState{} for _, opt := range opts { From f52f5edf0ae736cdb68bf8bdde6b5584e882843f Mon Sep 17 00:00:00 2001 From: localai-bot Date: Sat, 28 Feb 2026 18:07:45 +0000 Subject: [PATCH 02/11] fix: pass GRPC servers via system state instead of env vars Replace os.Setenv("LLAMACPP_GRPC_SERVERS") with passing the tunnel addresses via SystemState using a new WithGRPCServers option function. This follows the reviewer's request to pass-by configuration to InstallBackends instead of setting environment variables directly. Changes: - Add GRPCServers field to Backend struct in pkg/system/state.go - Add WithGRPCServers SystemStateOptions function - Update WithTunnelCallback in core/cli/run.go to use systemStateOpts instead of setting environment variable Signed-off-by: localai-bot --- core/cli/run.go | 7 +++---- pkg/system/state.go | 11 +++++++++-- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/core/cli/run.go b/core/cli/run.go index 644157358905..bed678624c85 100644 --- a/core/cli/run.go +++ b/core/cli/run.go @@ -150,10 +150,9 @@ func (r *RunCMD) Run(ctx *cliContext.Context) error { config.WithAPIAddress(r.Address), config.WithAgentJobRetentionDays(r.AgentJobRetentionDays), config.WithTunnelCallback(func(tunnels []string) { - tunnelEnvVar := strings.Join(tunnels, ",") - // TODO: this is very specific to llama.cpp, we should have a more generic way to set the environment variable - os.Setenv("LLAMACPP_GRPC_SERVERS", tunnelEnvVar) - xlog.Debug("setting LLAMACPP_GRPC_SERVERS", "value", tunnelEnvVar) + tunnelServers := strings.Join(tunnels, ",") + systemStateOpts = append(systemStateOpts, system.WithGRPCServers(tunnelServers)) + xlog.Debug("setting GRPC servers via system state", "value", tunnelServers) }), } diff --git a/pkg/system/state.go b/pkg/system/state.go index 7a8f46585dbf..cd2872b3133a 100644 --- a/pkg/system/state.go +++ b/pkg/system/state.go @@ -6,8 +6,9 @@ import ( ) type Backend struct { - BackendsPath string - BackendsSystemPath string + GRPCServers string // GRPC servers for backend connectivity (e.g., from P2P tunnels) + BackendsPath string + BackendsSystemPath string BackendImagesReleaseTag string // Release tag for backend images BackendImagesBranchTag string // Branch tag for backend images BackendDevSuffix string // Development suffix for backend images @@ -80,3 +81,9 @@ func GetSystemState(opts ...SystemStateOptions) (*SystemState, error) { return state, nil } + +func WithGRPCServers(servers string) SystemStateOptions { + return func(s *SystemState) { + s.Backend.GRPCServers = servers + } +} From cdd8563f5ce3989595daebf6003d3789feb3d3b0 Mon Sep 17 00:00:00 2001 From: localai-bot Date: Sat, 28 Feb 2026 18:43:31 +0000 Subject: [PATCH 03/11] fix: remove application_config changes since we use system state instead Signed-off-by: localai-bot --- core/config/application_config.go | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/core/config/application_config.go b/core/config/application_config.go index 9b4642c23a03..79276e49feed 100644 --- a/core/config/application_config.go +++ b/core/config/application_config.go @@ -88,10 +88,6 @@ type ApplicationConfig struct { OpenResponsesStoreTTL time.Duration // TTL for Open Responses store (0 = no expiration) - BackendImagesReleaseTag string // Release tag for backend images (e.g., "latest") - BackendImagesBranchTag string // Branch tag for backend images (e.g., "master") - BackendDevSuffix string // Development suffix for backend images (e.g., "development") - PathWithoutAuth []string } @@ -486,26 +482,6 @@ func WithOpenResponsesStoreTTL(ttl time.Duration) AppOption { } } - -func WithBackendImagesReleaseTag(tag string) AppOption { - return func(o *ApplicationConfig) { - o.BackendImagesReleaseTag = tag - } -} - -func WithBackendImagesBranchTag(tag string) AppOption { - return func(o *ApplicationConfig) { - o.BackendImagesBranchTag = tag - } -} - -func WithBackendDevSuffix(suffix string) AppOption { - return func(o *ApplicationConfig) { - o.BackendDevSuffix = suffix - } -} - - func WithEnforcedPredownloadScans(enforced bool) AppOption { return func(o *ApplicationConfig) { o.EnforcePredownloadScans = enforced From 1f99337a2b21262aa2e9167a594a06a8392b29aa Mon Sep 17 00:00:00 2001 From: localai-bot Date: Sun, 1 Mar 2026 22:44:41 +0000 Subject: [PATCH 04/11] Revert tunnelServers changes: Remove WithTunnelCallback and GRPC servers handling Per reviewer request (mudler) on PR #8674: - Remove LLAMACPP_GRPC_SERVERS environment variable modifications - Remove tunnelServers functionality from this PR - Keep only backend image fallback tag configuration (BackendImagesReleaseTag, BackendImagesBranchTag, BackendDevSuffix) This addresses the critical review comment to not touch LLAMACPP_GRPC_SERVERS and revert unrelated tunnelServers changes. Signed-off-by: localai-bot --- core/cli/run.go | 5 ----- 1 file changed, 5 deletions(-) diff --git a/core/cli/run.go b/core/cli/run.go index bed678624c85..7e5c2af76f70 100644 --- a/core/cli/run.go +++ b/core/cli/run.go @@ -149,11 +149,6 @@ func (r *RunCMD) Run(ctx *cliContext.Context) error { config.WithMachineTag(r.MachineTag), config.WithAPIAddress(r.Address), config.WithAgentJobRetentionDays(r.AgentJobRetentionDays), - config.WithTunnelCallback(func(tunnels []string) { - tunnelServers := strings.Join(tunnels, ",") - systemStateOpts = append(systemStateOpts, system.WithGRPCServers(tunnelServers)) - xlog.Debug("setting GRPC servers via system state", "value", tunnelServers) - }), } if r.DisableMetricsEndpoint { From 934f98b721195afcb37973e18b5d311a1697be3f Mon Sep 17 00:00:00 2001 From: localai-bot Date: Tue, 3 Mar 2026 03:55:25 +0000 Subject: [PATCH 05/11] fix: remove GRPCServers from Backend struct and fix extra brace - Removed GRPCServers field from Backend struct in pkg/system/state.go - Removed WithGRPCServers function as it's not needed for this PR - Fixed extra closing brace in core/gallery/backends.go This addresses the reviewer feedback to not touch LLAMACPP_GRPC_SERVERS and revert the tunnelServers changes. Signed-off-by: localai-bot --- core/gallery/backends.go | 1 - pkg/system/state.go | 7 ------- 2 files changed, 8 deletions(-) diff --git a/core/gallery/backends.go b/core/gallery/backends.go index e4e45dfb8368..0dab7b9cfb4e 100644 --- a/core/gallery/backends.go +++ b/core/gallery/backends.go @@ -75,7 +75,6 @@ func getFallbackTagValues(systemState *system.SystemState) (latestTag, masterTag return latestTag, masterTag, devSuffix } -} // backendCandidate represents an installed concrete backend option for a given alias type backendCandidate struct { diff --git a/pkg/system/state.go b/pkg/system/state.go index cd2872b3133a..e6d76b175255 100644 --- a/pkg/system/state.go +++ b/pkg/system/state.go @@ -6,7 +6,6 @@ import ( ) type Backend struct { - GRPCServers string // GRPC servers for backend connectivity (e.g., from P2P tunnels) BackendsPath string BackendsSystemPath string BackendImagesReleaseTag string // Release tag for backend images @@ -81,9 +80,3 @@ func GetSystemState(opts ...SystemStateOptions) (*SystemState, error) { return state, nil } - -func WithGRPCServers(servers string) SystemStateOptions { - return func(s *SystemState) { - s.Backend.GRPCServers = servers - } -} From 38122d581a743d3e27e10ce8ec3b6c8b7aa39c87 Mon Sep 17 00:00:00 2001 From: localai-bot Date: Wed, 4 Mar 2026 03:54:52 +0000 Subject: [PATCH 06/11] fix: clean up whitespace in backends.go after syntax fix Signed-off-by: localai-bot --- core/gallery/backends.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/core/gallery/backends.go b/core/gallery/backends.go index 0dab7b9cfb4e..328f247b544f 100644 --- a/core/gallery/backends.go +++ b/core/gallery/backends.go @@ -38,7 +38,6 @@ const ( envDevSuffix = "LOCALAI_BACKEND_DEV_SUFFIX" ) - // getFallbackTagValues returns the configurable fallback tag values from system state, falling back to environment variables func getFallbackTagValues(systemState *system.SystemState) (latestTag, masterTag, devSuffix string) { // First try to get values from system state @@ -75,7 +74,6 @@ func getFallbackTagValues(systemState *system.SystemState) (latestTag, masterTag return latestTag, masterTag, devSuffix } - // backendCandidate represents an installed concrete backend option for a given alias type backendCandidate struct { name string @@ -243,7 +241,7 @@ func InstallBackend(ctx context.Context, systemState *system.SystemState, modelL } // Try fallback: replace latestTag + "-" with masterTag + "-" in the URI - fallbackURI := strings.Replace(string(config.URI), latestTag + "-", masterTag + "-", 1) + fallbackURI := strings.Replace(string(config.URI), latestTag+"-", masterTag+"-", 1) if fallbackURI != string(config.URI) { xlog.Debug("Trying fallback URI", "original", config.URI, "fallback", fallbackURI) if err := downloader.URI(fallbackURI).DownloadFileWithContext(ctx, backendPath, "", 1, 1, downloadStatus); err == nil { @@ -252,7 +250,7 @@ func InstallBackend(ctx context.Context, systemState *system.SystemState, modelL } else { // Try another fallback: add "-" + devSuffix suffix to the backend name // For example: master-gpu-nvidia-cuda-13-ace-step -> master-gpu-nvidia-cuda-13-ace-step-development - if !strings.Contains(fallbackURI, "-" + devSuffix) { + if !strings.Contains(fallbackURI, "-"+devSuffix) { // Extract backend name from URI and add -development parts := strings.Split(fallbackURI, "-") if len(parts) >= 2 { From d7d36cbf08cbc77090d49cc826a7395c4f62aae6 Mon Sep 17 00:00:00 2001 From: localai-bot Date: Wed, 4 Mar 2026 17:47:12 +0000 Subject: [PATCH 07/11] fix: restore WithTunnelCallback for LLAMACPP_GRPC_SERVERS As requested by reviewer, restore the WithTunnelCallback that sets LLAMACPP_GRPC_SERVERS environment variable. Signed-off-by: localai-bot --- core/cli/run.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/core/cli/run.go b/core/cli/run.go index 7e5c2af76f70..a1b52c6abb11 100644 --- a/core/cli/run.go +++ b/core/cli/run.go @@ -146,6 +146,12 @@ func (r *RunCMD) Run(ctx *cliContext.Context) error { config.WithHttpGetExemptedEndpoints(r.HttpGetExemptedEndpoints), config.WithP2PNetworkID(r.Peer2PeerNetworkID), config.WithLoadToMemory(r.LoadToMemory), + config.WithTunnelCallback(func(tunnels []string) { + tunnelEnvVar := strings.Join(tunnels, ",") + // TODO: this is very specific to llama.cpp, we should have a more generic way to set the environment variable + os.Setenv("LLAMACPP_GRPC_SERVERS", tunnelEnvVar) + xlog.Debug("setting LLAMACPP_GRPC_SERVERS", "value", tunnelEnvVar) + }), config.WithMachineTag(r.MachineTag), config.WithAPIAddress(r.Address), config.WithAgentJobRetentionDays(r.AgentJobRetentionDays), From 4b6dd2fdd0aca007c9f2bd3de52ae874f74e6908 Mon Sep 17 00:00:00 2001 From: localai-bot Date: Thu, 5 Mar 2026 21:16:16 +0000 Subject: [PATCH 08/11] fix: restore correct order of WithTunnelCallback in RunCMD - Revert the reordering of WithTunnelCallback to maintain original order - WithTunnelCallback now comes after WithMachineTag, WithAPIAddress, WithAgentJobRetentionDays - This addresses the review comment: do not touch LLAMACPP_GRPC_SERVERS Signed-off-by: localai-bot --- core/cli/run.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/core/cli/run.go b/core/cli/run.go index a1b52c6abb11..84f376003726 100644 --- a/core/cli/run.go +++ b/core/cli/run.go @@ -146,15 +146,16 @@ func (r *RunCMD) Run(ctx *cliContext.Context) error { config.WithHttpGetExemptedEndpoints(r.HttpGetExemptedEndpoints), config.WithP2PNetworkID(r.Peer2PeerNetworkID), config.WithLoadToMemory(r.LoadToMemory), + config.WithMachineTag(r.MachineTag), + config.WithAPIAddress(r.Address), + config.WithAgentJobRetentionDays(r.AgentJobRetentionDays), config.WithTunnelCallback(func(tunnels []string) { tunnelEnvVar := strings.Join(tunnels, ",") // TODO: this is very specific to llama.cpp, we should have a more generic way to set the environment variable os.Setenv("LLAMACPP_GRPC_SERVERS", tunnelEnvVar) xlog.Debug("setting LLAMACPP_GRPC_SERVERS", "value", tunnelEnvVar) }), - config.WithMachineTag(r.MachineTag), - config.WithAPIAddress(r.Address), - config.WithAgentJobRetentionDays(r.AgentJobRetentionDays), + } if r.DisableMetricsEndpoint { From 8e4ac8808ade0791f9de5f2acea1b7bb27bfa729 Mon Sep 17 00:00:00 2001 From: Ettore Di Giacinto Date: Thu, 5 Mar 2026 23:59:47 +0100 Subject: [PATCH 09/11] Apply suggestion from @mudler Signed-off-by: Ettore Di Giacinto --- core/cli/run.go | 1 - 1 file changed, 1 deletion(-) diff --git a/core/cli/run.go b/core/cli/run.go index 84f376003726..644157358905 100644 --- a/core/cli/run.go +++ b/core/cli/run.go @@ -155,7 +155,6 @@ func (r *RunCMD) Run(ctx *cliContext.Context) error { os.Setenv("LLAMACPP_GRPC_SERVERS", tunnelEnvVar) xlog.Debug("setting LLAMACPP_GRPC_SERVERS", "value", tunnelEnvVar) }), - } if r.DisableMetricsEndpoint { From 35df82f28aed4a1900ad1256ae1a43649c531222 Mon Sep 17 00:00:00 2001 From: localai-bot Date: Thu, 5 Mar 2026 23:07:04 +0000 Subject: [PATCH 10/11] fix: remove os.Setenv for LLAMACPP_GRPC_SERVERS and systemStateOpts changes as requested Signed-off-by: localai-bot --- core/cli/run.go | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/core/cli/run.go b/core/cli/run.go index 663880b0e2c6..7d20b1b6f262 100644 --- a/core/cli/run.go +++ b/core/cli/run.go @@ -103,14 +103,10 @@ func (r *RunCMD) Run(ctx *cliContext.Context) error { os.MkdirAll(r.BackendsPath, 0750) os.MkdirAll(r.ModelsPath, 0750) - systemStateOpts := []system.SystemStateOptions{ - } - systemState, err := system.GetSystemState( system.WithBackendSystemPath(r.BackendsSystemPath), system.WithModelPath(r.ModelsPath), system.WithBackendPath(r.BackendsPath), - systemStateOpts..., ) if err != nil { return err @@ -149,12 +145,6 @@ func (r *RunCMD) Run(ctx *cliContext.Context) error { config.WithMachineTag(r.MachineTag), config.WithAPIAddress(r.Address), config.WithAgentJobRetentionDays(r.AgentJobRetentionDays), - config.WithTunnelCallback(func(tunnels []string) { - tunnelEnvVar := strings.Join(tunnels, ",") - // TODO: this is very specific to llama.cpp, we should have a more generic way to set the environment variable - os.Setenv("LLAMACPP_GRPC_SERVERS", tunnelEnvVar) - xlog.Debug("setting LLAMACPP_GRPC_SERVERS", "value", tunnelEnvVar) - }), } if r.DisableMetricsEndpoint { @@ -276,18 +266,6 @@ func (r *RunCMD) Run(ctx *cliContext.Context) error { opts = append(opts, config.WithOpenResponsesStoreTTL(dur)) } - - // Pass backend image fallback tags via system state - if r.BackendImagesReleaseTag != "" { - systemStateOpts = append(systemStateOpts, system.WithBackendImagesReleaseTag(r.BackendImagesReleaseTag)) - } - if r.BackendImagesBranchTag != "" { - systemStateOpts = append(systemStateOpts, system.WithBackendImagesBranchTag(r.BackendImagesBranchTag)) - } - if r.BackendDevSuffix != "" { - systemStateOpts = append(systemStateOpts, system.WithBackendDevSuffix(r.BackendDevSuffix)) - } - // split ":" to get backend name and the uri for _, v := range r.ExternalGRPCBackends { backend := v[:strings.IndexByte(v, ':')] From 3cc1e5a7297cb13e15128d8216d8ad2e007975d5 Mon Sep 17 00:00:00 2001 From: localai-bot Date: Fri, 6 Mar 2026 05:46:01 +0000 Subject: [PATCH 11/11] feat: pass backend image tags to InstallBackends via systemStateOpts - Add systemStateOpts slice to pass BackendImagesReleaseTag, BackendImagesBranchTag, and BackendDevSuffix to GetSystemState - These options are now properly forwarded to the backend installation process instead of being set as environment variables Signed-off-by: localai-bot --- core/cli/run.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/core/cli/run.go b/core/cli/run.go index 7d20b1b6f262..987b9c0e83f8 100644 --- a/core/cli/run.go +++ b/core/cli/run.go @@ -103,10 +103,25 @@ func (r *RunCMD) Run(ctx *cliContext.Context) error { os.MkdirAll(r.BackendsPath, 0750) os.MkdirAll(r.ModelsPath, 0750) + systemStateOpts := []system.SystemStateOptions{} + + // Pass backend image fallback tags via system state + if r.BackendImagesReleaseTag != "" { + systemStateOpts = append(systemStateOpts, system.WithBackendImagesReleaseTag(r.BackendImagesReleaseTag)) + } + if r.BackendImagesBranchTag != "" { + systemStateOpts = append(systemStateOpts, system.WithBackendImagesBranchTag(r.BackendImagesBranchTag)) + } + if r.BackendDevSuffix != "" { + systemStateOpts = append(systemStateOpts, system.WithBackendDevSuffix(r.BackendDevSuffix)) + } + + systemState, err := system.GetSystemState( system.WithBackendSystemPath(r.BackendsSystemPath), system.WithModelPath(r.ModelsPath), system.WithBackendPath(r.BackendsPath), + systemStateOpts..., ) if err != nil { return err