@devries-cameron20 / t3code-1 / commits / f8df431165
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

fix(antigravity): binary file reads return an error, not garbled text (#25292)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: maria-rcks <maria@kuuro.net>

Victor Vogel committed Oct 30, 2026 at 16:13 UTC f8df4311652c22564700474f3b99f2213a5021f6
2 files changed +33 -2
apps/server/src/orchestration-v2/Adapters/AntigravityAdapterV2.test.ts
+19
@@ -332,6 +332,25 @@ describe("AntigravityAdapterV2 client file system", () => {
332 context("fs/read_text_file"),
333 );
334 assert.equal(pasted.content, "pasted");
335 + yield* fileSystem.writeFileString(insidePath, "\uFEFFfirst\né中🙂\nlast");
336 + const sliced = yield* readTextFile(
337 + { sessionId: "mock-session-1", path: insidePath, line: 2, limit: 1 },
338 + context("fs/read_text_file"),
339 + );
340 + assert.equal(sliced.content, "é中🙂");
341 + yield* fileSystem.writeFileString(insidePath, "inside");
342 + for (const [name, bytes] of [
343 + ["image.png", new Uint8Array([0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a])],
344 + ["data.bin", new Uint8Array([0x61, 0, 0x62])],
345 + ] as const) {
346 + const binaryPath = path.join(workspace, name);
347 + yield* fileSystem.writeFile(binaryPath, bytes);
348 + const binaryRead = yield* readTextFile(
349 + { sessionId: "mock-session-1", path: binaryPath },
350 + context("fs/read_text_file"),
351 + ).pipe(Effect.flip);
352 + assert.propertyVal(binaryRead, "code", -32602, `${name} is refused as binary`);
353 + }
354
355 const outsideRead = yield* readTextFile(
356 { sessionId: "mock-session-1", path: outsideFile },
apps/server/src/provider/acp/AntigravityClientFiles.ts
+14 -2
@@ -78,13 +78,25 @@ export const readAntigravityClientTextFile = Effect.fn("AntigravityClientFiles.r
78 `File '${input.request.path}' is not a readable text file under ${CLIENT_FILE_MAX_BYTES} bytes.`,
79 );
80 }
81 - const text = yield* input.fileSystem
82 - .readFileString(filePath)
81 + const bytes = yield* input.fileSystem
82 + .readFile(filePath)
83 .pipe(
84 Effect.mapError(() =>
85 EffectAcpErrors.AcpRequestError.internalError(`Could not read '${input.request.path}'.`),
86 ),
87 );
88 + const text = yield* Effect.try({
89 + try: () => new TextDecoder("utf-8", { fatal: true }).decode(bytes),
90 + catch: () =>
91 + EffectAcpErrors.AcpRequestError.invalidParams(
92 + `File '${input.request.path}' is not a UTF-8 text file.`,
93 + ),
94 + });
95 + if (text.includes("\0")) {
96 + return yield* EffectAcpErrors.AcpRequestError.invalidParams(
97 + `File '${input.request.path}' contains binary data.`,
98 + );
99 + }
100 const line = input.request.line ?? undefined;
101 const limit = input.request.limit ?? undefined;
102 if (line === undefined && limit === undefined) {