Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(antigravity): accept null plugin preference fields in config.json #44785

Openfcakyon(GitHub profile, opens in a new tab)wants to merge 2 commits intomain fromrefs/pull/44785/headopened View on GitHub

fcakyon(GitHub profile, opens in a new tab)commented

Problem

agy decodes <profile>/config/config.json with Go JSON semantics, so "plugins": null and per-plugin "enabled": null are valid and leave defaults intact while still honoring "enabled": false on sibling plugins.

On main, decodePluginPreferences rejects null on plugins and enabled, causing discoverAntigravitySkills to discard the whole preferences object and expose disabled plugins' skills in the $ picker even though agy never loads them. To reproduce, put plugins ok and off in <profile>/config/plugins and write {"plugins":{"ok":{"enabled":null},"off":{"enabled":false}}} to <profile>/config/config.json: agy advertises only ok, while main lists both off and ok.

Change

  • Accept Schema.NullOr on plugins and enabled in decodePluginPreferences (matching agy and #40287's nullable list handling for skills.json).
  • Rely on Node FileSystem.readFileString, which already strips a leading UTF-8 BOM from config.json, instead of a manual \uFEFF strip in decodePluginPreferences (the BOM fixtures are covered by the regression test).
  • Preserve agy 1.5.18's fail-open behavior for null plugin entries ("other": null), non-boolean "enabled", and malformed JSON instead of adding divergence.

Scope

Small, obvious bug fix needing no issue. Touches only apps/server/src/provider/Drivers/AntigravitySkills.ts and apps/server/src/provider/Drivers/AntigravitySkills.test.ts, with no contract, client, or docs changes. Follows #38960, #40287, and #43588, and is independent of #39082.

Verification

Against live agy 1.5.18 and upstream/main (13cda455bd). Each fixture ran in an isolated temporary HOME, profile, and workspace on Linux with a dummy GEMINI_API_KEY. discoverAntigravitySkills ran before spawning agy because agy normalizes config.json on startup, and after session/new, available_commands_update was read from agy (no model turn sent).

config.json fixtureLive agy 1.5.18upstream/main (13cda455bd)This branch (ac391a34a0)
{ plugins: { off: { enabled: false } } }["ok"]["ok"]["ok"]
\uFEFF + { plugins: { off: { enabled: false } } }["ok"]["ok"]["ok"]
{ plugins: { ok: { enabled: null }, off: { enabled: false } } }["ok"]["off", "ok"]["ok"]
\uFEFF + { plugins: { ok: { enabled: null }, off: { enabled: false } } }["ok"]["off", "ok"]["ok"]
{ plugins: { other: {}, off: { enabled: false } } }["ok"]["ok"]["ok"]
{ plugins: null }["off", "ok"]["off", "ok"]["off", "ok"]
{ plugins: { other: null, off: { enabled: false } } } (control)["off", "ok"]["off", "ok"]["off", "ok"]
{ plugins: { bad: { enabled: "no" }, off: { enabled: false } } } (control)["off", "ok"]["off", "ok"]["off", "ok"]
{broken (control)["off", "ok"]["off", "ok"]["off", "ok"]

Regression check. Running the new test case parses plugin preferences with a UTF-8 BOM and null enabled fields against upstream/main's AntigravitySkills.ts fails at the "enabled": null check:

AssertionError: expected [ 'off', 'ok' ] to deeply equal [ 'ok' ]
 ❯ src/provider/Drivers/AntigravitySkills.repro.test.ts:211:14

Checks on head 1c63154efe (rebased onto upstream/main 3fa429150c):

  • vp test run apps/server/src/provider/Drivers/AntigravitySkills.test.ts: 18 passed (18).
  • vp run check:changed upstream/main: all stages passed (format, lint, knip, graphql, typecheck 3 packages, test 2 files / 20 tests: AntigravitySkills.test.ts 18, AgentContextBudget.test.ts 2).

Not checked:

  • No live model prompt turn was sent (ACP probe used a dummy API key and inspected available_commands_update only).
  • Verified on Linux only. Windows and macOS were not run.
  • Desktop and mobile UIs were not launched manually (they render the same server-provided skill list).
Reproduction script and output

Run from apps/server after copying git show upstream/main:apps/server/src/provider/Drivers/AntigravitySkills.ts > src/provider/Drivers/repro-main-skills.ts (delete repro-main-skills.ts afterwards):

node --input-type=module <<'JS'
import { spawn } from "node:child_process";
import { mkdtempSync, mkdirSync, rmSync, writeFileSync } from "node:fs";
import { tmpdir } from "node:os";
import { dirname, join } from "node:path";
import * as NodeServices from "@effect/platform-node/NodeServices";
import * as Effect from "effect/Effect";

const mainMod = await import("./src/provider/Drivers/repro-main-skills.ts");
const branchMod = await import("./src/provider/Drivers/AntigravitySkills.ts");

const write = (file, text) => {
  mkdirSync(dirname(file), { recursive: true });
  writeFileSync(file, text);
};

async function runAgy(profile, cwd, home) {
  const child = spawn(
    process.env.AGY_BIN ?? "agy",
    ["acp", "--gemini-dir", profile, "--app-data-dir", "antigravity-acp", "--disable-telemetry"],
    {
      cwd,
      env: { PATH: process.env.PATH, HOME: home, GEMINI_API_KEY: "AIzaSyDummyKeyForSessionNewProbeOnly0000" },
      stdio: ["pipe", "pipe", "ignore"],
    },
  );
  let nextId = 0;
  const pending = new Map();
  const commands = new Set();
  let buf = "";
  child.stdout.on("data", (chunk) => {
    buf += chunk.toString("utf8");
    let nl;
    while ((nl = buf.indexOf("\n")) !== -1) {
      const line = buf.slice(0, nl);
      buf = buf.slice(nl + 1);
      if (!line.startsWith("{")) continue;
      const msg = JSON.parse(line);
      if (msg.id !== undefined && pending.has(msg.id)) {
        pending.get(msg.id)(msg);
        pending.delete(msg.id);
      } else if (msg.params?.update?.sessionUpdate === "available_commands_update") {
        for (const cmd of msg.params.update.availableCommands) commands.add(cmd.name);
      }
    }
  });
  const req = (method, params) =>
    new Promise((resolve, reject) => {
      const id = ++nextId;
      const timer = setTimeout(() => reject(new Error(`${method} timeout`)), 20_000);
      pending.set(id, (msg) => {
        clearTimeout(timer);
        resolve(msg);
      });
      child.stdin.write(`${JSON.stringify({ jsonrpc: "2.0", id, method, params })}\n`);
    });
  try {
    const init = await req("initialize", {
      protocolVersion: 1,
      clientCapabilities: { fs: { readTextFile: false, writeTextFile: false }, terminal: false },
    });
    await req("authenticate", { methodId: "gemini-api-key" });
    await req("session/new", { cwd, mcpServers: [] });
    await new Promise((r) => setTimeout(r, 1200));
    const version = init.result?.agentInfo?.version ?? "unknown";
    const skills = [...commands].filter((n) => n === "ok" || n === "off").toSorted();
    return { version, skills };
  } finally {
    child.kill();
    await new Promise((r) => child.once("close", r));
  }
}

const fixtures = [
  ["1. baseline {off:false}", JSON.stringify({ plugins: { off: { enabled: false } } })],
  ["2. BOM + {off:false}", `\uFEFF${JSON.stringify({ plugins: { off: { enabled: false } } })}`],
  ["3. {ok:{enabled:null}, off:false}", JSON.stringify({ plugins: { ok: { enabled: null }, off: { enabled: false } } })],
  ["4. BOM + {ok:{enabled:null}, off:false}", `\uFEFF${JSON.stringify({ plugins: { ok: { enabled: null }, off: { enabled: false } } })}`],
  ["5. {other:{}, off:false}", JSON.stringify({ plugins: { other: {}, off: { enabled: false } } })],
  ["6. {plugins:null}", JSON.stringify({ plugins: null })],
  ["7. {other:null, off:false}", JSON.stringify({ plugins: { other: null, off: { enabled: false } } })],
  ["8. {bad:{enabled:'no'}, off:false}", JSON.stringify({ plugins: { bad: { enabled: "no" }, off: { enabled: false } } })],
  ["9. malformed {broken", "{broken"],
];

for (const [label, configText] of fixtures) {
  const root = mkdtempSync(join(tmpdir(), "t3-44785-repro-"));
  const home = join(root, "home");
  const profile = join(root, "profile");
  const cwd = join(root, "workspace");
  mkdirSync(home, { recursive: true });
  mkdirSync(profile, { recursive: true });
  mkdirSync(cwd, { recursive: true });
  try {
    for (const plugin of ["ok", "off"]) {
      write(join(profile, "config", "plugins", plugin, "skills", plugin, "SKILL.md"), `---\nname: ${plugin}\ndescription: ${plugin}\n---\n`);
      write(join(profile, "config", "plugins", plugin, "plugin.json"), JSON.stringify({ name: plugin }));
    }
    write(join(profile, "config", "config.json"), configText);
    const runDisc = (mod) =>
      Effect.runPromise(
        mod.discoverAntigravitySkills({ cwd, userHome: home, profileDirectory: profile }).pipe(
          Effect.map((skills) => skills.map((s) => s.name)),
          Effect.provide(NodeServices.layer),
        ),
      );
    const before = await runDisc(mainMod);
    const after = await runDisc(branchMod);
    const agyRes = await runAgy(profile, cwd, home);
    console.log(`${label} | agy ${agyRes.version}: ${JSON.stringify(agyRes.skills)} | main: ${JSON.stringify(before)} | branch: ${JSON.stringify(after)}`);
  } finally {
    rmSync(root, { recursive: true, force: true });
  }
}
JS
1. baseline {off:false} | agy 1.5.18: ["ok"] | main: ["ok"] | branch: ["ok"]
2. BOM + {off:false} | agy 1.5.18: ["ok"] | main: ["ok"] | branch: ["ok"]
3. {ok:{enabled:null}, off:false} | agy 1.5.18: ["ok"] | main: ["off","ok"] | branch: ["ok"]
4. BOM + {ok:{enabled:null}, off:false} | agy 1.5.18: ["ok"] | main: ["off","ok"] | branch: ["ok"]
5. {other:{}, off:false} | agy 1.5.18: ["ok"] | main: ["ok"] | branch: ["ok"]
6. {plugins:null} | agy 1.5.18: ["off","ok"] | main: ["off","ok"] | branch: ["off","ok"]
7. {other:null, off:false} | agy 1.5.18: ["off","ok"] | main: ["off","ok"] | branch: ["off","ok"]
8. {bad:{enabled:'no'}, off:false} | agy 1.5.18: ["off","ok"] | main: ["off","ok"] | branch: ["off","ok"]
9. malformed {broken | agy 1.5.18: ["off","ok"] | main: ["off","ok"] | branch: ["off","ok"]

Model: GPT-6.2 Astra (Codex), Gemini 4 Neon (Antigravity), and GPT-6.2 Sol (Codex)

    1. Pushede9b2869

    2. Pushedf56ba2f

    3. Pushed3580d0f

    4. Pushed1c63154

Sign in to join this conversation.