GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(server): Antigravity sessions no longer mark an unscanned folder'… · patroza/t3code@73c48a4

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • apps/server/src/provider
    • AntigravityProvider.test.ts
    • AntigravityProvider.ts
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎apps/server/src/provider/AntigravityProvider.test.ts‎

Copy file name to clipboardExpand all lines: apps/server/src/provider/AntigravityProvider.test.ts
+60Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { describe, expect, it } from "@effect/vitest";
44
import {
55
ANTIGRAVITY_DEFAULT_MODEL,
66
AntigravitySettings,
7+
isProviderWorkspaceSnapshotPending,
78
ProviderDriverKind,
89
ProviderInstanceId,
910
ProviderSetupError,
@@ -958,6 +959,65 @@ it.layer(layerTest)("Antigravity provider snapshots", (it) => {
958959
}),
959960
);
960961

962+
it.effect("a session in an unscanned folder does not publish its skills as scanned", () =>
963+
Effect.gen(function* () {
964+
const harness = yield* makeHarness();
965+
yield* harness.initialize;
966+
const unscanned = () =>
967+
Effect.map(harness.provider.snapshot.getSnapshot, (snapshot) => {
968+
const entry = snapshot.workspaceSnapshots?.find((item) => item.cwd === "/workspace");
969+
// ProviderRegistry skips the skill scan for a current entry that is not pending.
970+
return entry === undefined || isProviderWorkspaceSnapshotPending(entry);
971+
});
972+
973+
yield* harness.provider.onSessionStarted(started, "/workspace");
974+
expect(yield* unscanned()).toBe(true);
975+
yield* harness.provider.onAvailableCommands(commands, "/workspace");
976+
expect(yield* unscanned()).toBe(true);
977+
}),
978+
);
979+
980+
it.effect("a skill scan leaves the folder entry it scanned from unchanged", () =>
981+
Effect.gen(function* () {
982+
const harness = yield* makeHarness();
983+
yield* harness.initialize;
984+
yield* harness.provider.onSessionStarted(started, "/workspace");
985+
const published = yield* harness.provider.snapshot.getSnapshot;
986+
const entryOf = (provider: ServerProvider) =>
987+
provider.workspaceSnapshots?.find((entry) => entry.cwd === "/workspace");
988+
const skills = [{ name: "deploy", path: "/workspace/.agent/skills/deploy", enabled: true }];
989+
990+
yield* harness.provider.snapshotForCwd("/workspace", skills);
991+
// ProviderRegistry saves the scan only if the entry it scanned from is still published.
992+
const republished = mergeProviderSnapshot(
993+
published,
994+
yield* harness.provider.snapshot.getSnapshot,
995+
);
996+
expect(entryOf(republished)).toEqual(entryOf(published));
997+
}),
998+
);
999+
1000+
it.effect(
1001+
"keeps a scanned folder's own commands when another folder reports different ones",
1002+
() =>
1003+
Effect.gen(function* () {
1004+
const harness = yield* makeHarness();
1005+
yield* harness.initialize;
1006+
yield* harness.provider.onAvailableCommands(commands, "/a");
1007+
yield* harness.provider.snapshotForCwd("/a", []);
1008+
yield* harness.provider.onAvailableCommands(commands.slice(1), "/b");
1009+
expect((yield* harness.provider.snapshotForCwd("/a", [])).slashCommands).toEqual(
1010+
expectedCommands,
1011+
);
1012+
yield* harness.provider.onSessionStarted(started, "/a");
1013+
expect(
1014+
(yield* harness.provider.snapshot.getSnapshot).workspaceSnapshots?.find(
1015+
(entry) => entry.cwd === "/a",
1016+
)?.slashCommands,
1017+
).toEqual(expectedCommands);
1018+
}),
1019+
);
1020+
9611021
it.effect("bounds workspace metadata without starting sessions for workspace lookup", () =>
9621022
Effect.gen(function* () {
9631023
const harness = yield* makeHarness();
Collapse file

‎apps/server/src/provider/AntigravityProvider.ts‎

Copy file name to clipboardExpand all lines: apps/server/src/provider/AntigravityProvider.ts
+25-14Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -273,8 +273,10 @@ export const makeAntigravityProvider = Effect.fn("makeAntigravityProvider")(func
273273
draft: initialDraft,
274274
authRevision: 0,
275275
});
276-
// Preserve disk-discovered skills when callbacks replace workspace commands; the registry will not rescan them.
276+
// Skills from the registry's last scan of each folder. A folder without them stays pending so it is scanned.
277277
const discoveredSkills = new Map<string, ServerProvider["skills"]>();
278+
// Commands of folders whose draft entry a skill scan dropped, so later scans still report them.
279+
const workspaceCommands = new Map<string, ServerProvider["slashCommands"]>();
278280
const thinkingLevels = new Map<string, ThinkingConfig | null>();
279281
let defaultModelSlug: string | undefined;
280282
const observeThinkingLevels = (
@@ -474,6 +476,7 @@ export const makeAntigravityProvider = Effect.fn("makeAntigravityProvider")(func
474476
const { message: _previousMessage, ...draft } = state.draft;
475477
const workspaces = draft.workspaceSnapshots ?? [];
476478
const workspace = cwd ? workspaces.find((entry) => entry.cwd === cwd) : undefined;
479+
const skills = cwd ? discoveredSkills.get(cwd) : undefined;
477480
const next = {
478481
authRevision: state.authRevision + 1,
479482
draft: {
@@ -500,8 +503,10 @@ export const makeAntigravityProvider = Effect.fn("makeAntigravityProvider")(func
500503
{
501504
cwd,
502505
checkedAt: updatedAt,
503-
slashCommands: workspace?.slashCommands ?? draft.slashCommands,
504-
skills: workspace?.skills ?? discoveredSkills.get(cwd) ?? [],
506+
slashCommands:
507+
workspace?.slashCommands ?? workspaceCommands.get(cwd) ?? draft.slashCommands,
508+
skills: skills ?? workspace?.skills ?? [],
509+
...(skills ? {} : { slashCommandsPending: true }),
505510
},
506511
].slice(-MAX_WORKSPACE_SNAPSHOTS),
507512
}
@@ -540,6 +545,7 @@ export const makeAntigravityProvider = Effect.fn("makeAntigravityProvider")(func
540545
if (!settings.enabled) return;
541546
const slashCommands = nativeCommands(commands);
542547
const updatedAt = DateTime.formatIso(yield* DateTime.now);
548+
const skills = cwd ? discoveredSkills.get(cwd) : undefined;
543549
yield* SubscriptionRef.update(metadata, (state) => {
544550
if (state.draft.auth.status === "unauthenticated") return state;
545551
return {
@@ -556,9 +562,10 @@ export const makeAntigravityProvider = Effect.fn("makeAntigravityProvider")(func
556562
checkedAt: updatedAt,
557563
slashCommands,
558564
skills:
565+
skills ??
559566
state.draft.workspaceSnapshots?.find((entry) => entry.cwd === cwd)?.skills ??
560-
discoveredSkills.get(cwd) ??
561567
[],
568+
...(skills ? {} : { slashCommandsPending: true }),
562569
},
563570
].slice(-MAX_WORKSPACE_SNAPSHOTS),
564571
}
@@ -597,6 +604,7 @@ export const makeAntigravityProvider = Effect.fn("makeAntigravityProvider")(func
597604
]);
598605
yield* rememberRuntimeModes(previousModes, RUNTIME_MODES_WITHOUT_AUTO);
599606
discoveredSkills.clear();
607+
workspaceCommands.clear();
600608
thinkingLevels.clear();
601609
defaultModelSlug = undefined;
602610
});
@@ -605,27 +613,30 @@ export const makeAntigravityProvider = Effect.fn("makeAntigravityProvider")(func
605613
cwd: string,
606614
skills?: ServerProvider["skills"],
607615
) {
616+
const snapshot = yield* getSnapshot;
617+
const workspace = snapshot.workspaceSnapshots?.find((entry) => entry.cwd === cwd);
608618
if (skills) {
609619
discoveredSkills.set(cwd, skills);
610-
yield* SubscriptionRef.update(metadata, (state) =>
620+
if (workspace) workspaceCommands.set(cwd, workspace.slashCommands);
621+
// The registry keeps the folder it scans. Changing the entry mid-scan would discard the scan.
622+
yield* SubscriptionRef.updateSome(metadata, (state) =>
611623
state.draft.workspaceSnapshots?.some((entry) => entry.cwd === cwd)
612-
? {
624+
? Option.some({
613625
...state,
614626
draft: {
615627
...state.draft,
616-
workspaceSnapshots: state.draft.workspaceSnapshots.map((entry) =>
617-
entry.cwd === cwd ? { ...entry, skills } : entry,
628+
workspaceSnapshots: state.draft.workspaceSnapshots.filter(
629+
(entry) => entry.cwd !== cwd,
618630
),
619631
},
620-
}
621-
: state,
632+
})
633+
: Option.none(),
622634
);
623635
}
624-
const snapshot = yield* getSnapshot;
625-
const workspace = snapshot.workspaceSnapshots?.find((entry) => entry.cwd === cwd);
626636
const resolvedSkills = skills ?? workspace?.skills ?? discoveredSkills.get(cwd) ?? [];
627-
return workspace
628-
? { ...snapshot, slashCommands: workspace.slashCommands, skills: resolvedSkills }
637+
const slashCommands = workspace?.slashCommands ?? workspaceCommands.get(cwd);
638+
return slashCommands
639+
? { ...snapshot, slashCommands, skills: resolvedSkills }
629640
: { ...snapshot, skills: resolvedSkills };
630641
});
631642

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.