Repository navigation
fix(plugins): stop sending the search index with every ask ai question - #480
Conversation
askAi defaulted indices to [indexName], so DocSearch's side panel sent algolia.indices on every question. Agent Studio rejects per-request indices when the agent's search tool is in static mode (422 StaticToolRejectsPerRequestIndicesError), and Ask AI showed a chat error for every question. indices is now sent only when askAi.indices is set. Without it, the agent searches the indices configured on its tool.
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
There was a problem hiding this comment.
ℹ️ No critical issues — one small test gap inline.
Reviewed changes
Reviewed the full diff (mode: standard) — the Ask AI indices default removal in @docubook/plugin-search-algolia, plus its docs, test and changeset.
resolveAskAistops defaultingindices— both the agent ID string form and the object form now omitindicesunlessaskAi.indicesis set. I checked this against@docsearch/sidepanel-js5.2.0:getAgentStudioTransportonly setsalgoliaParams.indiceswhenindices && indices.length > 0, so passingundefinedthroughsrc/client/index.ts:170drops the field from the request as intended.ClientAssistantConfig.indiceswas already optional, so no type change is needed.resolveAskAisignature — dropped the unusedindexName.resolveOptionsstill passes the widersearchobject, and that type-checks structurally.- Docs and JSDoc — the
indicesrow inalgolia.mdxand theAskAiOptions.indicescomment now explain thestatic/dynamicconstraint. No other "defaults toindexName" text is left in the repo. - Changeset — standalone patch for the plugin. It is not in the
linkedgroup, so no other package versions.
Overall assessment: READY. Top priorities: (1) add a regression test for the object form without indices. Nothing else blocks.
claude-opus-5-5 | 𝕏
Cover the object form of askAi without indices, so restoring the old [indexName] default fails the suite.
There was a problem hiding this comment.
✅ No new issues found. The earlier test gap is closed.
Reviewed changes
Reviewed 1834ee2, the only commit since the last review (mode: standard). It changes tests only.
- Added an object-form regression test.
options.test.ts:54-57now checks thatresolveOptionswithaskAi: { agentId }and noindicesgives anassistantwithout anindicesproperty. That covers the second branch the fix changed (options.ts:214). The author confirmed the test fails when the old?? [indexName]default is restored.
Overall assessment: READY. No open priorities.
claude-opus-5-5 | 𝕏

Summary
Ask AI on docubook.pro answered every question with:
Cause
resolveOptionsdefaultedaskAi.indicesto[indexName], both for the agent-ID string form and for the object form.@docsearch/sidepanel-js5.2.0 addsalgolia.indicesto the completions request whenever that array is non-empty. Agent Studio answers that request with422 StaticToolRejectsPerRequestIndicesErrorwhen the agent's search tool is instaticmode, which is the case for the docs site's agent.Fix
indicesis now set only whenaskAi.indicesis given. Without it,algolia.indicesis not sent, and the agent searches the indices configured on its tool.askAi.indicesonly for an agent whose search tool is indynamicmode. The option's JSDoc and theindicesrow on the Algolia docs page now say so.resolveAskAino longer takesindexName.@docubook/plugin-search-algoliapatch, which will be 0.1.1.Verification
"algolia":{"indices":["docsearch_docubook"]}and gets HTTP 422 with the error above.algolia.indicesreturns HTTP 200. The agent calls its ownalgolia_search_index_docsearch_docubooktool, findssearch/algolia#install, and streams an answer.vercel.json.indices. Asking "How do I install the Algolia plugin?" sends"algolia":{}and gets HTTP 200.Searched for "install Algolia plugin"and an answer. There is no chat error and no page error.indicesfor the agent-ID form and, since 1834ee2, for the object form withoutindices. The object-form test fails when the old default is restored. Plugin tests (36),tsc,oxlint, Prettier andscripts/check-release-plan.mjs(6 scenarios) pass.After merge
The release workflow opens a Release PR for
@docubook/plugin-search-algolia0.1.1, published through trusted publishing. The docs site picks it up through its^0.1.0range on the next lockfile update. pnpm's release-age window applies to 0.1.1 too, so either wait about 24h before bumping the lockfile, or add a pinnedminimumReleaseAgeExcludeentry.Until 0.1.1 is live, switching the agent's search tool to
dynamicmode in Agent Studio also fixes Ask AI on docubook.pro.