agy-cli 0.1.86: agy starts with telemetry off (#1236)

The bridge passes --disable-telemetry when `agy acp --help` lists it, so
agy doesn't report the run to its vendor; AGY_BRIDGE_TELEMETRY=1 keeps
agy's own default. The flag is part of the spare's launch key. By
ump45nose (#896, PR #1236), landed on top of #1235 with only the version
line's conflict resolved.

The flag was checked in the agy binary on this Mac (strings:
"disable-telemetry", "--disable_telemetry").

Run (mote, HOME=$(mktemp -d)):
- At the PR head 0ead2594: bun test agy-cli.test.mjs 20 pass;
  node --test repeat-batch.mjs smoke.mjs 66 pass; check.mjs ok.
- At this tree (with #1235): bun test agy-cli.test.mjs 20 pass, 0 fail;
  repeat-batch.mjs + smoke.mjs 68 pass; check.mjs agy-cli ok.

Broken by hand: origin/main's index.mjs with the PR's tests: "#896: an agy
whose acp --help lists --disable-telemetry starts with telemetry off" and
smoke.mjs fail.

Not tried: a real agy acp run with the flag (the local agy account answers
403).

Co-authored-by: ump45nose <52391318+ump45nose@users.noreply.github.com>
This commit is contained in:
ump45nose
2026-11-17 03:36:00 +08:00
committed by yetone
parent c52dd35bfa
commit 38233a569c
6 changed files with 46 additions and 3 deletions
+1
View File
@@ -255,6 +255,7 @@ usage reads wait 10 minutes before the next try, doubling up to 6 hours.
| `AGY_BRIDGE_THINKING` | on | Set to `0` to stop forwarding thought summaries |
| `AGY_BRIDGE_EFFORT` | unset | Force a thinking level: `minimal`, `low`, `medium`, `high`, `xhigh` or `max` |
| `AGY_BRIDGE_MINIMAL_AGENT` | off | Set to `1` to drop agy's own prompt components; see "Minimal agent" below |
| `AGY_BRIDGE_TELEMETRY` | off (agy reports nothing) | The bridge starts agy with `--disable-telemetry` when agy's `acp --help` lists it; set to `1` to keep agy's own reporting |
| `AGY_BRIDGE_SYSTEM_APPEND` | off | Set to `1` to append the client's system prompt to agy's own instead of putting it in the first prompt; see below |
| `AGY_BRIDGE_IDLE_MS` | 600000 | How long a process may sit idle before it is reclaimed; the session can still resume |
| `AGY_BRIDGE_SPARE` | on | Keeps one spare agy per account, started but with no session and no request sent, so a new conversation skips agy's start; set to `0` to turn it off |
+1
View File
@@ -184,6 +184,7 @@ agy 的拒绝原因,不显示数字。
| `AGY_BRIDGE_THINKING` | 开启 | 设为 `0` 关闭思考摘要 |
| `AGY_BRIDGE_EFFORT` | 未设置 | 强制思考等级:`minimal` / `low` / `medium` / `high` / `xhigh` / `max` |
| `AGY_BRIDGE_MINIMAL_AGENT` | 关闭 | 设为 `1` 去掉 agy 自带的提示组件,见下文「精简 agent」 |
| `AGY_BRIDGE_TELEMETRY` | 关闭(agy 不上报) | 插件启动 agy 时带上 `--disable-telemetry`(agy 的 `acp --help` 没这个开关就带不上);设成 `1` 保留 agy 自己的上报 |
| `AGY_BRIDGE_SYSTEM_APPEND` | 关闭 | 设为 `1` 把客户端的系统提示词附加到 agy 自己的系统提示词后面,而不是放进第一条提示词,见下文 |
| `AGY_BRIDGE_IDLE_MS` | 600000 | 进程空闲多久后回收(会话仍可续接) |
| `AGY_BRIDGE_SPARE` | 开启 | 每个账号预先启动一个备用 agy(只启动、不建会话,不发任何请求),新对话直接用它,省掉 agy 的启动时间;设为 `0` 关闭 |
+13 -1
View File
@@ -312,6 +312,17 @@ export function noDefaultCustomizationsArgs(agyPath) {
return acpHelp(agyPath).then((help) => (/--include-default-customizations\b/.test(help) ? ["--include-default-customizations=false"] : []))
}
// agy reports the run to its vendor unless it is told not to. The bridge turns
// that off by default, as a privacy setting rather than a workaround: what the
// user types here is the client's business and agy's vendor's logs are not the
// place it lands. Passed only when `agy acp --help` lists the flag, since an
// agy without it refuses to start on it; AGY_BRIDGE_TELEMETRY=1 keeps agy's
// own default for anyone who wants the vendor's diagnostics.
export function telemetryArgs(agyPath, env = process.env) {
if (/^(?:1|true|on|yes|enabled)$/i.test(env.AGY_BRIDGE_TELEMETRY || "")) return Promise.resolve([])
return acpHelp(agyPath).then((help) => (/--disable[-_]telemetry\b/.test(help) ? ["--disable-telemetry"] : []))
}
// The bridge's own agy folder, kept across restarts so agy finds a
// conversation again on session/resume. AGY_BRIDGE_GEMINI_DIR names another;
// "default" (or 0, off, …) leaves agy on its own ~/.gemini, skills and all.
@@ -1996,6 +2007,7 @@ class Proc {
]
if (this.workDir) args.push("--add-dir", this.workDir)
args.push(...await noDefaultCustomizationsArgs(this.agyPath))
args.push(...await telemetryArgs(this.agyPath))
const own = await geminiDirArgs(this.agyPath)
args.push(...own.args)
// agy writes the conversation's steps under the folder it was given
@@ -3271,7 +3283,7 @@ async function launchKey(agyPath, workDir) {
try { mtime = (await fs.promises.stat(agyPath)).mtimeMs } catch {}
const own = await geminiDirArgs(agyPath)
return digest(JSON.stringify([currentHome(), agyPath, mtime, workDir || "",
await noDefaultCustomizationsArgs(agyPath), own.args, childEnv(process.env)]))
await noDefaultCustomizationsArgs(agyPath), await telemetryArgs(agyPath), own.args, childEnv(process.env)]))
}
function dropSpare(spare) {
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@magpie-community/opencode-agy-cli-auth",
"version": "0.1.85",
"version": "0.1.86",
"description": "Magpie/OpenCode model provider that connects your local agy CLI through the Agent Client Protocol (agy acp), so Antigravity subscription models run through the real CLI",
"type": "module",
"main": "./opencode.mjs",
+27
View File
@@ -904,6 +904,33 @@ test("A16: under a tight budget, a mid-loop user steer beats an opening meta com
})
})
// #896: agy reports the run to its vendor unless it is told not to; the flag
// is passed only to an agy whose own acp --help lists it.
const TELEMETRY_HELP = "Usage of acp:\n --disable-telemetry\n \tdisable telemetry (default false)\n"
test("#896: an agy whose acp --help lists --disable-telemetry starts with telemetry off", async () => {
await withKit({ acpHelp: TELEMETRY_HELP }, async (kit) => {
scriptedAgent(kit)
const reply = await readSse(await kit.request(baseBody({ metadata: { user_id: "telemetry-listed" },
messages: [{ role: "user", content: "hello" }] })))
assert.equal(reply.stopReason, "end_turn")
assert.equal(kit.acpSpawns.length, 1)
assert.ok(kit.acpSpawns[0].args.includes("--disable-telemetry"), kit.acpSpawns[0].args.join(" "))
})
})
test("#896: an agy without the flag is never given it, and AGY_BRIDGE_TELEMETRY=1 keeps agy's own default", async () => {
for (const options of [{}, { acpHelp: TELEMETRY_HELP, env: { AGY_BRIDGE_TELEMETRY: "1" } }]) {
await withKit(options, async (kit) => {
scriptedAgent(kit)
const reply = await readSse(await kit.request(baseBody({ metadata: { user_id: "telemetry-unlisted" },
messages: [{ role: "user", content: "hello" }] })))
assert.equal(reply.stopReason, "end_turn")
assert.ok(!kit.acpSpawns[0].args.includes("--disable-telemetry"), kit.acpSpawns[0].args.join(" "))
})
}
})
// ----------------------------------------------- agy's error marker (#1052)
function markerAgent(kit, chunks) {
+3 -1
View File
@@ -110,7 +110,7 @@ if (argv.includes("models")) {
}
if (argv[0] === "acp" && argv.includes("--help")) {
log({ type: "acpHelp" })
process.stderr.write("Usage of acp:\n --agent string\n --include-default-customizations\n \tload the default customizations (default true)\n")
process.stderr.write("Usage of acp:\n --agent string\n --include-default-customizations\n \tload the default customizations (default true)\n --disable-telemetry\n \tdisable telemetry (default false)\n")
process.exit(0)
}
if (argv[0] !== "acp") {
@@ -3084,6 +3084,8 @@ for (const location of ["inline", "system", "developer", "user"]) {
const sessions = inits().filter(event => event.args.includes("--agent"))
const without = sessions.filter(event => !event.args.includes("--include-default-customizations=false"))
check("an agy whose acp --help lists it starts without the machine's own customizations (#1166)", sessions.length > 0 && without.length === 0, JSON.stringify(without.map(event => event.args)))
const talkative = sessions.filter(event => !event.args.includes("--disable-telemetry"))
check("an agy whose acp --help lists it starts with telemetry off (#896)", sessions.length > 0 && talkative.length === 0, JSON.stringify(talkative.map(event => event.args)))
}
check("all ACP children disable auto update when the user set nothing", inits().length > 0 && inits().every(event => event.update === "true"))
check("child launches never mutate the parent's update setting", process.env.AGY_CLI_DISABLE_AUTO_UPDATE === undefined)