Files
magpie/internal/agentenv
yetone 7c712847b7 agent: Antigravity's desktop app is a row, wired through its gateway setting (ryougi_hachi on X)
Antigravity (Google's desktop app, 2.15 and later; not Antigravity IDE)
takes a gateway from ~/.antigravity/settings.json: Google's Antigravity
Enterprise Gateway, documented at
docs.cloud.google.com/gemini/enterprise/docs/ai-developer-tools/connect-enterprise-gateway.
magpie writes gateway {enabled, url: magpie's, apiKey: magpie-antigravity,
wireProtocol: openai} and models.defaultModelId, and takes out models.list
(it would narrow the picker). The user's gateway, default model and list
are stashed and put back on disconnect or when a model of their own is
picked; caCertPath and the rest of the file are untouched. Sync keeps what
the user added to magpie's block, and so does a set again (a moved port,
Reconnect). Check speaks when admin_settings.json or AGY_LLM_GATEWAY_URL
wins over the file, and when the block's url or key is no longer magpie's
(wiringOff), so drift and a port move see it. AGY_LLM_GATEWAY_URL joins
agentenv.Vars, cleared in every sandbox. Found by its bundle
(com.google.antigravity, 2.15+) or the file its backend writes
(~/.gemini/antigravity/agyhub_summaries_proto.pb); ~/.antigravity alone is
the IDE's and agy's too. The notices are translated (zh, zh-TW, ja, de).
`magpie antigravity` now names the app; agy stays `magpie agy` /
`antigravity-cli`.

Run (worktree base 647323409, on mote):
- Real app backend in a sandbox HOME: Antigravity.app 2.28.2's
  language_server (hub), wired by this branch's magpie built from the
  worktree (`magpie antigravity magpie/rec/pro`, MAGPIE_ADDR on a port of
  its own, a recording upstream as a custom provider).
  GetCascadeModelConfigData listed rec/pro from magpie's /v1/models; a
  cascade ("Say hi") went app -> magpie -> upstream as
  /v1/chat/completions (stream, 12 tools) and its answer came back into
  the trajectory. `magpie usage` counted both calls to Antigravity.
  `magpie antigravity default` gave back the user's genai gateway, model
  and list byte for byte (JSON-equal).
- Before that the same file was checked with the real agy CLI 1.4.12.
- go vet (darwin, GOOS=linux, GOOS=windows) for internal/agent; gofmt.
- go test -tags nogui -count=1 ./internal/agent ./internal/agentenv
  ./internal/gui ./internal/usage ./internal/cli: all ok at this tree.
  The first run was red in four guard tests (TestFolderVarsAreListed,
  TestDriftUnwiredEveryAgent/antigravity, TestReverseProxyIsStillMagpie,
  TestPortMovesEveryAgent): Check had no wiringOff and the variable
  wasn't listed. Both fixed here.
- GUI (node --test, Chromium + WebKit): i18n-keys, agent-notice-lang,
  about-notices, 46 of 46 ok.

Broken by hand: renamed the gateway's stash key and dropped the
models.list deletion: TestAntigravityGateway, TestAntigravityGatewayFromNothing
and TestAntigravityOwnModelBack each went red; the desktopApps entry
missing made TestAntigravityDetected red; writing magpie's block whole on a set
again made TestAntigravitySync red (the user's customHeaders lost). The new tests are red on the
old code (no such agent).

Not tried: the Electron window itself (the backend was driven over its
RPCs, headless); the app on Windows or Linux (its install paths there
aren't known; the backend's file finds it); whether Google sign-in comes
back on its own after disconnect; the full ./... suite, because another
session's full suite was running on mote.
2026-11-01 16:49:55 +08:00
..
test: one list of the agent folders a sandbox clears, so no sandbox misses an agent (yetone, on #522: A shared list of env vars for the other sandboxes would be a welcome follow-up) — every sandbox kept its own list of the variables that point at an agent's folder, and each had drifted: the gateway's cleared 5 of the 32 magpie reads, the provider package's 2, the tui's 10, the library's 20. A sandbox clearing 2 meets whatever Grok, Kimi, Hermes, MiniMax, Qoder or ZCode the developer has installed, which is how #522 came about — Qoder's two were in the library's list and in none of the four that failed. internal/agentenv is now the one list, and the 21 sandboxes that fake an environment with no agent in it clear it, each keeping beside it the variables that are not an agent's: APPDATA and LOCALAPPDATA, which a sandbox sets to a folder of its own rather than clearing, VISUAL and EDITOR. A name in the list is one magpie reads, and TestVarsAreRead walks the sources to say so, which is how two names a sandbox had been clearing turned out to be read by nothing at all — GEMINI_CLI_HOME and OPENCODE_CONFIG in internal/backup's, while OPENCODE_CONFIG_DIR, the one internal/agent reads (agents.go:545), was not in it. Where a sandbox set an agent's folder to a fixture of its own, the clearing now comes first, since a list of 32 wipes what a list of 5 left standing. Not converted: the omp tests' four variables, which are the ones omp's own lookup consults (a Pi fork) rather than every agent's, and the warm-up's Claude Code traffic flags, which are not folders — CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC stays out of the list for that reason too, its one test setting it on purpose. On Windows 11 the whole suite answers as it did before the change: 31 packages pass, and the same 15 tests in internal/library, internal/gateway and internal/agent fail for what they failed for before (symlinks this machine has no privilege for, and TestSuffixModesReachAgentFiles). go vet ./..., go build -tags nogui (windows, GOOS=linux, GOOS=darwin), and go vet -tags nogui for linux and darwin over every package touched pass. (#543)
2026-10-02 17:22:16 +08:00