Skip to content

Commit 769bda2

Browse files
fix(server): invent pending catalogs only for providers that scan a cwd, keep skill labels
Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 85375f1 commit 769bda2

2 files changed

Lines changed: 14 additions & 7 deletions

File tree

‎apps/server/src/ws.test.ts‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1062,6 +1062,13 @@ it.effect("on-demand clients get provider config without workspace snapshots", (
10621062
? { instanceId, snapshotForCwd: () => Effect.die("unused") }
10631063
: { instanceId }) as never,
10641064
]),
1065+
getInstance: () =>
1066+
Effect.sync(
1067+
() =>
1068+
(scansCwd
1069+
? { instanceId, snapshotForCwd: () => Effect.die("unused") }
1070+
: { instanceId }) as never,
1071+
),
10651072
}),
10661073
Layer.mock(UsageLimitSources.UsageLimitSources)({
10671074
current: Effect.succeed([]),
@@ -1195,6 +1202,7 @@ it.effect("on-demand clients get provider config without workspace snapshots", (
11951202
[[[snapshotFor("/b", "2026-10-25T00:00:00.000Z")], []]],
11961203
);
11971204
// A failed scan still gives a client without the machine catalog its commands.
1205+
scansCwd = true;
11981206
yield* server.write(0, {
11991207
_tag: "Request",
12001208
id: RpcMessage.RequestId("refresh-failed-scan"),

‎apps/server/src/ws.ts‎

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,7 @@ function workspaceSnapshotOrCatalog(
448448

449449
// On-demand catalog clients read full entries from the cwd snapshot they fetch. Names still
450450
// change the config when the machine catalog does, so the client refetches, and skill names
451-
// keep skill links working where no snapshot is fetched.
451+
// and labels keep skill links working where no snapshot is fetched.
452452
function withoutWorkspaceSnapshots(
453453
providers: ReadonlyArray<ServerProvider>,
454454
catalogsPerCwd: ReadonlySet<string> = new Set(),
@@ -459,7 +459,7 @@ function withoutWorkspaceSnapshots(
459459
...provider,
460460
slashCommands: provider.slashCommands.map(({ name }) => ({ name })),
461461
skills: provider.skills.map(
462-
({ description: _d, shortDescription: _s, displayName: _n, ...skill }) => skill,
462+
({ description: _d, shortDescription: _s, ...skill }) => skill,
463463
),
464464
}
465465
: provider,
@@ -2534,6 +2534,9 @@ export const layerWsRpc = (
25342534
if (instanceId === undefined || cwd === undefined) {
25352535
return { providers: withoutWorkspaceSnapshots(commandProviders) };
25362536
}
2537+
const catalogOnDemand =
2538+
input.providerCatalogsOnDemand === true &&
2539+
(yield* providerInstances.getInstance(instanceId))?.snapshotForCwd !== undefined;
25372540
return {
25382541
providers: commandProviders
25392542
.filter((provider) => provider.instanceId === instanceId)
@@ -2543,11 +2546,7 @@ export const layerWsRpc = (
25432546
models: [],
25442547
slashCommands: [],
25452548
skills: [],
2546-
workspaceSnapshots: workspaceSnapshotOrCatalog(
2547-
provider,
2548-
cwd,
2549-
input.providerCatalogsOnDemand === true,
2550-
),
2549+
workspaceSnapshots: workspaceSnapshotOrCatalog(provider, cwd, catalogOnDemand),
25512550
})),
25522551
};
25532552
}),

0 commit comments

Comments
 (0)