From f63549b5cab22ed5c63d5c6abaf68dcc8e4f7384 Mon Sep 17 00:00:00 2001 From: yetone Date: Thu, 19 Nov 2026 15:32:17 +0800 Subject: [PATCH] agentenv: an address variable is not a folder (AGY_LLM_GATEWAY_URL) Every name in agentenv.Vars that isn't in NotPaths is taken for a folder, and appdir passes over one that isn't an absolute path. So AGY_LLM_GATEWAY_URL=http://... had magpie print "ignoring AGY_LLM_GATEWAY_URL: not an absolute path" at every start. Found while pointing a sandbox magpie at a sandbox Nowledge Mem through NMEM_API_URL, which magpie dropped the same way. TestAddressesAreNotPaths fails when a Vars name ending in _URL or _ADDR is not in NotPaths. Run (mote): go test -count=1 ./internal/agentenv ./internal/appdir ok. Broken by hand: without the NotPaths entry, TestAddressesAreNotPaths is red on AGY_LLM_GATEWAY_URL. Not tried: a real Antigravity started with AGY_LLM_GATEWAY_URL set. --- internal/agentenv/agentenv.go | 1 + internal/agentenv/agentenv_test.go | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/internal/agentenv/agentenv.go b/internal/agentenv/agentenv.go index 6ed34c97c..2cfda982a 100644 --- a/internal/agentenv/agentenv.go +++ b/internal/agentenv/agentenv.go @@ -170,6 +170,7 @@ var Vars = []string{ var NotPaths = map[string]bool{ "PI_PROFILE": true, "OMP_PROFILE": true, "WINDSURF_API_SERVER_URL": true, "ZCODE_CREDENTIAL_SECRET": true, + "AGY_LLM_GATEWAY_URL": true, "PI_CONFIG_DIR": true, "OPENCODE_DB": true, "STEPCODE_CONFIG_DIR": true, "MAGPIE_ZED_BIN": true, "MAGPIE_ZED_PROCESS_NAMES": true, diff --git a/internal/agentenv/agentenv_test.go b/internal/agentenv/agentenv_test.go index 9c41389bb..ff7e6ad7d 100644 --- a/internal/agentenv/agentenv_test.go +++ b/internal/agentenv/agentenv_test.go @@ -65,3 +65,16 @@ func TestVarsAreApart(t *testing.T) { seen[v] = true } } + +// A variable that holds an address is in NotPaths. Every other one is +// taken for a folder, which magpie passes over when it isn't an absolute +// path: AGY_LLM_GATEWAY_URL=http://… had magpie print "ignoring +// AGY_LLM_GATEWAY_URL: not an absolute path" at every start, and +// appdir.Getenv read it as unset. +func TestAddressesAreNotPaths(t *testing.T) { + for _, v := range Vars { + if (strings.HasSuffix(v, "_URL") || strings.HasSuffix(v, "_ADDR")) && !NotPaths[v] { + t.Errorf("%s holds an address, but it isn't in NotPaths", v) + } + } +}