The best way to control Claude Code, Codex and more from any computer or phone
fix(antigravity): accept empty startup skill directories (#27191)
Co-authored-by: maria-rcks <maria@kuuro.net>
Marko Milanovic committed
Nov 1, 2026 at 03:36 UTC
623344a7cf2a0cd9040041b23d249aabfeedad21
2 files changed
+99
-27
apps/server/src/textGeneration/AntigravityTextGeneration.test.ts
+70
-26
@@ -5,6 +5,7 @@ import {
5
ProviderInstanceId,
6
ProviderSetupError,
7
} from "@t3tools/contracts";
8
+import { symlinksSupported } from "@t3tools/shared/testing/symlinks";
9
import * as Deferred from "effect/Deferred";
10
import * as Effect from "effect/Effect";
11
import * as Exit from "effect/Exit";
@@ -60,6 +61,7 @@ const makeFixture = Effect.fn("makeAntigravityTextGenerationFixture")(function*
61
readonly startError?: AcpError;
62
readonly rejectAdmission?: boolean;
63
readonly sessionId?: string;
64
+ readonly startupSkills?: boolean;
65
} = {},
66
) {
67
const fs = yield* FileSystem.FileSystem;
@@ -135,6 +137,13 @@ const makeFixture = Effect.fn("makeAntigravityTextGenerationFixture")(function*
137
start: () =>
138
Effect.gen(function* () {
139
if (options.startError) return yield* options.startError;
140
+ if (options.startupSkills) {
141
+ for (const directory of [".agents", ".gemini"]) {
142
+ yield* fs
143
+ .makeDirectory(path.join(cwd, directory, "skills"), { recursive: true })
144
+ .pipe(Effect.orDie);
145
+ }
146
+ }
147
yield* fs.makeDirectory(brainDirectory, { recursive: true }).pipe(Effect.orDie);
148
yield* fs.writeFileString(`${sessionBase}.db`, "helper session").pipe(Effect.orDie);
149
yield* fs.writeFileString(`${sessionBase}.db-wal`, "helper journal").pipe(Effect.orDie);
@@ -279,11 +288,12 @@ const makeFixture = Effect.fn("makeAntigravityTextGenerationFixture")(function*
288
});
289
290
it.layer(NodeServices.layer)("AntigravityTextGeneration", (it) => {
282
- it.effect(
283
- "generates all helper types in empty workspaces and removes only owned session files",
284
- () =>
291
+ it.effect.each([false, true])(
292
+ "generates all helper types and cleans up with startupSkills=%s",
293
+ (startupSkills) =>
294
Effect.gen(function* () {
295
const fixture = yield* makeFixture({
296
+ startupSkills,
297
outputs: [
298
'{"subject":" Repair Google login.\\nExtra line","body":" Keep the remote callback. ","branch":"Repair Login"}',
299
'```json\n{"title":" Repair Google login\\nExtra line","body":" ## Summary\\nSupport remote callbacks. "}\n```',
@@ -442,29 +452,51 @@ it.layer(NodeServices.layer)("AntigravityTextGeneration", (it) => {
452
}).pipe(Effect.scoped),
453
);
454
445
- it.effect("rejects a helper that writes files in its temporary workspace", () =>
446
- Effect.gen(function* () {
447
- const fs = yield* FileSystem.FileSystem;
448
- const path = yield* Path.Path;
449
- const fixture = yield* makeFixture({
450
- prompt: ({ cwd, emit }) =>
451
- Effect.gen(function* () {
452
- yield* fs
453
- .writeFileString(path.join(cwd, "unexpected.txt"), "unexpected")
454
- .pipe(Effect.orDie);
455
- yield* emit({
456
- sessionUpdate: "agent_message_chunk",
457
- content: { type: "text", text: '{"title":"Ignored output"}' },
458
- });
459
- return { stopReason: "end_turn" };
460
- }),
461
- });
462
- const error = yield* fixture.textGeneration
463
- .generateThreadTitle(fixture.titleInput)
464
- .pipe(Effect.flip);
465
- expect(error.detail).toContain("wrote files");
466
- yield* fixture.assertCleaned;
467
- }).pipe(Effect.scoped),
455
+ it.effect.each([
456
+ { relativePath: "unexpected.txt", kind: "file" },
457
+ { relativePath: ".agents/skills/unexpected.txt", kind: "file" },
458
+ { relativePath: ".gemini/unexpected", kind: "directory" },
459
+ { relativePath: ".agents/skills", kind: "file" },
460
+ ...(symlinksSupported ? [{ relativePath: ".gemini/skills", kind: "symlink" }] : []),
461
+ ])(
462
+ "rejects an unexpected $kind at $relativePath in its temporary workspace",
463
+ ({ relativePath, kind }) =>
464
+ Effect.gen(function* () {
465
+ const fs = yield* FileSystem.FileSystem;
466
+ const path = yield* Path.Path;
467
+ const target =
468
+ kind === "symlink"
469
+ ? yield* fs.makeTempDirectoryScoped({ prefix: "t3-antigravity-link-test-" })
470
+ : undefined;
471
+ const fixture = yield* makeFixture({
472
+ startupSkills: true,
473
+ prompt: ({ cwd, emit }) =>
474
+ Effect.gen(function* () {
475
+ const entry = path.join(cwd, relativePath);
476
+ if (yield* fs.exists(entry).pipe(Effect.orDie)) {
477
+ yield* fs.remove(entry, { recursive: true }).pipe(Effect.orDie);
478
+ }
479
+ yield* (
480
+ target !== undefined
481
+ ? fs.symlink(target, entry)
482
+ : kind === "directory"
483
+ ? fs.makeDirectory(entry)
484
+ : fs.writeFileString(entry, "unexpected")
485
+ ).pipe(Effect.orDie);
486
+ yield* emit({
487
+ sessionUpdate: "agent_message_chunk",
488
+ content: { type: "text", text: '{"title":"Ignored output"}' },
489
+ });
490
+ return { stopReason: "end_turn" };
491
+ }),
492
+ });
493
+ const error = yield* fixture.textGeneration
494
+ .generateThreadTitle(fixture.titleInput)
495
+ .pipe(Effect.flip);
496
+ expect(error.detail).toContain("wrote files");
497
+ if (target !== undefined) expect(yield* fs.exists(target)).toBe(true);
498
+ yield* fixture.assertCleaned;
499
+ }).pipe(Effect.scoped),
500
);
501
502
it.effect("uses the native default without sending T3's default selection as a model ID", () =>
@@ -576,3 +608,15 @@ it.layer(NodeServices.layer)("AntigravityTextGeneration", (it) => {
608
}).pipe(Effect.scoped),
609
);
610
});
611
+
612
+it.effect("retains filesystem services supplied only during construction", () =>
613
+ Effect.gen(function* () {
614
+ const fixture = yield* makeFixture({ startupSkills: true }).pipe(
615
+ Effect.provide(NodeServices.layer),
616
+ );
617
+ expect(yield* fixture.textGeneration.generateThreadTitle(fixture.titleInput)).toEqual({
618
+ title: "Repair login",
619
+ });
620
+ yield* fixture.assertCleaned;
621
+ }).pipe(Effect.scoped),
622
+);
apps/server/src/textGeneration/AntigravityTextGeneration.ts
+29
-1
@@ -94,6 +94,34 @@ export const makeAntigravityTextGeneration = Effect.fn("makeAntigravityTextGener
94
) {
95
const fs = yield* FileSystem.FileSystem;
96
const path = yield* Path.Path;
97
+ const hasOnlyRuntimeDirectories = Effect.fn(
98
+ "AntigravityTextGeneration.hasOnlyRuntimeDirectories",
99
+ )(function* (cwd: string) {
100
+ const root = yield* fs.realPath(cwd);
101
+ // ACP creates these empty skill directories before the first prompt.
102
+ const allowed = new Set([
103
+ path.join(root, ".agents"),
104
+ path.join(root, ".agents", "skills"),
105
+ path.join(root, ".gemini"),
106
+ path.join(root, ".gemini", "skills"),
107
+ ]);
108
+ const directories = [root];
109
+ for (const directory of directories) {
110
+ for (const name of yield* fs.readDirectory(directory)) {
111
+ const entry = path.join(directory, name);
112
+ if (
113
+ !allowed.has(entry) ||
114
+ (yield* fs.realPath(entry)) !== entry ||
115
+ (yield* fs.stat(entry)).type !== "Directory"
116
+ ) {
117
+ return false;
118
+ }
119
+ directories.push(entry);
120
+ }
121
+ }
122
+ return true;
123
+ });
124
+
125
const available = isAntigravityTextGenerationAvailable(options.profileDirectory).pipe(
126
Effect.provideService(FileSystem.FileSystem, fs),
127
Effect.provideService(Path.Path, path),
@@ -253,7 +281,7 @@ export const makeAntigravityTextGeneration = Effect.fn("makeAntigravityTextGener
281
);
282
}).pipe(Effect.scoped);
283
256
- if ((yield* fs.readDirectory(cwd)).length > 0) {
284
+ if (!(yield* hasOnlyRuntimeDirectories(cwd))) {
285
return yield* new TextGenerationError({
286
operation,
287
detail: "Antigravity wrote files during text generation.",