Include the legacy token regression and SDK registry update

# Conflicts:
#	packages/paperclip-runner/runner/crates/runner-core/src/acpx_sidecar_transport.rs
#	packages/paperclip-runner/runner/crates/runner-core/src/credential_observer.rs
#	packages/paperclip-runner/runner/crates/runner-core/src/tests/credential_observer.rs
This commit is contained in:
Nicky Leach committed 2026-12-01 10:49:38 -08:00
commit 60e46ebe1c
5 files changed
+46 -7

No files matched your search

@@ -408,7 +408,10 @@ impl AcpxSidecarTransport {
"OPENAI_API_KEY",
"CODEX_API_KEY",
],
"antigravity" => &["PAPERCLIP_ACPX_ANTIGRAVITY_AUTH_JSON_SECRET", "GEMINI_API_KEY"],
"antigravity" => &[
"PAPERCLIP_ACPX_ANTIGRAVITY_AUTH_JSON_SECRET",
"GEMINI_API_KEY",
],
"grok" => &["PAPERCLIP_ACPX_GROK_AUTH_JSON_SECRET", "XAI_API_KEY"],
_ => {
return Err(LocalRunnerError::invalid(
@@ -272,7 +272,13 @@ impl CredentialObserver {
let snapshot = seed
.as_ref()
.and_then(|bytes| parse_snapshot(name, bytes))
.or_else(|| read_snapshot(name, &path));
.or_else(|| {
if name == "antigravity" {
None
} else {
read_snapshot(name, &path)
}
});
if let Some(bytes) = seed.as_mut() {
bytes.fill(0);
}
@@ -623,9 +629,8 @@ fn acpx_session_directory(session: &str) -> String {
fn antigravity_refresh_token(value: &Value) -> Option<&str> {
value
.get("token")
.unwrap_or(value)
.get("refresh_token")?
.get("refresh_token")
.or_else(|| value.get("token")?.get("refresh_token"))?
.as_str()
.filter(|token| {
!token.is_empty() && token.len() <= 16384 && !token.bytes().any(|b| b <= 32 || b == 127)
@@ -624,7 +624,11 @@ fn antigravity_reports_only_refresh_rotation_for_both_native_formats() {
fs::create_dir_all(path.parent().unwrap()).unwrap();
let write = |refresh: &str, access: &str| {
let token = json!({"refresh_token":refresh,"access_token":access});
let payload = if cli { json!({"token":token}) } else { token };
let payload = if cli {
json!({"token":token})
} else {
json!({"refresh_token":refresh,"token":access})
};
fs::write(&path, serde_json::to_vec(&payload).unwrap()).unwrap();
fs::set_permissions(&path, fs::Permissions::from_mode(0o600)).unwrap();
};
@@ -1518,6 +1518,33 @@ describe("ACPX runtime host", () => {
expect(fixture.commandClose).toHaveBeenCalledOnce();
});
it("seeds Antigravity from its private host file and keeps both the secret and source path out of the harness environment", async () => {
const fixture = await hostFixture();
const source = join(fixture.root, "host-auth.json");
const credential = {
client_id: "1071006060591-tmhssin2h21lcre235vtolojh4g403ep.apps.googleusercontent.com",
client_secret: "fixture-client", refresh_token: "fixture-refresh", token_uri: "https://oauth2.googleapis.com/token",
scopes: ["https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/userinfo.email", "https://www.googleapis.com/auth/aicode"],
};
await writeFile(source, JSON.stringify(credential), { mode: 0o600 });
const openRuntime = vi.fn(async (options: Parameters<AcpxRuntimeHostDependencies["openRuntime"]>[0]) => {
const home = options.launchEnvironment.GEMINI_HOME!;
const unified = options.launchEnvironment.AGY_CLI_FORCE_FILE_TOKEN_STORAGE === "1";
const file = unified ? join(home, "antigravity-cli", "antigravity-oauth-token") : join(home, "antigravity-acp", "acp_token.json");
const saved = JSON.parse(await readFile(file, "utf8"));
expect((unified ? saved.token : saved).refresh_token).toBe(credential.refresh_token);
expect((await stat(file)).mode & 0o777).toBe(0o600);
expect(JSON.stringify(options.launchEnvironment)).not.toContain(source);
expect(JSON.stringify(options.launchEnvironment)).not.toContain(credential.refresh_token);
throw new Error("fixture finished");
});
await expect(AcpxRuntimeHost.open({ ...fixture.options, agent: "antigravity", model: "gemini-3.8-flash-low",
permissionMode: "approve-all", providerPolicy: { readOnly: false },
environment: { PAPERCLIP_ACPX_AUTH_JSON_FILE: source }, managedCredentialSourcePath: source,
}, fixture.dependencies({ openRuntime }))).rejects.toThrow("fixture finished");
expect(openRuntime).toHaveBeenCalledOnce();
});
const hostCredentialFiles = {
codex: { model: "gpt-5.6-sol", permissionMode: "approve-all" as const, home: "CODEX_HOME",
document: JSON.stringify({ tokens: { account_id: "account-1", access_token: "host-access", refresh_token: "host-refresh" }, last_refresh: "2026-01-01T00:00:00Z" }),
@@ -13,7 +13,7 @@
"packages/plugins/sdk/src/environment-stop-error.ts": "b0e03f8aa2b2170ba095da5c7138050fced3f3cb",
"packages/plugins/sdk/src/environment-sync-error.ts": "7d6a51a95da49a7da4525aebbab6382dc5c44ae8",
"packages/plugins/sdk/src/environment-task-error.ts": "98aae8a06743b38884b68cb9a3ec44c57b34c0e4",
"packages/plugins/sdk/src/environment-tasks.ts": "d8ff7e00e98c02e671fe60fb7f7eda887a34371b",
"packages/plugins/sdk/src/environment-tasks.ts": "19aab0dfc57564809326459b5a8b74a4f6545e78",
"packages/plugins/sdk/src/host-client-factory.ts": "8f76d518b4b43a41436b516cb2929165611bd483",
"packages/plugins/sdk/src/idle-drain.test.ts": "cc59f7881e7d46c89395a1d93d74f6c6b9b0a64a",
"packages/plugins/sdk/src/idle-drain.ts": "ae6e4c6be4657a3d541396922b3bc551b8db557f",