Skip to content

fix(plugins): stop sending the search index with every ask ai question - #480

Merged
gitfromwildan merged 2 commits into
mainfrom
fix/plugin-askai-indices
Nov 6, 2026
Merged

gitfromwildan merged 2 commits into
mainfrom
fix/plugin-askai-indices

Conversation

@gitfromwildan

@gitfromwildan gitfromwildan commented Nov 6, 2026 •

Copy link
Copy Markdown
Member

Summary

Ask AI on docubook.pro answered every question with:

Chat error: Tool 'algolia_search_index' is configured with mode='static' and does not accept a per-request algolia.indices override. Set the tool's mode to 'dynamic' on the agent configuration, or omit algolia.indices from the request.

Cause

resolveOptions defaulted askAi.indices to [indexName], both for the agent-ID string form and for the object form. @docsearch/sidepanel-js 5.2.0 adds algolia.indices to the completions request whenever that array is non-empty. Agent Studio answers that request with 422 StaticToolRejectsPerRequestIndicesError when the agent's search tool is in static mode, which is the case for the docs site's agent.

Fix

  • indices is now set only when askAi.indices is given. Without it, algolia.indices is not sent, and the agent searches the indices configured on its tool.
  • Set askAi.indices only for an agent whose search tool is in dynamic mode. The option's JSDoc and the indices row on the Algolia docs page now say so.
  • resolveAskAi no longer takes indexName.
  • Changeset: @docubook/plugin-search-algolia patch, which will be 0.1.1.

Verification

  • Reproduced on docubook.pro in headless Chromium. Ask AI posts "algolia":{"indices":["docsearch_docubook"]} and gets HTTP 422 with the error above.
  • Direct API call. The same completions request without algolia.indices returns HTTP 200. The agent calls its own algolia_search_index_docsearch_docubook tool, finds search/algolia#install, and streams an answer.
  • End to end.
    • Setup: a temp project with flame 2.5.0 and this branch's plugin build, with the docs site's credentials and agent. The built HTML was served with the CSP from vercel.json.
    • The provider config has no indices. Asking "How do I install the Algolia plugin?" sends "algolia":{} and gets HTTP 200.
    • The panel shows Searched for "install Algolia plugin" and an answer. There is no chat error and no page error.
  • Checks. The options tests expect no indices for the agent-ID form and, since 1834ee2, for the object form without indices. The object-form test fails when the old default is restored. Plugin tests (36), tsc, oxlint, Prettier and scripts/check-release-plan.mjs (6 scenarios) pass.

After merge

The release workflow opens a Release PR for @docubook/plugin-search-algolia 0.1.1, published through trusted publishing. The docs site picks it up through its ^0.1.0 range 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 pinned minimumReleaseAgeExclude entry.

Until 0.1.1 is live, switching the agent's search tool to dynamic mode in Agent Studio also fixes Ask AI on docubook.pro.

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.
@vercel

vercel Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
docu Ignored Ignored Preview Nov 6, 2026 3:43am UTC

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ 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.

  • resolveAskAi stops defaulting indices — both the agent ID string form and the object form now omit indices unless askAi.indices is set. I checked this against @docsearch/sidepanel-js 5.2.0: getAgentStudioTransport only sets algoliaParams.indices when indices && indices.length > 0, so passing undefined through src/client/index.ts:170 drops the field from the request as intended. ClientAssistantConfig.indices was already optional, so no type change is needed.
  • resolveAskAi signature — dropped the unused indexName. resolveOptions still passes the wider search object, and that type-checks structurally.
  • Docs and JSDoc — the indices row in algolia.mdx and the AskAiOptions.indices comment now explain the static/dynamic constraint. No other "defaults to indexName" text is left in the repo.
  • Changeset — standalone patch for the plugin. It is not in the linked group, so no other package versions.

Overall assessment: READY. Top priorities: (1) add a regression test for the object form without indices. Nothing else blocks.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using claude-opus-5-5 | 𝕏

@gitfromwildan gitfromwildan self-assigned this Nov 6, 2026
Cover the object form of askAi without indices, so restoring the old [indexName] default fails the suite.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ 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-57 now checks that resolveOptions with askAi: { agentId } and no indices gives an assistant without an indices property. 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.

Pullfrog  | View workflow run | Using claude-opus-5-5 | 𝕏

@gitfromwildan
gitfromwildan merged commit b29ab09 into main Nov 6, 2026
15 checks passed
@gitfromwildan
gitfromwildan deleted the fix/plugin-askai-indices branch November 6, 2026 03:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant