Skip to content

Fixes GitKraken AI model selection showing 'No models found'#5038

Open
shoaib-fixes wants to merge 1 commit intogitkraken:mainfrom
shoaib-fixes:bug/#4963-gitkraken-ai-no-models
Open

Fixes GitKraken AI model selection showing 'No models found'#5038
shoaib-fixes wants to merge 1 commit intogitkraken:mainfrom
shoaib-fixes:bug/#4963-gitkraken-ai-no-models

Conversation

@shoaib-fixes
Copy link
Copy Markdown

@shoaib-fixes shoaib-fixes commented Mar 15, 2026

Fixes #4963

Description

When selecting the GitKraken AI provider in the Switch AI Provider/Model... picker, the model dropdown was always empty when selecting copilot as the provider. Tracked it down to GitKrakenProvider.getModels() — the whole method body was wrapped in a try/catch that silently returned [] on any error (auth failures, HTTP errors, bad responses). There was no way to tell whether models just didn't exist or something had actually gone wrong.

  • Removes silent error swallowing in GitKrakenProvider.getModels() — errors now propagate so callers can handle them
  • Checks for a valid auth token via getApiKey before making the API request, returning [] early if unauthenticated
  • Passes the access token explicitly to getGkHeaders() instead of relying on the internal lookup that could throw AuthenticationRequiredError silently
  • Adds a null guard on result.data to handle missing/null API response fields
  • Removes a leftover debugger statement
  • Catches getModels() errors in showAIModelPicker and shows 'Unable to load models' with the error description instead of the generic 'No models found'
  • Adds a defensive try/catch in getOrUpdateModel around the getModels() call used to restore a previously configured model at startup

Screenshots showing model selection from copilot:

Screenshot from 2026-03-15 22-48-22 Screenshot from 2026-03-15 22-48-44

Checklist

  • I have followed the guidelines in the Contributing document
  • My changes follow the coding style of this project
  • My changes build without any errors or warnings
  • My changes have been formatted and linted
  • My changes include any required corresponding changes to the documentation (including CHANGELOG.md and README.md)
  • My changes have been rebased and squashed to the minimal number (typically 1) of relevant commits
  • My changes have a descriptive commit message with a short title, including a Fixes $XXX - or Closes #XXX - prefix to auto-close the issue that your PR addresses

…itkraken#4963

- Removes silent error swallowing in GitKrakenProvider.getModels() — errors now propagate so callers can handle them
- Checks for a valid auth token (getApiKey) before making the API request, returning [] early if unauthenticated
- Passes the access token explicitly to getGkHeaders() instead of relying on the internal lookup that threw AuthenticationRequiredError silently
- Adds null guard for result.data to handle missing/null API response fields
- Removes leftover debugger statement
- Catches getModels() errors in showAIModelPicker and shows 'Unable to load models' with the error description instead of the generic 'No models found'
- Adds defensive try/catch in getOrUpdateModel for getModels() call used to restore a previously configured model
@shoaib-fixes shoaib-fixes force-pushed the bug/#4963-gitkraken-ai-no-models branch from 32ec7ac to f708219 Compare March 15, 2026 23:24
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.

'No models found' is displayed in the AI model selection dropdown

1 participant