From ca313c9d8fd314f087acaaea98639782d2d86afb Mon Sep 17 00:00:00 2001 From: "swu-rob[bot]" <344781992+swu-rob[bot]@users.noreply.github.com> Date: Thu, 3 Dec 2026 02:06:56 +0000 Subject: [PATCH 1/6] Pin the status-line token under ANTIGRAVITY_STATUSLINE_INGEST_TOKEN in the plist template (UM-1508) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The session collector resolves only ANTIGRAVITY_STATUSLINE_INGEST_TOKEN then USAGE_INGEST_TOKEN; it never reads ANTIGRAVITY_INGEST_TOKEN, which is scoped to the antigravity-cli producer.  The checked-in com.jays.antigravity-session-collector plist template pinned no token name at all, and the 2026-09-24 rollout doc still described the live plist's old-name pin as one pre-change code reads.  The template now pins the token under ANTIGRAVITY_STATUSLINE_INGEST_TOKEN, the rollout doc states the live Mac plist entry must be renamed to that name before USAGE_INGEST_REQUIRE_SCOPED_TOKENS=true is set, and a regression test guards the template against the old name. --- docs/rollouts/2026-09-24-ingest-token-scoping.md | 4 ++-- scripts/__tests__/fleet-usage-collector-tokens.test.mjs | 8 ++++++++ .../com.jays.antigravity-session-collector.plist.example | 5 +++++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/docs/rollouts/2026-09-24-ingest-token-scoping.md b/docs/rollouts/2026-09-24-ingest-token-scoping.md index 408576fe3..b35637a49 100644 --- a/docs/rollouts/2026-09-24-ingest-token-scoping.md +++ b/docs/rollouts/2026-09-24-ingest-token-scoping.md @@ -40,7 +40,7 @@ Live producers are the `sourceApp` values the production database received in th | `minimax-code` | Quota collector's MiniMax batch (and on-demand `minimax-usage-collector.mjs`) | `MINIMAX_INGEST_TOKEN` in `~/.secrets/global-api-keys` | Shared | | `deepseek-dsh` | On-demand `deepseek-usage-collector.mjs` | `DEEPSEEK_INGEST_TOKEN` in `~/.secrets/global-api-keys` | Shared | | `antigravity-cli` | `com.jays.antigravity-usage-collector` | `ANTIGRAVITY_INGEST_TOKEN` in `~/.secrets/global-api-keys` | Already scoped | -| `antigravity-statusline` | `com.jays.antigravity-session-collector` | `ANTIGRAVITY_STATUSLINE_INGEST_TOKEN` in `~/.secrets/global-api-keys` (the plist also pins it under the older `ANTIGRAVITY_INGEST_TOKEN` name, which pre-change code reads) | Scoped by board row `078333b0` | +| `antigravity-statusline` | `com.jays.antigravity-session-collector` | `ANTIGRAVITY_STATUSLINE_INGEST_TOKEN` in `~/.secrets/global-api-keys` (the live plist still pins the same value under the older `ANTIGRAVITY_INGEST_TOKEN` name, which current code never reads — the plist entry must be renamed to `ANTIGRAVITY_STATUSLINE_INGEST_TOKEN` before `USAGE_INGEST_REQUIRE_SCOPED_TOKENS=true` is set, or this collector silently loses its token; UM-1508) | Scoped by board row `078333b0` | | `mac-host` | `com.jays.mac-server-watchdog` heartbeat | `MAC_HEARTBEAT_INGEST_TOKEN` in `~/.secrets/global-api-keys` | Shared | | `codecaps` | CodeCaps menu bar app (Mac) | macOS Keychain, entered in the app's settings | Shared (owner must paste) | | `botfleet` | BotFleet harness on the Mac | `~/.botfleet/config.json` `usage.ingestToken` and BotFleet Infisical `USAGE_MONITOR_INGEST_TOKEN` | Shared | @@ -77,6 +77,6 @@ Not done, so `USAGE_INGEST_REQUIRE_SCOPED_TOKENS` stays unset (off): - The Mac LaunchAgents run scripts from `~/Code/Usage-Monitor`, which still has pre-#1533 code. The quota collector and heartbeat watchdog only pick up their scoped names once that checkout reaches `main`. - Running Claude Code sessions keep the old metrics header until they restart; their OTLP exports get `401` until then. -To finish: after the items above, set `USAGE_INGEST_REQUIRE_SCOPED_TOKENS=true` in Usage Monitor Infisical, restart the container, and prove that an unscoped token gets `401` while each producer keeps landing. +To finish: after the items above, rename the `ANTIGRAVITY_INGEST_TOKEN` entry in the live `com.jays.antigravity-session-collector` plist on the Mac to `ANTIGRAVITY_STATUSLINE_INGEST_TOKEN` (the only plist-pinned name the collector reads; UM-1508), then set `USAGE_INGEST_REQUIRE_SCOPED_TOKENS=true` in Usage Monitor Infisical, restart the container, and prove that an unscoped token gets `401` while each producer keeps landing. Side effects of verification: two synthetic production rows were written by probes and left in place for the owner to decide on. One is a heartbeat row `342d8fbe-c18a-4730-ae93-5127d8f3c73e` (superseded by the next real heartbeat). The other is a `scope-probe-other` / `scope-probe` usage row `6785e638-c611-4586-9881-a36418413d1c` (quantity 1, no cost). diff --git a/scripts/__tests__/fleet-usage-collector-tokens.test.mjs b/scripts/__tests__/fleet-usage-collector-tokens.test.mjs index d3d7bc2eb..03b681be4 100644 --- a/scripts/__tests__/fleet-usage-collector-tokens.test.mjs +++ b/scripts/__tests__/fleet-usage-collector-tokens.test.mjs @@ -1,3 +1,5 @@ +import { readFileSync } from "node:fs"; + import { describe, expect, it } from "vitest"; import { STATUSLINE_TOKEN_ENV_NAMES } from "../antigravity-session-collector.mjs"; @@ -41,6 +43,12 @@ describe("fleet collector scoped tokens", () => { expect(new Set(first).size).toBe(producers.length); }); + it("pins the status-line token in the checked-in plist template under the name the collector reads", () => { + const plist = readFileSync(new URL("../com.jays.antigravity-session-collector.plist.example", import.meta.url), "utf8"); + expect(plist).toContain("ANTIGRAVITY_STATUSLINE_INGEST_TOKEN"); + expect(plist).not.toContain("ANTIGRAVITY_INGEST_TOKEN"); + }); + it("never offers the antigravity-cli token to the status-line collector", () => { expect(STATUSLINE_TOKEN_ENV_NAMES).toEqual(["ANTIGRAVITY_STATUSLINE_INGEST_TOKEN", "USAGE_INGEST_TOKEN"]); expect(fleetTokenEnvNames("antigravity-statusline")).not.toContain("ANTIGRAVITY_INGEST_TOKEN"); diff --git a/scripts/com.jays.antigravity-session-collector.plist.example b/scripts/com.jays.antigravity-session-collector.plist.example index 948091171..42a6519ed 100644 --- a/scripts/com.jays.antigravity-session-collector.plist.example +++ b/scripts/com.jays.antigravity-session-collector.plist.example @@ -9,6 +9,11 @@ /opt/homebrew/bin/node /ABSOLUTE/PATH/TO/Usage-Monitor/scripts/antigravity-session-collector.mjs + EnvironmentVariables + + ANTIGRAVITY_STATUSLINE_INGEST_TOKEN + REPLACE_WITH_SCOPED_STATUSLINE_TOKEN + RunAtLoad StartInterval From d125b163bc8e38f828a337e24adfd2d2ef15bc99 Mon Sep 17 00:00:00 2001 From: "swu-rob[bot]" <344781992+swu-rob[bot]@users.noreply.github.com> Date: Fri, 4 Dec 2026 08:25:33 +0000 Subject: [PATCH 2/6] [ROB] Ship the status-line token key empty so the resolver falls through (UM-1508) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The placeholder value REPLACE_WITH_SCOPED_STATUSLINE_TOKEN was returned as a real token by the scoped resolver, bypassing the store and USAGE_INGEST_TOKEN fallback.  An empty string falls through, per the Kody high-severity finding on PR #2121. --- scripts/com.jays.antigravity-session-collector.plist.example | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/com.jays.antigravity-session-collector.plist.example b/scripts/com.jays.antigravity-session-collector.plist.example index 42a6519ed..793a94edd 100644 --- a/scripts/com.jays.antigravity-session-collector.plist.example +++ b/scripts/com.jays.antigravity-session-collector.plist.example @@ -1,4 +1,4 @@ - +xion="1.0" encoding="UTF-8"?> From dc7c5ba2566ab3279274f170e1acdb4d4f2fefd1 Mon Sep 17 00:00:00 2001 From: "swu-rob[bot]" <344781992+swu-rob[bot]@users.noreply.github.com> Date: Fri, 4 Dec 2026 08:26:32 +0000 Subject: [PATCH 3/6] [ROB] Restore plist header corrupted by a probe edit (UM-1508) --- scripts/com.jays.antigravity-session-collector.plist.example | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/com.jays.antigravity-session-collector.plist.example b/scripts/com.jays.antigravity-session-collector.plist.example index 793a94edd..42a6519ed 100644 --- a/scripts/com.jays.antigravity-session-collector.plist.example +++ b/scripts/com.jays.antigravity-session-collector.plist.example @@ -1,4 +1,4 @@ -xion="1.0" encoding="UTF-8"?> + From 2ddcbe4967468b78fd615f7763f3cc416d59b1e9 Mon Sep 17 00:00:00 2001 From: "swu-rob[bot]" <344781992+swu-rob[bot]@users.noreply.github.com> Date: Fri, 4 Dec 2026 08:27:00 +0000 Subject: [PATCH 4/6] [ROB] Ship the status-line token key empty so the resolver falls through (UM-1508) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The placeholder REPLACE_WITH_SCOPED_STATUSLINE_TOKEN was returned as a real token by the scoped resolver, bypassing the store and the USAGE_INGEST_TOKEN fallback.  An empty string falls through, per the Kody high-severity finding on PR #2121. --- scripts/com.jays.antigravity-session-collector.plist.example | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/com.jays.antigravity-session-collector.plist.example b/scripts/com.jays.antigravity-session-collector.plist.example index 42a6519ed..2ed0213c6 100644 --- a/scripts/com.jays.antigravity-session-collector.plist.example +++ b/scripts/com.jays.antigravity-session-collector.plist.example @@ -12,7 +12,7 @@ EnvironmentVariables ANTIGRAVITY_STATUSLINE_INGEST_TOKEN - REPLACE_WITH_SCOPED_STATUSLINE_TOKEN + RunAtLoad From 90c3fa4d4c55558b69abd74faeed095c7a2a2d5a Mon Sep 17 00:00:00 2001 From: "swu-rob[bot]" <344781992+swu-rob[bot]@users.noreply.github.com> Date: Fri, 4 Dec 2026 08:27:35 +0000 Subject: [PATCH 5/6] [ROB] Forbid the placeholder token value in the plist template test (UM-1508) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The new guard only asserted the key name, so it blessed the literal placeholder value.  It now also asserts the placeholder is absent and the shipped value is empty. --- scripts/__tests__/fleet-usage-collector-tokens.test.mjs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/__tests__/fleet-usage-collector-tokens.test.mjs b/scripts/__tests__/fleet-usage-collector-tokens.test.mjs index 03b681be4..6f2a40076 100644 --- a/scripts/__tests__/fleet-usage-collector-tokens.test.mjs +++ b/scripts/__tests__/fleet-usage-collector-tokens.test.mjs @@ -47,6 +47,8 @@ describe("fleet collector scoped tokens", () => { const plist = readFileSync(new URL("../com.jays.antigravity-session-collector.plist.example", import.meta.url), "utf8"); expect(plist).toContain("ANTIGRAVITY_STATUSLINE_INGEST_TOKEN"); expect(plist).not.toContain("ANTIGRAVITY_INGEST_TOKEN"); + expect(plist).not.toContain("REPLACE_WITH_SCOPED_STATUSLINE_TOKEN"); + expect(plist).toContain(""); }); it("never offers the antigravity-cli token to the status-line collector", () => { From a2313090d6a1cfb62b209797bc8e6d4217e4516e Mon Sep 17 00:00:00 2001 From: "swu-rob[bot]" <344781992+swu-rob[bot]@users.noreply.github.com> Date: Fri, 4 Dec 2026 08:28:15 +0000 Subject: [PATCH 6/6] [ROB] Collect the fleet collector token suite in the collectors runner (UM-1508) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit scripts/__tests__/fleet-usage-collector-tokens.test.mjs was in no runner include list, so its guards never ran.  Adding it to scripts/vitest.collectors.config.mjs, per the Kody medium finding on PR #2121. --- scripts/vitest.collectors.config.mjs | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/vitest.collectors.config.mjs b/scripts/vitest.collectors.config.mjs index 30e790679..c0483c72b 100644 --- a/scripts/vitest.collectors.config.mjs +++ b/scripts/vitest.collectors.config.mjs @@ -6,6 +6,7 @@ const config = { "scripts/__tests__/muse-code-usage-collector.test.mjs", "scripts/__tests__/resolve-collector-token.test.mjs", "scripts/__tests__/transfer-muse-code-access-token-to-infisical.test.mjs", + "scripts/__tests__/fleet-usage-collector-tokens.test.mjs", ], }, };