fix(semantic-search): align AI Search catalog retrieval - #77
Merged
Conversation
Keep native hybrid retrieval authoritative for tool search while enriching indexed documents with integration context. Treat the local upload ledger as recovery state instead of query visibility, and isolate per-document reindex failures so one tool cannot abort a batch.
aryasaatvik
marked this pull request as ready for review
August 23, 2026 01:35
Greptile SummaryThe PR keeps Cloudflare AI Search authoritative for discovery while strengthening indexed document metadata and replacement recovery.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| packages/plugins/semantic-search/src/sdk/ai-search.ts | Reworks AI Search retrieval authority, per-item failure isolation, and replacement cleanup ordering; the previously reported defects are no longer established at current HEAD. |
| packages/plugins/semantic-search/src/sdk/ai-search.test.ts | Adds coverage for optional enrichment failure, persistence-safe replacement, outdated-item replacement, and preservation of every failed deletion. |
| packages/plugins/semantic-search/src/sdk/documents.ts | Adds document-versioned fingerprints and optional integration metadata to indexed tool documents. |
| packages/plugins/semantic-search/src/sdk/collections.ts | Extends recovery rows with multiple pending deletion IDs while preserving legacy-row decoding. |
| packages/plugins/semantic-search/src/api/group.ts | Extends the reindex response schema with an optional per-item failure count. |
| packages/plugins/semantic-search/src/sdk/tool-search-backend.ts | Extends the refresh-result contract with the optional failure count. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
Q[Tool search request] --> S[Cloudflare AI Search]
S --> V[Validate namespace and path]
V --> D[Deduplicate by canonical tool path]
D --> P[Return paged results]
R[Reindex request] --> M[Load manifests and optional integration context]
M --> U[Upload changed documents independently]
U --> L[Persist replacement rows]
L --> C[Delete deferred provider items]
C --> F[Persist failed deletions for retry]
Reviews (4): Last reviewed commit: "fix(semantic-search): retain all deferre..." | Re-trigger Greptile
Persist replacement rows before retiring previous AI Search items, retry deferred cleanup safely, and continue indexing when optional integration context is unavailable.
Keep errored and outdated AI Search items recoverable until the replacement row is persisted, then retire all superseded remote items.
aryasaatvik
added a commit
that referenced
this pull request
Aug 23, 2026
## Summary Keep Cloudflare AI Search authoritative for semantic tool discovery while making the indexed catalog resilient to integration changes, stale provider state, and individual upload failures. ## Flow ```text tools.search(query, namespace) -> AI Search native hybrid retrieval + reranking -> stable path and namespace validation -> best chunk per tool -> paged tool results reindex batch -> manifest + integration context -> enriched AI Search document -> per-item upload result -> local recovery/status ledger ``` ## Changes - Add integration name, purpose, URL, and a document-versioned fingerprint to indexed tool documents. - Lower the native AI Search retrieval/reranking threshold for short catalog queries without adding lexical fallback or client-side reranking. - Treat the local upload ledger as recovery/status state rather than query visibility; AI Search metadata remains the query authority. - Preserve integration-prefix filters and canonical path deduplication. - Keep replaced remote items until their replacement completes, and isolate per-item reindex failures so one tool cannot abort a page. ## Validation - `bun run --cwd packages/plugins/semantic-search test -- src/sdk/ai-search.test.ts` — 18 passed. - `bunx vitest run --exclude src/sdk/store-fts-d1.test.ts` — 92 passed. - `bun run --cwd packages/plugins/semantic-search typecheck` — passed. - `bunx oxfmt --check <six changed files>` — passed. - `bunx oxlint -c .oxlintrc.jsonc <six changed files> --deny-warnings` — passed. The package-wide test run still has the known 10 `better-sqlite3` D1 FTS failures caused by the local Node ABI mismatch (`137` vs `147`). The repository-wide typecheck also reaches the changed package successfully but stops on the existing SVG module-declaration errors in `plugin-toolkits`. ## Follow-up Deployment, reindex execution, and live MCP validation are intentionally separate from this reviewable source change.
aryasaatvik
added a commit
that referenced
this pull request
Aug 27, 2026
## Summary Keep Cloudflare AI Search authoritative for semantic tool discovery while making the indexed catalog resilient to integration changes, stale provider state, and individual upload failures. ## Flow ```text tools.search(query, namespace) -> AI Search native hybrid retrieval + reranking -> stable path and namespace validation -> best chunk per tool -> paged tool results reindex batch -> manifest + integration context -> enriched AI Search document -> per-item upload result -> local recovery/status ledger ``` ## Changes - Add integration name, purpose, URL, and a document-versioned fingerprint to indexed tool documents. - Lower the native AI Search retrieval/reranking threshold for short catalog queries without adding lexical fallback or client-side reranking. - Treat the local upload ledger as recovery/status state rather than query visibility; AI Search metadata remains the query authority. - Preserve integration-prefix filters and canonical path deduplication. - Keep replaced remote items until their replacement completes, and isolate per-item reindex failures so one tool cannot abort a page. ## Validation - `bun run --cwd packages/plugins/semantic-search test -- src/sdk/ai-search.test.ts` — 18 passed. - `bunx vitest run --exclude src/sdk/store-fts-d1.test.ts` — 92 passed. - `bun run --cwd packages/plugins/semantic-search typecheck` — passed. - `bunx oxfmt --check <six changed files>` — passed. - `bunx oxlint -c .oxlintrc.jsonc <six changed files> --deny-warnings` — passed. The package-wide test run still has the known 10 `better-sqlite3` D1 FTS failures caused by the local Node ABI mismatch (`137` vs `147`). The repository-wide typecheck also reaches the changed package successfully but stops on the existing SVG module-declaration errors in `plugin-toolkits`. ## Follow-up Deployment, reindex execution, and live MCP validation are intentionally separate from this reviewable source change.
aryasaatvik
added a commit
that referenced
this pull request
Aug 28, 2026
## Summary Keep Cloudflare AI Search authoritative for semantic tool discovery while making the indexed catalog resilient to integration changes, stale provider state, and individual upload failures. ## Flow ```text tools.search(query, namespace) -> AI Search native hybrid retrieval + reranking -> stable path and namespace validation -> best chunk per tool -> paged tool results reindex batch -> manifest + integration context -> enriched AI Search document -> per-item upload result -> local recovery/status ledger ``` ## Changes - Add integration name, purpose, URL, and a document-versioned fingerprint to indexed tool documents. - Lower the native AI Search retrieval/reranking threshold for short catalog queries without adding lexical fallback or client-side reranking. - Treat the local upload ledger as recovery/status state rather than query visibility; AI Search metadata remains the query authority. - Preserve integration-prefix filters and canonical path deduplication. - Keep replaced remote items until their replacement completes, and isolate per-item reindex failures so one tool cannot abort a page. ## Validation - `bun run --cwd packages/plugins/semantic-search test -- src/sdk/ai-search.test.ts` — 18 passed. - `bunx vitest run --exclude src/sdk/store-fts-d1.test.ts` — 92 passed. - `bun run --cwd packages/plugins/semantic-search typecheck` — passed. - `bunx oxfmt --check <six changed files>` — passed. - `bunx oxlint -c .oxlintrc.jsonc <six changed files> --deny-warnings` — passed. The package-wide test run still has the known 10 `better-sqlite3` D1 FTS failures caused by the local Node ABI mismatch (`137` vs `147`). The repository-wide typecheck also reaches the changed package successfully but stops on the existing SVG module-declaration errors in `plugin-toolkits`. ## Follow-up Deployment, reindex execution, and live MCP validation are intentionally separate from this reviewable source change.
aryasaatvik
added a commit
that referenced
this pull request
Aug 29, 2026
## Summary Keep Cloudflare AI Search authoritative for semantic tool discovery while making the indexed catalog resilient to integration changes, stale provider state, and individual upload failures. ## Flow ```text tools.search(query, namespace) -> AI Search native hybrid retrieval + reranking -> stable path and namespace validation -> best chunk per tool -> paged tool results reindex batch -> manifest + integration context -> enriched AI Search document -> per-item upload result -> local recovery/status ledger ``` ## Changes - Add integration name, purpose, URL, and a document-versioned fingerprint to indexed tool documents. - Lower the native AI Search retrieval/reranking threshold for short catalog queries without adding lexical fallback or client-side reranking. - Treat the local upload ledger as recovery/status state rather than query visibility; AI Search metadata remains the query authority. - Preserve integration-prefix filters and canonical path deduplication. - Keep replaced remote items until their replacement completes, and isolate per-item reindex failures so one tool cannot abort a page. ## Validation - `bun run --cwd packages/plugins/semantic-search test -- src/sdk/ai-search.test.ts` — 18 passed. - `bunx vitest run --exclude src/sdk/store-fts-d1.test.ts` — 92 passed. - `bun run --cwd packages/plugins/semantic-search typecheck` — passed. - `bunx oxfmt --check <six changed files>` — passed. - `bunx oxlint -c .oxlintrc.jsonc <six changed files> --deny-warnings` — passed. The package-wide test run still has the known 10 `better-sqlite3` D1 FTS failures caused by the local Node ABI mismatch (`137` vs `147`). The repository-wide typecheck also reaches the changed package successfully but stops on the existing SVG module-declaration errors in `plugin-toolkits`. ## Follow-up Deployment, reindex execution, and live MCP validation are intentionally separate from this reviewable source change.
aryasaatvik
added a commit
that referenced
this pull request
Aug 29, 2026
## Summary Keep Cloudflare AI Search authoritative for semantic tool discovery while making the indexed catalog resilient to integration changes, stale provider state, and individual upload failures. ## Flow ```text tools.search(query, namespace) -> AI Search native hybrid retrieval + reranking -> stable path and namespace validation -> best chunk per tool -> paged tool results reindex batch -> manifest + integration context -> enriched AI Search document -> per-item upload result -> local recovery/status ledger ``` ## Changes - Add integration name, purpose, URL, and a document-versioned fingerprint to indexed tool documents. - Lower the native AI Search retrieval/reranking threshold for short catalog queries without adding lexical fallback or client-side reranking. - Treat the local upload ledger as recovery/status state rather than query visibility; AI Search metadata remains the query authority. - Preserve integration-prefix filters and canonical path deduplication. - Keep replaced remote items until their replacement completes, and isolate per-item reindex failures so one tool cannot abort a page. ## Validation - `bun run --cwd packages/plugins/semantic-search test -- src/sdk/ai-search.test.ts` — 18 passed. - `bunx vitest run --exclude src/sdk/store-fts-d1.test.ts` — 92 passed. - `bun run --cwd packages/plugins/semantic-search typecheck` — passed. - `bunx oxfmt --check <six changed files>` — passed. - `bunx oxlint -c .oxlintrc.jsonc <six changed files> --deny-warnings` — passed. The package-wide test run still has the known 10 `better-sqlite3` D1 FTS failures caused by the local Node ABI mismatch (`137` vs `147`). The repository-wide typecheck also reaches the changed package successfully but stops on the existing SVG module-declaration errors in `plugin-toolkits`. ## Follow-up Deployment, reindex execution, and live MCP validation are intentionally separate from this reviewable source change.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Keep Cloudflare AI Search authoritative for semantic tool discovery while making the indexed catalog resilient to integration changes, stale provider state, and individual upload failures.
Flow
Changes
Validation
bun run --cwd packages/plugins/semantic-search test -- src/sdk/ai-search.test.ts— 18 passed.bunx vitest run --exclude src/sdk/store-fts-d1.test.ts— 92 passed.bun run --cwd packages/plugins/semantic-search typecheck— passed.bunx oxfmt --check <six changed files>— passed.bunx oxlint -c .oxlintrc.jsonc <six changed files> --deny-warnings— passed.The package-wide test run still has the known 10
better-sqlite3D1 FTS failures caused by the local Node ABI mismatch (137vs147). The repository-wide typecheck also reaches the changed package successfully but stops on the existing SVG module-declaration errors inplugin-toolkits.Follow-up
Deployment, reindex execution, and live MCP validation are intentionally separate from this reviewable source change.