Skip to content

Commit 0fe5412

Browse files
committed
fix(semantic-search): tolerate ai search schema failures (greptile)
1 parent c41a178 commit 0fe5412

2 files changed

Lines changed: 53 additions & 7 deletions

File tree

packages/plugins/semantic-search/src/sdk/ai-search.test.ts

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,58 @@ describe("makeAiSearchToolDiscoveryProvider", () => {
185185
});
186186

187187
describe("reindexAiSearch", () => {
188+
it.effect("indexes an identity document when schema collection fails", () =>
189+
Effect.gen(function* () {
190+
let uploadedContent = "";
191+
const stored: AiSearchItemRow[] = [];
192+
193+
const result = yield* reindexAiSearch({
194+
executor: {
195+
tools: {
196+
manifest: () =>
197+
Effect.succeed([
198+
{
199+
path: "github.default.main.repos.create",
200+
name: "repos.create",
201+
description: "Create a repository",
202+
integration: "github",
203+
fingerprintVersion: "v1",
204+
indexFingerprint: "fingerprint",
205+
},
206+
]),
207+
schema: () => Effect.fail("schema unavailable"),
208+
},
209+
} as never,
210+
aiSearch: {
211+
...makeAiSearch(),
212+
items: {
213+
...makeAiSearch().items,
214+
upload: async (name, content) => {
215+
uploadedContent = String(content);
216+
return { id: `item:${name}`, key: name };
217+
},
218+
},
219+
},
220+
items: makeItemsCollection({
221+
list: () => Effect.succeed([]),
222+
put: ({ data }) =>
223+
Effect.sync(() => {
224+
stored.push(data);
225+
return { ...githubRow, data };
226+
}),
227+
}),
228+
owner: "org",
229+
namespace: "org",
230+
});
231+
232+
expect(result).toMatchObject({ indexed: 1, skipped: 0, removed: 0 });
233+
expect(uploadedContent).toContain("# github.default.main.repos.create");
234+
expect(uploadedContent).toContain("Description: Create a repository");
235+
expect(uploadedContent).not.toContain("Input schema");
236+
expect(stored[0]?.fingerprint).toBe("github.default.main.repos.create:v1:fingerprint:");
237+
}),
238+
);
239+
188240
it.effect("removes stale rows even when deleting the remote AI Search item fails", () =>
189241
Effect.gen(function* () {
190242
const removed: string[] = [];

packages/plugins/semantic-search/src/sdk/documents.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -305,13 +305,7 @@ export const collectToolSearchDocument = (
305305
const description = stripHtml(manifest.description ?? "");
306306
const fingerprint = toolItemKey(manifest);
307307
return executor.tools.schema(`${ADDRESS_PREFIX}${path}` as Tool["address"]).pipe(
308-
Effect.mapError(
309-
(cause) =>
310-
new SemanticSearchError({
311-
message: `Failed to collect schema for AI Search item "${path}".`,
312-
cause,
313-
}),
314-
),
308+
Effect.catch(() => Effect.succeed(null)),
315309
Effect.map((view) => {
316310
const sections = [
317311
`# ${path}`,

0 commit comments

Comments
 (0)