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.
This commit is contained in:
yetone
2026-11-19 15:44:35 +08:00
parent 6af38c0eeb
commit f63549b5ca
2 changed files with 14 additions and 0 deletions
+1
View File
@@ -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,
+13
View File
@@ -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)
}
}
}