Skip to content

The cross-harness, self-improving memory layer for AI agents. Join our community: https://discord.com/invite/zdNChS2fBu

fix(selfupdate): find format-qualified linux packages in update check (#1065)

Rudy Mizrahi Celekli33b751acd263
diff --git a/cli/beacon/internal/endpoint/selfupdate/check.go b/cli/beacon/internal/endpoint/selfupdate/check.go
index 35d4d9de..78d066db 100644
--- a/cli/beacon/internal/endpoint/selfupdate/check.go
+++ b/cli/beacon/internal/endpoint/selfupdate/check.go
@@ -72,7 +72,9 @@ func CheckWithMode(ctx context.Context, currentVersion, localMode string) (Check
return res, err
}
res.ManifestResult = eval
- if a, ok := manifest.ArtifactFor(res.ArchKey); ok {
+ a, key, ok := selectArtifact(manifest, false)
+ res.ArchKey = key
+ if ok {
res.Artifact = a
res.HasArtifact = true
}
diff --git a/cli/beacon/internal/endpoint/selfupdate/selfupdate_test.go b/cli/beacon/internal/endpoint/selfupdate/selfupdate_test.go
index 0bbd4808..fe40bfb0 100644
--- a/cli/beacon/internal/endpoint/selfupdate/selfupdate_test.go
+++ b/cli/beacon/internal/endpoint/selfupdate/selfupdate_test.go
@@ -8,6 +8,7 @@ import (
"os"
"path/filepath"
"runtime"
+ "strings"
"testing"
"github.com/asymptote-labs/agent-beacon/cli/beacon/internal/updatecheck"
@@ -114,10 +115,15 @@ func TestResolveManifestURLPrecedence(t *testing.T) {
}
}
+// Linux manifests publish linux_<arch>_deb and linux_<arch>_rpm, never a bare linux_<arch>.
func TestCheck(t *testing.T) {
+ key := updatecheck.RuntimeArchKey()
+ if runtime.GOOS == "linux" {
+ key += "_" + strings.TrimPrefix(linuxPackageExt(), ".")
+ }
+ url := "https://x/beacon" + packageExt("")
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- _, _ = w.Write([]byte(`{"schema":1,"version":"9.9.9","artifacts":{` +
- `"` + updatecheck.RuntimeArchKey() + `":{"url":"https://x/p.pkg","sha256":"deadbeef"}}}`))
+ _, _ = w.Write([]byte(`{"schema":1,"version":"9.9.9","artifacts":{"` + key + `":{"url":"` + url + `","sha256":"deadbeef"}}}`))
}))
defer srv.Close()
t.Setenv(updatecheck.ManifestURLEnv, srv.URL)
@@ -129,8 +135,8 @@ func TestCheck(t *testing.T) {
if !res.UpdateAvailable {
t.Fatalf("expected update available: %+v", res)
}
- if !res.HasArtifact || res.Artifact.URL != "https://x/p.pkg" {
- t.Fatalf("artifact not resolved for running arch: %+v", res)
+ if !res.HasArtifact || res.Artifact.URL != url || res.ArchKey != key {
+ t.Fatalf("manifest artifact %s not resolved: %+v", key, res)
}
}