From b74427c8c928c70dd9c9bca06ec6ce5736417bde Mon Sep 17 00:00:00 2001 From: 16601 <16601@example.com> Date: Mon, 13 Jul 2026 16:01:08 +0800 Subject: [PATCH] fix: allow local native engines on current platform --- cmd/aima/resolve.go | 7 +++++++ cmd/aima/resolve_test.go | 5 ++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/cmd/aima/resolve.go b/cmd/aima/resolve.go index ed322b33..cbc6f588 100644 --- a/cmd/aima/resolve.go +++ b/cmd/aima/resolve.go @@ -426,6 +426,13 @@ func localEngineOverlayCatalog(ctx context.Context, cat *knowledge.Catalog, db * asset.Source.InstallType = "preinstalled" changed = true } + // A locally discovered binary is executable on this host even when the + // catalog's downloadable release list does not include this platform. + // Preserve the catalog platforms and add the verified local platform. + if !asset.Source.Supports(hwInfo.Platform) && hwInfo.Platform != "" { + asset.Source.Platforms = append(asset.Source.Platforms, hwInfo.Platform) + changed = true + } before := 0 if asset.Source.Probe != nil { before = len(asset.Source.Probe.Paths) diff --git a/cmd/aima/resolve_test.go b/cmd/aima/resolve_test.go index 4c3f3998..34c178b7 100644 --- a/cmd/aima/resolve_test.go +++ b/cmd/aima/resolve_test.go @@ -546,7 +546,7 @@ func TestResolveCatalogWithLocalEngineOverlayUsesInstalledNativeBinary(t *testin }}, } - hw := knowledge.HardwareInfo{GPUArch: "Ada", Platform: "linux/amd64", RuntimeType: "native"} + hw := knowledge.HardwareInfo{GPUArch: "Ada", Platform: "linux/arm64", RuntimeType: "native"} merged := resolveCatalogWithLocalEngineOverlay(ctx, cat, db, hw, t.TempDir()) if merged == nil { t.Fatal("merged catalog is nil") @@ -568,6 +568,9 @@ func TestResolveCatalogWithLocalEngineOverlayUsesInstalledNativeBinary(t *testin if got := resolved.Source.Binary; got != filepath.Base(binaryPath) { t.Fatalf("resolved source binary = %q, want %q", got, filepath.Base(binaryPath)) } + if !resolved.Source.Supports("linux/arm64") { + t.Fatalf("resolved source does not support the locally discovered platform: %+v", resolved.Source.Platforms) + } if strings.TrimSpace(resolved.EngineImage) != "" { t.Fatalf("resolved engine image = %q, want empty for native overlay", resolved.EngineImage) }