Skip to content

Default global AI provider to OpenAI#137

Merged
shenxianpeng merged 2 commits intojenkinsci:mainfrom
donhui:default-openai-provider
Apr 8, 2026
Merged

Default global AI provider to OpenAI#137
shenxianpeng merged 2 commits intojenkinsci:mainfrom
donhui:default-openai-provider

Conversation

@donhui
Copy link
Copy Markdown
Member

@donhui donhui commented Apr 8, 2026

This PR aligns the implementation with the documented behavior by making OpenAI the default global AI provider when no provider has been configured yet.
It also adds regression coverage to ensure both the backend default and the Jenkins configuration UI stay consistent.

The README says OpenAI is the default AI provider.
Before this change, the code had no real default provider and could end up with no provider configured.
With this fix, runtime behavior and the configuration UI now match the documented expectation.

before:
image

after:
image

Testing done

Submitter checklist

  • Make sure you are opening from a topic/feature/bugfix branch (right side) and not your main branch!
  • Ensure that the pull request title represents the desired changelog entry
  • Please describe what you did
  • Link to relevant issues in GitHub or Jira
  • Link to relevant pull requests, esp. upstream and downstream changes
  • Ensure you have provided tests that demonstrate the feature works or the issue is fixed

@donhui donhui requested a review from a team as a code owner April 8, 2026 07:31
@shenxianpeng shenxianpeng requested a review from Copilot April 8, 2026 08:46
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR makes the plugin’s global configuration behave as documented by ensuring an OpenAI provider is used by default when no AI provider has been configured yet, and adds regression tests to keep backend behavior and the Jenkins “Configure System” UI in sync.

Changes:

  • Default GlobalConfigurationImpl to an OpenAIProvider when aiProvider is unset.
  • Introduce OpenAIProvider.DEFAULT_MODEL and use it as the OpenAI default model source of truth.
  • Add regression tests for backend defaulting and UI default provider selection.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
src/main/java/io/jenkins/plugins/explain_error/GlobalConfigurationImpl.java Implements defaulting logic for aiProvider in readResolve() when unconfigured.
src/main/java/io/jenkins/plugins/explain_error/provider/OpenAIProvider.java Centralizes the default model into a constant and reuses it in the descriptor.
src/test/java/io/jenkins/plugins/explain_error/GlobalConfigurationImplTest.java Adds backend + UI regression tests to verify OpenAI is the default when unconfigured.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@shenxianpeng shenxianpeng added the enhancement For changelog: Minor enhancement. use `major-rfe` for changes to be highlighted label Apr 8, 2026
@shenxianpeng shenxianpeng merged commit d968896 into jenkinsci:main Apr 8, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement For changelog: Minor enhancement. use `major-rfe` for changes to be highlighted

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants