Skip to content

Fix Cloudflare provider connect prompts in VS Code#10020

Open
mujtaba93 wants to merge 3 commits intoKilo-Org:mainfrom
mujtaba93:bugfix/9987
Open

Fix Cloudflare provider connect prompts in VS Code#10020
mujtaba93 wants to merge 3 commits intoKilo-Org:mainfrom
mujtaba93:bugfix/9987

Conversation

@mujtaba93
Copy link
Copy Markdown
Contributor

Context
Fixed a bug where the VS Code Settings → Providers → Connect dialog for Cloudflare Workers AI and Cloudflare AI Gateway only collected the API key, ignoring required fields (Account ID and Gateway ID). The TUI and upstream OpenCode handled this correctly, but the VS Code dialog was not rendering the provider-defined prompts.

Implementation
The fix involved four changes across the webview and extension:

  1. Message type (webview-messages.ts): Added optional metadata?: Record<string, string> field to ConnectProviderMessage to carry additional auth fields.
  2. UI Dialog (ProviderConnectDialog.tsx): Modified the ApiView component to:
  • Read prompts from the selected auth method
  • Render a TextField for each prompt before the API key field
  • Collect prompt values into a metadata object
  • Pass metadata to the backend on connect
  1. Extension Action (provider-actions.ts): Updated connectProvider to accept and forward metadata to the SDK's auth.set() call, which stores it as part of the ApiAuth type.
  2. Message Handler (KiloProvider.ts): Extract the metadata object from incoming messages and pass it to the action.

The root cause was that ProviderAuthMethod includes an optional prompts array that providers can use to request additional fields (e.g., Cloudflare's accountId and gatewayId), but the VS Code dialog was ignoring this array and only rendering the API key field.

How to Test

  1. Open VS Code with the Kilo extension
  2. Go to Settings → Providers
  3. Click "Connect" next to "Cloudflare Workers AI"
  4. Verify the dialog now shows a field for "Enter your Cloudflare Account ID" before the API key
  5. Test with "Cloudflare AI Gateway" - should show both Account ID and Gateway ID fields
  6. After connecting, invoke a cloudflare-workers-ai model and verify it works without the "CLOUDFLARE_ACCOUNT_ID is missing" error

@kilo-code-bot
Copy link
Copy Markdown
Contributor

kilo-code-bot Bot commented May 7, 2026

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (4 files)
  • packages/kilo-vscode/src/KiloProvider.ts
  • packages/kilo-vscode/src/provider-actions.ts
  • packages/kilo-vscode/webview-ui/src/components/settings/ProviderConnectDialog.tsx
  • packages/kilo-vscode/webview-ui/src/types/messages/webview-messages.ts

Reviewed by gpt-5.5-2026-04-23 · 1,429,085 tokens

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