fix: robust provider handling when credentials are misconfigured#10080
Merged
catrielmuller merged 5 commits intomainfrom May 8, 2026
Merged
fix: robust provider handling when credentials are misconfigured#10080catrielmuller merged 5 commits intomainfrom
catrielmuller merged 5 commits intomainfrom
Conversation
Contributor
Code Review SummaryStatus: 1 Issue Found | Recommendation: Address before merge Overview
Issue Details (click to expand)No new inline issues found in the incremental diff. Other Observations (not in diff)Issues found in unchanged code that cannot receive inline comments:
Files Reviewed (8 files)
Reviewed by gpt-5.5-2026-04-23 · 970,621 tokens |
kirillk
approved these changes
May 8, 2026
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.
Context
https://kilo-code.slack.com/archives/C09GD7US2UB/p1778004884354009
When a provider (e.g. Kilo Gateway) is configured with wrong credentials, the CLI was printing raw error messages to stdout before the TUI started, and the
/connectdialog was hiding the failed provider so users couldn't reconnect with new credentials.Three problems are fixed:
kilocodeOrganizationId), models were silently empty and the provider was dropped from the UI entirely./connectdidn't show already-connected providers that had failed, making it impossible to re-enter credentials.Implementation
Silent errors (
packages/kilo-gateway/)fetchKiloModelsnow returns a typedKiloModelsResult = { models, error? }instead of throwing or callingconsole.error. Network/auth failures are surfaced as a discriminated error kind without printing to stdout.modes.ts: removed allconsole.warncalls — failures silently return[].bootstrap.ts: downgraded the"bootstrapping"log fromlogInfotologDebugso it no longer appears in the TUI on every startup.401 fallback (
packages/kilo-gateway/src/api/models.ts)fetchKiloModelsautomatically retries against the public unauthenticated endpoint. The provider stays usable with the public model list while the user re-authenticates.Per-provider failure state (
packages/opencode/src/provider/model-cache.ts)ModelCachetracks which providers have a fetch error viafailedProviders()/getFailure().clear()also resets failure state.Provider list route (
provider.ts+ httpapi handler)provider_next.allso/connectcan list it.failed: string[](provider IDs with fetch errors).Provider.ListResultschema updated; both Hono and Effect HttpApi routes updated for parity./connectdialog TUI!gutter indicator and(reconnect)description suffix, implemented in the Kilo-isolated override (src/kilocode/cli/cmd/tui/component/dialog-provider.tsx) and consumed via a singlekilocode_changein the upstream file.SDK + story fixture
packages/sdk/js/src/gen/types.gen.ts: addedfailed: Array<string>toProviderListResponses.packages/kilo-vscode/webview-ui/src/stories/history.stories.tsx: addedfailed: []to the story fixture to match the updated type.Tests
packages/kilo-gateway/test/api/models.test.ts— 5 tests for typed result and 401 fallback (lives in gateway package to avoid Bun mock.module cross-contamination).packages/opencode/test/kilocode/kilo-models-401-fallback.test.ts— integration:ModelCachecorrectly surfaces 401 errors from the gateway.packages/opencode/test/kilocode/provider-list-failed-state.test.ts— 5 tests forfailedProviders()/getFailure()lifecycle.kilo-loader-auth.test.tsandmodel-cache-org.test.tsto use the new{ models }return shape.packages/opencode/AGENTS.md— added Fork Isolation Rule documenting the mirror-file pattern.Screenshots
!and(reconnect)in /connectHow to Test
kilocodeOrganizationId(e.g. viakilo.jsonprovider.kilo.options.kilocodeOrganizationId = "bad-org").kilo— no error output should appear in the terminal on startup./connect— the Kilo provider should appear with a red!and(reconnect)description.!should disappear.Get in Touch
catrielmuller on Discord.