bug(web-search): custom auth:none is blocked by the Settings test key gate
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 4k
- Forks
- 453
- Avg merge
- 12h 30m
- Merged PRs (30d)
- 46
Description
UI-related note: this touches the Settings/UI path and may be lower priority during the ongoing frontend refactor.
Summary
Custom web search with customProvider.auth: none is valid at runtime and in the backend test route, but the Settings UI still requires a non-empty API key before enabling or running the Test action.
Why it matters
A user can reasonably configure an internal or public custom search endpoint with no authentication: provider: custom, auth: none, an endpoint, and an empty API key. The actual runtime accepts that configuration, but Settings disables the Test button and handleTest exits early. This makes a valid runtime configuration look broken from the UI.
Evidence
src/tool/builtin/webSearch.ts:93documents that an API key is not required when custom auth isnone.src/tool/builtin/webSearch.ts:142only throws setup-required when there is no key and the provider is notcustomwithauth === "none".src/tool/builtin/webSearch.ts:497tosrc/tool/builtin/webSearch.ts:507only inject authentication forbearer,queryApiKey, orbodyApiKey;nonesends no auth header/key.ui/server/routes/config.js:313defines/test-web-search.ui/server/routes/config.js:323allows an empty key forselectedProvider === 'custom' && customAuth === 'none'.ui/src/components/settings/view/tabs/PilotDeckConfigTab.tsx:471defineshasUsableSecret.ui/src/components/settings/view/tabs/PilotDeckConfigTab.tsx:2002toui/src/components/settings/view/tabs/PilotDeckConfigTab.tsx:2008exits before testing wheneverhasUsableSecret(apiKey)is false.ui/src/components/settings/view/tabs/PilotDeckConfigTab.tsx:2170disables the Test button whenever!hasUsableSecret(apiKey).
Validation
Validation level: dynamic runtime reproduction plus frontend control-flow confirmation.
Reproduction method: executed createWebSearchTool({ provider: "custom", customProvider: { auth: "none" }, apiKey: "" }) with a mocked fetch implementation.
Key output:
{
"organicCount": 1,
"hasAuthorization": false,
"requestBody": {
"query": "pilotdeck"
}
}
This confirms the runtime can execute custom/no-auth search without an API key and without adding an Authorization header.
Boundary: I did not run a full browser DOM click test. The UI failure is confirmed from the Settings control flow: the button is disabled and handleTest returns before reaching the backend route.
Expected behavior
Settings should allow Test for provider: custom when customProvider.auth === "none" and an endpoint is present, even if apiKey is empty. Providers and auth modes that require a key should continue to block empty keys.
Existing coverage checked
Checked existing coverage around test-web-search, customProvider auth none, hasUsableSecret webSearch, and web search apiKey custom.
PR #182 handles a friendly prompt for unconfigured web_search, but it does not change the Settings Test key gate for custom/auth:none, so it does not cover this root cause.
Suggested fix
Add a shared predicate such as requiresWebSearchApiKey(provider, customProvider).
- Return
falseonly forprovider === "custom"andcustomProvider.auth === "none". - In
handleTest, allow an empty key when the predicate says no key is required. - Change the Test button disabled condition to something like
testStatus === "testing" || (requiresKey && !hasUsableSecret(apiKey)). - Keep endpoint validation separate, because custom/no-auth still needs a usable endpoint.
Suggested tests
- Settings UI:
custom + auth:none + empty apiKey + endpointkeeps Test enabled and calls/test-web-search. - Settings UI:
custom + bearer/queryApiKey/bodyApiKey + empty apiKeystill blocks Test. - Settings UI:
glmandtavilywith empty keys still block Test. - Server route regression:
/test-web-searchacceptscustom/auth:nonewith an empty key.
Submitted with Codex.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in ui/src/components/settings/view/tabs/PilotDeckConfigTab.tsx at hasUsableSecret, handleTest, and the Test button condition, then compare the server behavior in ui/server/routes/config.js and runtime rules in src/tool/builtin/webSearch.ts. Add coverage for custom/auth:none with an empty key and endpoint, while confirming key-requiring providers remain blocked; done means the Settings Test action reaches /test-web-search only when its authentication and endpoint requirements are met.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- backend, frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 72/100