Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

fix(acp): say why an engine exited, with its last output masked

milind-soni30af9c93ba97
diff --git a/server/drivers/acp/acp.test.ts b/server/drivers/acp/acp.test.ts
index a2dd491811..27bad245fc 100644
--- a/server/drivers/acp/acp.test.ts
+++ b/server/drivers/acp/acp.test.ts
@@ -2076,6 +2076,15 @@ describe("ACP turns (fake CLI)", () => {
expect(recorder.events.some((e) => e.type === "runtime.error")).toBe(true);
});
+ it("an engine that aborts says so in plain words, with its last output masked", async () => {
+ await create(GrokAgentDriver, "abort-in-prompt");
+ await instance.adapter.sendTurn({ threadId: "t-abort", text: "go" });
+ const failed = await recorder.until((e) => e.type === "runtime.error") as { message: string };
+ expect(failed.message).toMatch(/ exited 134 before the prompt result: it stopped itself \(abort\)\. Last output: Open https:\/\/accounts\.google\.com\/o\/oauth2\/v2\/auth\?«redacted \d+ chars» \| 2 third_party\/tcmalloc\/internal\/sysinfo\.h:76\] CHECK in NumCPUs: maybe_cpus\.has_value\(\) \(false\)$/u);
+ for (const secret of ["private-state", "private-code-value"]) expect(failed.message).not.toContain(secret);
+ expect(await recorder.until((e) => e.type === "turn.completed")).toMatchObject({ ok: false });
+ });
+
it("does not expire an agent while a person is answering an approval", async () => {
process.env.OPENMAUS_ACP_PROMPT_IDLE_TIMEOUT_MS = "150";
await create(GrokAgentDriver, "permission");
diff --git a/server/drivers/acp/core.ts b/server/drivers/acp/core.ts
index aea8e2d8f0..90fab99da6 100644
--- a/server/drivers/acp/core.ts
+++ b/server/drivers/acp/core.ts
@@ -59,6 +59,7 @@ import { openQuestionRequest, questionRequestFor, type AcpQuestionRequest } from
import { commandSummary, toolDetailPreview } from "../../tool-summary.ts";
import { acpToolEndEvents } from "./tool-items.ts";
import { AcpHost } from "./host.ts";
+import { exitDetail } from "./exit-report.ts";
import { endTurn, trackRunningTool, type AcpAskFinish, type AcpSession, type AcpTurn } from "./turn-state.ts";
import { recoveryPromptFor } from "../../resume-recovery.ts";
import { armIdleClose, engineIdleMs, sessionIdlePolicy, stopIdleClose } from "../session-idle.ts";
@@ -185,8 +186,6 @@ export interface AcpSupport {
ownMcpOverHttp?: boolean;
/** How many tools the agent lists of its own beside the MCP servers', counted against a provider's tool limit. */
engineTools?: number;
- /** Do not retain stderr from providers that may place OAuth material there. */
- redactStderr?: boolean;
/** The agent's own debug log, read while a prompt is quiet: a new line proves it alive and `parse`
* picks what to tell the person. Null when this process keeps none. A `shared` log holds every session's
* and process's lines, so its lines prove nothing about this turn and only `parse` reads them. */
@@ -631,7 +630,7 @@ export function createAcpDriver(support: AcpSupport): ProviderDriver<AcpConfig>
const running = sharedHost(hostKey);
if (running) return running;
const child = spawnCli(launch.command, argv, { cwd, env, stdio: ["pipe", "pipe", "pipe"], box: { allowEnv: instanceEnvNames(input.environment, env) } }, "bot");
- const host = new AcpHost(child, hostKey, { source: SOURCE, logMessage: nativeLogMessage, keepStderr: !support.redactStderr, unrouted: refuse });
+ const host = new AcpHost(child, hostKey, { source: SOURCE, logMessage: nativeLogMessage, unrouted: refuse });
hosts.add(host);
child.once("close", () => hosts.delete(host));
child.once("error", () => hosts.delete(host));
@@ -971,7 +970,7 @@ export function createAcpDriver(support: AcpSupport): ProviderDriver<AcpConfig>
idleTimer: null,
closing: false,
dead: false,
- get stderr() { return host.stderr; },
+ get stderr() { return host.stderrTail.text; },
current: null,
};
acp.inbound = {
@@ -989,7 +988,7 @@ export function createAcpDriver(support: AcpSupport): ProviderDriver<AcpConfig>
emit({ ...base(threadId, current.turnId), type: "runtime.error", ...describeSpawnFailure(e, launch.command, cwd) });
settle(threadId, session, false, "spawn_error");
},
- exit: (code) => {
+ exit: (code, signal) => {
session.dead = true;
const current = session.current;
if (current?.state.cancelling) return;
@@ -997,7 +996,7 @@ export function createAcpDriver(support: AcpSupport): ProviderDriver<AcpConfig>
if (!current.state.stopped) emit({
...base(threadId, current.turnId),
type: "runtime.error",
- message: `${support.displayName} exited ${code} before the prompt result${session.stderr ? `: ${session.stderr.trim().slice(-300)}` : ""}`,
+ message: `${support.displayName} exited ${code ?? signal ?? "unexpectedly"} before the prompt result${exitDetail(code, signal, session.stderr)}`,
});
settle(threadId, session, current.state.stopped, current.state.stopped ? "cancelled" : "exit_before_result");
} else if (sessions.get(threadId) === session) {
diff --git a/server/drivers/acp/exit-report.test.ts b/server/drivers/acp/exit-report.test.ts
new file mode 100644
index 0000000000..18157d6a8f
--- /dev/null
+++ b/server/drivers/acp/exit-report.test.ts
@@ -0,0 +1,81 @@
+import { describe, expect, it } from "vitest";
+
+import { StderrTail, exitDetail, exitInWords, maskDiagnosticLine } from "./exit-report.ts";
+
+// Google's Antigravity runtime in the bot box without /sys, Fly Cloud home 2026-11-04: its whole stderr before exit 134.
+const TCMALLOC_ABORT = "2 third_party/tcmalloc/internal/sysinfo.h:76] CHECK in NumCPUs: maybe_cpus.has_value() (false) ";
+
+describe("an engine's exit in plain words", () => {
+ it("names what an exit code or signal means, including a signal a wrapper reports as 128 + N", () => {
+ expect(exitInWords(134)).toBe("it stopped itself (abort)");
+ expect(exitInWords(null, "SIGABRT")).toBe("it stopped itself (abort)");
+ expect(exitInWords(137)).toMatch(/killed, often for running out of memory/u);
+ expect(exitInWords(null, "SIGKILL")).toMatch(/killed/u);
+ expect(exitInWords(139)).toBe("it crashed");
+ expect(exitInWords(132)).toMatch(/instruction this CPU does not have/u);
+ expect(exitInWords(159)).toMatch(/system call the sandbox refuses/u);
+ expect(exitInWords(127)).toBe("a program it needs was not found");
+ expect(exitInWords(126)).toBe("a program it needs could not be run");
+ for (const plain of [0, 1, 3, 255, null]) expect(exitInWords(plain), String(plain)).toBeNull();
+ });
+
+ it("puts the meaning before the last output, and adds nothing when neither is known", () => {
+ expect(exitDetail(134, null, "CHECK failed")).toBe(": it stopped itself (abort). Last output: CHECK failed");
+ expect(exitDetail(134, null, "")).toBe(": it stopped itself (abort)");
+ expect(exitDetail(3, null, "panicked at src/main.rs")).toBe(": panicked at src/main.rs");
+ expect(exitDetail(1, null, "")).toBe("");
+ });
+});
+
+describe("masking an engine's diagnostic lines", () => {
+ it("keeps a crash line whole", () => {
+ expect(maskDiagnosticLine(TCMALLOC_ABORT)).toBe(TCMALLOC_ABORT.trim());
+ expect(maskDiagnosticLine("Error code: ENOENT, open '/data/x.json'")).toBe("Error code: ENOENT, open '/data/x.json'");
+ });
+
+ it("masks what a sign-in prints: a link's query, Google's code and token shapes, and a value after a secret's name", () => {
+ const lines = [
+ "Open https://accounts.google.com/o/oauth2/v2/auth?state=private-state&code_challenge=private-challenge",
+ "callback http://127.0.0.1:53681/?code=4/0AVGzR1private-code-value&state=private-state",
+ "got 4/0AVGzR1privatecodevalue1234 and ya29.a0Private-access.token",
+ "refresh 1//0gPrivateRefreshToken-xyz",
+ "private auth code: do-not-disclose",
+ "client GOCSPX-private-client-secret",
+ "Authorization: Bearer abcdefghijklmnopqrstuvwxyz",
+ "key sk-ant-api03-privatekeyvalue1234567890",
+ "session=0123456789abcdef0123456789abcdef0123",
+ ];
+ const masked = lines.map(maskDiagnosticLine).join("\n");
+ for (const secret of ["private-state", "private-challenge", "private-code-value", "privatecodevalue", "ya29.a0Private", "PrivateRefreshToken",
+ "do-not-disclose", "private-client-secret", "abcdefghijklmnopqrstuvwxyz", "privatekeyvalue", "0123456789abcdef0123"]) {
+ expect(masked, secret).not.toContain(secret);
+ }
+ expect(masked).toContain("https://accounts.google.com/o/oauth2/v2/auth?«redacted");
+ expect(masked).toContain("private auth code: «redacted");
+ });
+
+ it("caps a long line", () => {
+ expect(maskDiagnosticLine(`fatal: ${"word ".repeat(200)}`).length).toBeLessThanOrEqual(301);
+ });
+});
+
+describe("the last stderr lines", () => {
+ it("keeps the last three whole lines, masked as they arrive, and the unfinished one only once flushed", () => {
+ const tail = new StderrTail();
+ tail.write("one\ntwo\n\nthree\ntoken=private-token-value\nfour");
+ expect(tail.text).toBe("two | three | token=«redacted 19 chars»");
+ tail.flush();
+ expect(tail.text).toBe("three | token=«redacted 19 chars» | four");
+ tail.clear();
+ expect(tail.text).toBe("");
+ });
+
+ it("joins a line split across writes, and drops an overlong unfinished line unread", () => {
+ const tail = new StderrTail(3, 16);
+ tail.write("CHECK in Num");
+ tail.write("CPUs\n");
+ tail.write("x".repeat(40));
+ tail.write("\nlast\n");
+ expect(tail.text).toBe("CHECK in NumCPUs | last");
+ });
+});
diff --git a/server/drivers/acp/exit-report.ts b/server/drivers/acp/exit-report.ts
new file mode 100644
index 0000000000..aa982c4c54
--- /dev/null
+++ b/server/drivers/acp/exit-report.ts
@@ -0,0 +1,95 @@
+// What an engine's exit means, in plain words, and the last lines it wrote to stderr with anything secret-shaped masked.
+// The one description of an ACP engine's exit: a turn's (host.ts, core.ts) and Antigravity's setup (antigravity-acp.ts).
+// Lines are masked as they arrive and only the last few are kept, so no raw sign-in code or key is held.
+import { mask, redactSecretsInText } from "../../../shared/redact.ts";
+
+const SIGNAL_WORDS: Partial<Record<NodeJS.Signals, string>> = {
+ SIGABRT: "it stopped itself (abort)",
+ SIGKILL: "it was killed, often for running out of memory",
+ SIGSEGV: "it crashed",
+ SIGBUS: "it crashed",
+ SIGILL: "it crashed on an instruction this CPU does not have",
+ SIGSYS: "it made a system call the sandbox refuses",
+ SIGTERM: "it was stopped",
+};
+/** A wrapper (bubblewrap, a shell) reports a child killed by signal N as exit 128 + N. */
+const WRAPPED: Record<number, NodeJS.Signals> = { 132: "SIGILL", 134: "SIGABRT", 135: "SIGBUS", 137: "SIGKILL", 139: "SIGSEGV", 143: "SIGTERM", 159: "SIGSYS" };
+
+export function exitInWords(code: number | null, signal: NodeJS.Signals | null = null): string | null {
+ if (signal) return SIGNAL_WORDS[signal] ?? null;
+ if (code === 127) return "a program it needs was not found";
+ if (code === 126) return "a program it needs could not be run";
+ const wrapped = code === null ? undefined : WRAPPED[code];
+ return wrapped ? SIGNAL_WORDS[wrapped] ?? null : null;
+}
+
+// Beyond shared/redact.ts: what a sign-in prints. A link's query (state, code, PKCE challenge), Google's token and code
+// shapes, a value after a secret-sounding name, and any long opaque run.
+const LINK_QUERY = /\b(https?:\/\/[^\s?#"'<>]+)[?#][^\s"'<>]*/gi;
+const GOOGLE_SHAPES = [/\bya29\.[\w.-]+/g, /\b1\/\/[\w.-]{16,}/g, /\b4\/[\w-]{16,}/g, /\bGOCSPX-[\w-]+/g];
+const SECRET_PAIR = /\b(code|state|token|secret|password|passwd|verifier|challenge|credential|cookie|session|key|auth)(s?["']?\s*[:=]\s*["']?)([^\s"',;&]{8,})/gi;
+const OPAQUE = /[A-Za-z0-9_-]{32,}/g;
+const LINE_CHARS = 300;
+
+export function maskDiagnosticLine(line: string): string {
+ let out = redactSecretsInText(line);
+ out = out.replace(LINK_QUERY, (match: string, link: string) => `${link}?${mask(match.slice(link.length + 1))}`);
+ for (const shape of GOOGLE_SHAPES) out = out.replace(shape, (match) => mask(match));
+ out = out.replace(SECRET_PAIR, (match, name: string, separator: string, value: string) => value.startsWith("«redacted") ? match : `${name}${separator}${mask(value)}`);
+ out = out.replace(OPAQUE, (match) => mask(match));
+ const trimmed = out.trim();
+ return trimmed.length > LINE_CHARS ? `${trimmed.slice(0, LINE_CHARS)}…` : trimmed;
+}
+
+/** The last few non-empty stderr lines, masked as each completes. A partial line past `partialChars` is dropped unread. */
+export class StderrTail {
+ #partial = "";
+ #lines: string[] = [];
+ readonly #keep: number;
+ readonly #partialChars: number;
+
+ constructor(keep = 3, partialChars = 64 * 1024) {
+ this.#keep = keep;
+ this.#partialChars = partialChars;
+ }
+
+ /** Raw output; whole lines are kept masked. Only a chunk's last few lines can stay, so only they are masked. */
+ write(chunk: string): void {
+ const parts = (this.#partial + chunk).split("\n");
+ const rest = parts.pop() ?? "";
+ this.#partial = rest.length > this.#partialChars ? "" : rest;
+ for (const line of parts.filter((part) => part.trim()).slice(-this.#keep)) this.note(line);
+ }
+
+ /** One whole line, already split by the caller. */
+ note(line: string): void {
+ const masked = maskDiagnosticLine(line.replace(/\r$/u, ""));
+ if (!masked) return;
+ this.#lines.push(masked);
+ if (this.#lines.length > this.#keep) this.#lines.shift();
+ }
+
+ /** The unfinished last line counts once the process has closed. */
+ flush(): void {
+ const rest = this.#partial;
+ this.#partial = "";
+ if (rest) this.note(rest);
+ }
+
+ clear(): void {
+ this.#partial = "";
+ this.#lines = [];
+ }
+
+ get text(): string {
+ return this.#lines.join(" | ");
+ }
+}
+
+/** What follows "<engine> exited <code>": the meaning and the last output, or nothing when neither is known. */
+export function exitDetail(code: number | null, signal: NodeJS.Signals | null, tail: string): string {
+ const words = exitInWords(code, signal);
+ if (words && tail) return `: ${words}. Last output: ${tail}`;
+ if (words) return `: ${words}`;
+ return tail ? `: ${tail}` : "";
+}
diff --git a/server/drivers/acp/host.test.ts b/server/drivers/acp/host.test.ts
index de5b2acc3c..3c9d0c175e 100644
--- a/server/drivers/acp/host.test.ts
+++ b/server/drivers/acp/host.test.ts
@@ -18,7 +18,7 @@ const flush = () => new Promise((resolve) => setTimeout(resolve, 10));
function hostWith(key: string | null) {
const { child, written, say } = fakeChild();
const refused: any[] = [];
- const host = new AcpHost(child, key, { source: "test.acp", logMessage: (msg) => msg, keepStderr: true, unrouted: (msg) => refused.push(msg) });
+ const host = new AcpHost(child, key, { source: "test.acp", logMessage: (msg) => msg, unrouted: (msg) => refused.push(msg) });
const heard = new Map<string, any[]>();
const link = (threadId: string, sessionId: string | null) => {
const linked = host.link(threadId);
@@ -31,6 +31,23 @@ function hostWith(key: string | null) {
return { host, written, say, refused, heard, link };
}
+describe("an ACP process's exit", () => {
+ it("hands each listening thread the code and signal, with the last stderr lines kept masked", async () => {
+ const { child } = fakeChild();
+ const host = new AcpHost(child, null, { source: "test.acp", logMessage: (msg) => msg, unrouted: () => {} });
+ const exits: Array<[number | null, NodeJS.Signals | null, string]> = [];
+ const linked = host.link("a");
+ linked.inbound = { request: () => {}, notification: () => {}, error: () => {}, busy: () => false, exit: (code, signal) => exits.push([code, signal, host.stderrTail.text]) };
+ const stderr = child.stderr as unknown as PassThrough;
+ stderr.write("starting\nOpen https://accounts.google.com/o/oauth2/v2/auth?state=private-state\n");
+ stderr.write("fatal: out of cheese");
+ await flush();
+ child.emit("close", null, "SIGABRT");
+ expect(exits).toEqual([[null, "SIGABRT", expect.stringMatching(/^starting \| Open https:\/\/accounts\.google\.com\/o\/oauth2\/v2\/auth\?«redacted \d+ chars» \| fatal: out of cheese$/u)]]);
+ expect(exits[0]![2]).not.toContain("private-state");
+ });
+});
+
describe("one ACP process for several threads", () => {
it("gives each thread only its own session's traffic, and refuses a request for a session no thread holds", async () => {
const h = hostWith("shared");
diff --git a/server/drivers/acp/host.ts b/server/drivers/acp/host.ts
index 7abe3cd253..818148e5c7 100644
--- a/server/drivers/acp/host.ts
+++ b/server/drivers/acp/host.ts
@@ -5,6 +5,7 @@ import type { ChildProcessWithoutNullStreams } from "node:child_process";
import { engineMemory } from "../../engine-memory.ts";
import { appendNative } from "../native.ts";
+import { StderrTail } from "./exit-report.ts";
import { acpRpcError } from "./rpc-error.ts";
/** A catalog can contain credential-bearing native configuration, including late replies. */
@@ -34,7 +35,7 @@ export interface AcpConnection {
export interface AcpInbound {
request(msg: any): void;
notification(msg: any): void;
- exit(code: number | null): void;
+ exit(code: number | null, signal: NodeJS.Signals | null): void;
error(error: Error): void;
/** A tool or a question is open: silence then is no stall. */
busy(): boolean;
@@ -55,8 +56,6 @@ export interface AcpHostOptions {
source: string;
/** What the native log keeps of a message (images and tool payloads bounded). */
logMessage(msg: any): unknown;
- /** Keep stderr for exit messages; off for providers that may print OAuth material there. */
- keepStderr: boolean;
/** A request for a session no thread holds: it must still be answered or the agent blocks. */
unrouted(msg: any, send: (obj: unknown) => void): void;
}
@@ -110,7 +109,8 @@ export class AcpHost {
#lastOut: AcpLink | null = null;
initResult: any = null;
authenticated = false;
- stderr = "";
+ /** The last stderr lines, masked, for the exit message. */
+ readonly stderrTail = new StderrTail();
dead = false;
/** Takes no new sessions; it ends when its last one closes. */
draining = false;
@@ -151,18 +151,16 @@ export class AcpHost {
this.#receive(msg);
}
});
- child.stderr.on("data", (chunk) => {
- if (!options.keepStderr) return;
- this.stderr += chunk;
- if (this.stderr.length > 8192) this.stderr = this.stderr.slice(-8192);
- });
+ child.stderr.setEncoding("utf8");
+ child.stderr.on("data", (chunk: string) => this.stderrTail.write(chunk));
child.on("error", (error) => {
this.dead = true;
for (const link of this.#listening()) link.inbound?.error(error);
});
- child.on("close", (code) => {
+ child.on("close", (code, signal) => {
this.dead = true;
- for (const link of this.#listening()) link.inbound?.exit(code);
+ this.stderrTail.flush();
+ for (const link of this.#listening()) link.inbound?.exit(code, signal);
});
}
diff --git a/server/drivers/antigravity-acp.ts b/server/drivers/antigravity-acp.ts
index 14600f6cf7..50de24f232 100644
--- a/server/drivers/antigravity-acp.ts
+++ b/server/drivers/antigravity-acp.ts
@@ -11,6 +11,7 @@ import type { ModelCatalog } from "../contracts.ts";
import type { ChildProcess } from "node:child_process";
import type { AntigravityRuntime } from "./antigravity-runtime.ts";
import { acpVariantOption, surveyModelVariants } from "./acp/config-options.ts";
+import { StderrTail, exitDetail } from "./acp/exit-report.ts";
import {
VERIFICATION_TEMP_KEY,
antigravityTempDir,
@@ -216,6 +217,8 @@ export class AntigravityAcpClient {
private startupOutputBytes = 0;
private startupDiagnosticBytes = 0;
private nativeStartupHint?: string;
+ /** What it printed since it last answered, masked (sign-in links are taken out before), for the exit message. */
+ private readonly stderrTail = new StderrTail();
private closed = false;
private stopping?: Promise<boolean>;
private readonly onAuthorizationUrl?: (url: string) => void;
@@ -239,16 +242,16 @@ export class AntigravityAcpClient {
);
this.child.stdout!.setEncoding("utf8");
this.child.stdout!.on("data", (chunk: string) => this.consume(chunk));
- // Never surface raw stderr: it can contain authorization codes.
+ // Never surface raw stderr: it can contain authorization codes. Only masked last lines reach the exit message.
this.child.stderr!.setEncoding("utf8");
this.child.stderr!.on("data", (chunk: string) => this.consumeDiagnostics(chunk));
this.child.once("error", (error) => this.failAll(error));
this.exited = new Promise((resolve) => {
this.child.once("close", (code, signal) => {
- this.noteStartupDiagnostic(this.diagnosticBuffer);
+ if (authorizationUrlFromLine(this.diagnosticBuffer) === null) this.noteDiagnostic(this.diagnosticBuffer);
this.diagnosticBuffer = "";
if (!this.closed) this.failAll(new Error(
- `Antigravity ACP exited ${code ?? signal ?? "unexpectedly"}.${this.nativeStartupHint ? ` ${this.nativeStartupHint}` : ""}`,
+ `Antigravity ACP exited ${code ?? signal ?? "unexpectedly"}${exitDetail(code, signal, this.stderrTail.text)}.${this.nativeStartupHint ? ` ${this.nativeStartupHint}` : ""}`,
));
resolve();
});
@@ -305,10 +308,15 @@ export class AntigravityAcpClient {
const { lines, rest } = takeLines(this.diagnosticBuffer + chunk);
this.diagnosticBuffer = rest.length > MAX_DIAGNOSTIC_LINE_CHARS ? "" : rest;
for (const line of lines) {
- if (!this.announceAuthorizationUrl(line)) this.noteStartupDiagnostic(line);
+ if (!this.announceAuthorizationUrl(line)) this.noteDiagnostic(line);
}
}
+ private noteDiagnostic(line: string) {
+ this.noteStartupDiagnostic(line);
+ this.stderrTail.note(line);
+ }
+
private noteStartupDiagnostic(line: string) {
if (!this.initializationComplete) this.nativeStartupHint ??= startupHint(line);
}
@@ -386,6 +394,7 @@ export class AntigravityAcpClient {
}, Math.min(windowMs, Math.max(0, deadline - Date.now())), expired);
this.initializationComplete = true;
this.nativeStartupHint = undefined;
+ this.stderrTail.clear();
return initialized;
}
diff --git a/server/drivers/antigravity-lifecycle.test.ts b/server/drivers/antigravity-lifecycle.test.ts
index 1bbcbde379..1d24b3b46d 100644
--- a/server/drivers/antigravity-lifecycle.test.ts
+++ b/server/drivers/antigravity-lifecycle.test.ts
@@ -204,6 +204,22 @@ describe("Antigravity initialization diagnostics", () => {
acp.close();
});
+ it("explains an exit with what the runtime last printed, masked, and never the sign-in link's query", async () => {
+ const child = fakeChild(null);
+ const acp = client();
+ const rejected = acp.initialize().catch((error: Error) => error);
+ child.stderr.write("private auth code: do-not-disclose\n");
+ child.stderr.write("https://accounts.google.com/o/oauth2/v2/auth?state=private-state&code=secret-code\n");
+ // Google's runtime in a box without /sys, measured on a Fly Cloud home; bubblewrap reports its SIGABRT as 134.
+ child.stderr.write("2 third_party/tcmalloc/internal/sysinfo.h:76] CHECK in NumCPUs: maybe_cpus.has_value() (false) ");
+ child.emit("close", 134, null);
+ const error = await rejected;
+ expect(error.message).toBe("Antigravity ACP exited 134: it stopped itself (abort). Last output: private auth code: «redacted 15 chars» | "
+ + "https://accounts.google.com/o/oauth2/v2/auth?«redacted 36 chars» | 2 third_party/tcmalloc/internal/sysinfo.h:76] CHECK in NumCPUs: maybe_cpus.has_value() (false).");
+ for (const secret of ["do-not-disclose", "private-state", "secret-code"]) expect(error.message).not.toContain(secret);
+ acp.close();
+ });
+
it("does not reuse a startup warning after initialization succeeds", async () => {
const child = fakeChild(null);
const acp = client();
diff --git a/server/drivers/antigravity.ts b/server/drivers/antigravity.ts
index 1fe99f85d6..dbdade7d2f 100644
--- a/server/drivers/antigravity.ts
+++ b/server/drivers/antigravity.ts
@@ -87,7 +87,6 @@ const support: AcpSupport = {
sessionScopedApproval: true,
resumeMethod: "resume",
clientFileSystem: true,
- redactStderr: true,
sanitizeToolPayload: true,
resolveCommand: async (env, config, instanceId) => {
diff --git a/server/testing/fake-acp-cli.ts b/server/testing/fake-acp-cli.ts
index 6e4e5bf2a4..e8f147d842 100755
--- a/server/testing/fake-acp-cli.ts
+++ b/server/testing/fake-acp-cli.ts
@@ -6,7 +6,8 @@
// (FAKE_ACP_REJECT_LIVE_LOAD_DSH=1: with dsh 0.2's -32602 "session is already active" instead of -32000)
// FAKE_ACP_CACHED_LIVE_LOAD a live session/load is acknowledged but keeps the old MCP credentials, like Qwen
// FAKE_ACP_TEXT_REPLY answer every session/prompt with only this text
-// FAKE_ACP_MODE happy (default) | image | empty-reply | reasoning-only | exit-early | fail-after-text | crash-in-prompt | hang
+// FAKE_ACP_MODE happy (default) | image | empty-reply | reasoning-only | exit-early | fail-after-text | crash-in-prompt
+// | abort-in-prompt (a sign-in link, then a TCMalloc CHECK line on stderr, then exit 134 as bubblewrap reports SIGABRT) | hang
// | hang-initialize | unkeyed-tool | finished-tools (tool_call frames that arrive already completed or failed, one updated again)
// | no-auth | auth-required | permission | question
// | ask-question (a mid-prompt vendor question: FAKE_ACP_ASK_METHOD, default cursor/ask_question, params
@@ -931,6 +932,11 @@ function handle(msg: any) {
hangKeepAlive = setInterval(() => {}, 1_000);
return;
}
+ if (mode === "abort-in-prompt") {
+ process.stderr.write("Open https://accounts.google.com/o/oauth2/v2/auth?state=private-state&code=4/0AVGzR1private-code-value\n");
+ process.stderr.write("2 third_party/tcmalloc/internal/sysinfo.h:76] CHECK in NumCPUs: maybe_cpus.has_value() (false) \n");
+ process.exit(134);
+ }
if (mode === "crash-in-prompt") {
out({ jsonrpc: "2.0", method: "session/update", params: { update: { sessionUpdate: "agent_message_chunk", content: { text: "working" } } } });
setTimeout(() => process.exit(3), 200);