From 6abea5f8e8247d7990ce1d682105be00f6d45c97 Mon Sep 17 00:00:00 2001 From: yetone Date: Tue, 17 Nov 2026 20:04:25 +0800 Subject: [PATCH] agent: Antigravity's app on Windows is found by its installer's registration (JJasonsun on Discord) On Windows magpie's Agents page showed agy but not Antigravity's desktop app, which macOS finds right after install. desktopApps["antigravity"] knew only the macOS bundle, so on Windows the app was found only by ~/.gemini/antigravity/agyhub_summaries_proto.pb, which a fresh install hasn't written (the Windows box's real 2.30.0 install has no ~/.gemini/antigravity at all). Google's Antigravity-x64.exe (2.32.1, antigravity.google/download) is electron-builder's per-user NSIS installer (app-64.7z, SpiderBanner, package name antigravity). The real 2.30.0 install on xiaomi-gpu is %LOCALAPPDATA%\Programs\antigravity\Antigravity.exe, registered under HKCU\Software\121a0be4-63bd-531e-acf8-fc3924c7e984 (InstallLocation) and its Uninstall entry (DisplayIcon ...\Antigravity.exe,0, DisplayVersion 2.30.0, no InstallLocation). The guid is the UUID v5 of com.google.antigravity in electron-builder's namespace, as dsh's is. The entry now has win and guid, so AppVersion reads the registered version (the 2.15 gate still holds) and HasApp finds the default folder too. Linux ships only a tarball to unpack anywhere, with no desktop entry of its own, so Linux keeps the backend-file rule. Run: - Windows (xiaomi-gpu, real HKCU and 2.30.0 install, sandbox USERPROFILE/HOME/APPDATA/LOCALAPPDATA, PATH without agy): `magpie ls` from origin/main's desktopapp.go lists no Antigravity; from this tree it lists Antigravity. - win-run go test -count=1 -timeout 45m ./internal/agent: every TestAntigravity* and the new test pass; 36 reds, 35 of them listed in #6068 (Windows CI only compiles tests), and TestEveryFieldLabelHasTUIZh (Hermes profile labels from outside the test home), filed as #6972. None touch desktop apps' detection. - mote: go test -count=1 ./internal/agent ok; go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet ./... ok; gofmt -l clean. Broken by hand: origin/main's desktopapp.go with the new test -> TestAntigravityWindowsAppRegistered red ("guid \"\""; with that check skipped, "AppVersion \"\""). Not tried: the gateway wiring again on Windows in this change (031938ca9 ran 2.30.0's language server headless on this box and it resolved its models from ~/.gemini/config/config.json's gateway); a chat turn from the real GUI app; Linux; a full go test ./... (mote and mica are near full disk and loaded). --- .../agent/antigravity_windows_app_test.go | 75 +++++++++++++++++++ internal/agent/desktopapp.go | 15 +++- 2 files changed, 87 insertions(+), 3 deletions(-) create mode 100644 internal/agent/antigravity_windows_app_test.go diff --git a/internal/agent/antigravity_windows_app_test.go b/internal/agent/antigravity_windows_app_test.go new file mode 100644 index 000000000..80922094a --- /dev/null +++ b/internal/agent/antigravity_windows_app_test.go @@ -0,0 +1,75 @@ +package agent + +import ( + "os" + "path/filepath" + "testing" +) + +// Antigravity's Windows app is found by what its installer registered, with +// none of ~/.gemini/antigravity a fresh install hasn't written (JJasonsun +// on Discord: agy found on Windows, the app not). The registry values are a +// real 2.30.0 install's on the Windows box: HKCU\Software\'s +// InstallLocation, and its Uninstall entry's DisplayIcon and DisplayVersion +// with no InstallLocation. +func TestAntigravityWindowsAppRegistered(t *testing.T) { + home := antigravityHome(t) + app := desktopApps["antigravity"] + const guid = "121a0be4-63bd-531e-acf8-fc3924c7e984" + if app.guid != guid { + t.Fatalf("guid %q", app.guid) + } + programs := filepath.Join(t.TempDir(), "Programs") + at := filepath.Join(programs, "antigravity") + if err := os.MkdirAll(at, 0o755); err != nil { + t.Fatal(err) + } + if err := os.WriteFile(filepath.Join(at, "Antigravity.exe"), []byte("MZ"), 0o755); err != nil { + t.Fatal(err) + } + version := "1.11.3" + real := func(hive, key, name string) string { + if hive != "HKCU" { + return "" + } + switch key + "|" + name { + case `Software\` + guid + "|InstallLocation": + return at + case `Software\Microsoft\Windows\CurrentVersion\Uninstall\` + guid + "|DisplayIcon": + return filepath.Join(at, "Antigravity.exe") + ",0" + case `Software\Microsoft\Windows\CurrentVersion\Uninstall\` + guid + "|DisplayVersion": + return version + } + return "" + } + wasReg, wasFolders := windowsRegisteredApp, appFolders + t.Cleanup(func() { windowsRegisteredApp, appFolders = wasReg, wasFolders }) + windowsRegisteredApp = func(g string) (string, string) { return registeredIn(g, real) } + appFolders = func() []string { return nil } + + // one before 2.15, which takes no gateway, isn't it + if antigravity(home).Detected() { + t.Fatal("an app before 2.15 taken for it") + } + version = "2.30.0" + a := antigravity(home) + if v := (&Agent{ID: "antigravity"}).AppVersion(); v != "2.30.0" { + t.Fatalf("AppVersion %q", v) + } + if !a.Detected() { + t.Fatal("the registered app isn't detected") + } + if err := a.Field("model").Set("magpie/anth/claude-sonnet-5"); err != nil { + t.Fatal(err) + } + if f := newAgyFile(filepath.Join(home, ".gemini", "config", "config.json")); !f.wired() { + t.Fatalf("config.json not on magpie:\n%s", readFile(f.path)) + } + + // the installer's default folder, where no registry says + windowsRegisteredApp = func(string) (string, string) { return "", "" } + appFolders = func() []string { return []string{programs} } + if !(&Agent{ID: "antigravity"}).HasApp() { + t.Fatal("not found under %LOCALAPPDATA%\\Programs") + } +} diff --git a/internal/agent/desktopapp.go b/internal/agent/desktopapp.go index 02f447217..619f76c8f 100644 --- a/internal/agent/desktopapp.go +++ b/internal/agent/desktopapp.go @@ -136,9 +136,18 @@ var desktopApps = map[string]desktopApp{ // and needs no CLI. Its Windows install folder isn't known here, so on // Windows only the rule that a desktop app's folder is never gone holds. // Antigravity's app (antigravity.go), not Antigravity IDE - // (com.google.antigravity-ide). Its Windows and Linux installs aren't - // known here: there the file its backend writes finds it. - "antigravity": {id: "com.google.antigravity", names: []string{"Antigravity.app"}}, + // (com.google.antigravity-ide). On Windows Google's + // Antigravity-x64.exe (2.32.1 from antigravity.google/download) is + // electron-builder's per-user NSIS installer, package antigravity: a + // real 2.30.0 install on the Windows box is + // %LOCALAPPDATA%\Programs\antigravity\Antigravity.exe, registered + // under HKCU's Uninstall\121a0be4-… (the UUID v5 of + // com.google.antigravity, as dsh's) with its DisplayVersion. A fresh + // install writes no ~/.gemini/antigravity, so with only the file its + // backend writes the app went unfound there (JJasonsun on Discord). + // Linux has only a tarball to unpack anywhere, which writes no desktop + // entry: there the file its backend writes finds it. + "antigravity": {id: "com.google.antigravity", names: []string{"Antigravity.app"}, win: filepath.Join("antigravity", "Antigravity.exe"), guid: "121a0be4-63bd-531e-acf8-fc3924c7e984"}, // MiniMax Code Desktop (3.1.10: MiniMax Code.app, com.minimax.agent.cn // from filecdn.minimax.chat, com.minimax.agent from file.cdn.minimax.io; // app-identity.js) runs the mcode runtime on ~/.minimax/config.yaml, as