Skip to content

fix: let a folder turn explanation off, or on with its own provider - #256

Merged
shenxianpeng merged 1 commit into
mainfrom
bugfix/folder-explanation-switch
Oct 14, 2026
Merged

shenxianpeng merged 1 commit into
mainfrom
bugfix/folder-explanation-switch

Conversation

@shenxianpeng

@shenxianpeng shenxianpeng commented Oct 14, 2026 •

Copy link
Copy Markdown
Member

Description

A folder's settings did not decide whether its jobs are explained.

  • A folder could not turn explanation off. The box at the top of the folder's section, Enable AI Error Explanation, only opens the section. Left unticked, which it is by default, the folder sets nothing and its jobs follow the global switch. Builds in a folder that looked switched off were still sent to the provider.
  • A folder with a provider of its own had no Explain Error button while the global switch was off. The console page's endpoint refused with "disabled in global configuration", although explainError() and automatic explanation in the same folder used the folder's provider.

Now:

  • The folder section has Turn off AI error explanation for jobs in this folder. With it there is no button, no automatic explanation, and explainError() does nothing. Explanations builds already have can still be read.
  • The box that opens the section is renamed Set AI error explanation for this folder, which is what it does.
  • The nearest folder that decides wins: one that turns explanation off says no, one with a provider of its own says yes. Otherwise the global switch applies.
  • The console and Stages pages and their endpoints ask that question for the build in front of them. A folder with its own provider gets the button while the global switch is off, and the provider named on the button is the folder's.

Before and after

The folder's section

Before After
Before: the folder's Properties show an unticked Enable AI Error Explanation box After: the box is called Set AI error explanation for this folder, and inside it Turn off AI error explanation for jobs in this folder is ticked
Unticked by default, so the folder looks switched off. It is not. The box says what it does, and turning explanation off is its own setting.

A failed build in that folder, global switch on

Before After
Before: the console page has an Explain Error button and shows an explanation from the global provider After: the console page has no Explain Error button
The button is there and the log goes to the global provider. No button. The endpoint answers "AI error explanation is turned off for this job.", and automatic explanation skips the build.

A failed build in a folder with its own provider, global switch off

Before After
Before: the console page has no Explain Error button After: the console page shows an explanation; its footer names the folder's model, mobile-team-model
No button, while explainError() in the same folder works. The button is there, and the explanation comes from the folder's provider (its model, mobile-team-model, is in the footer).

The screenshots use a local stand-in provider with canned answers.

Things a reviewer should know

  • No folder changes behaviour on upgrade. enableExplanation keeps its stored meaning: "the section is in use". Every folder whose Configure page was saved before 216 has it stored as false, so giving that value the meaning "off" would have switched those folders off. Turning off is a new field, disableExplanation.
  • A subfolder can turn explanation on again below a folder that turned it off, by setting a provider of its own. This follows the rule the plugin already had: a folder provider wins over the global switch being off. If an off folder should be final for everything below it, that is a small change in ExplainErrorFolderProperty.findFolderDecision.
  • One edge case changes. A folder whose section is unused but that has a provider stored, which an older form did by accident (fix: stop the folder form from saving a provider nobody chose #243), used to stop the provider lookup, so its jobs got the global provider even under a parent folder with its own. The lookup now passes over it, as the enabled check already did, and the parent's provider applies.
  • The console endpoint's refusal now reads "AI error explanation is turned off for this job." instead of "AI error explanation is disabled in global configuration.", since it may come from a folder.
  • The global setting keeps its label, Enable AI Error Explanation; only the folder's box is renamed.
  • ExplainErrorFolderProperty.isFolderExplanationEnabled is unused and kept as it was.

Related Issues

None; found while reviewing what to fix next.

Testing done

  • FolderExplanationSwitchTest, 10 new tests: a folder turning explanation off while it is on globally (explainer, console page and endpoint, explainError(), automatic explanation); a folder with its own provider while it is off globally (console page and endpoint, Graph View endpoint); the nearest folder deciding in both directions; folders stored before keeping the global switch; an unused section passing the parent's provider on; the switch saved through the folder form.
  • Existing test classes pass: ExplainErrorFolderPropertyTest, ErrorExplainerTest, ConsolePageDecoratorTest, ConsoleExplainErrorActionTest, GraphViewExplainErrorActionTest, PipelineGraphViewDecoratorTest, AutoExplainJobOverrideTest, AutoExplainLimitsTest, ErrorRunListenerTest, ExplainCardStatesTest, ConsoleToolbarTest, CasCTest, ConfigMigrationTest, ExplainErrorStepTest, ExplanationReuseTest, UsageTrackingTest, QuotaEnforcerTest.
  • SpotBugs: no findings. The full mvn verify was not run locally.

By hand, on a local Jenkins 2.528.3 with a stand-in provider that counts its requests, the same folders before and after:

Checked Before (main) After
A folder meant to be off, global on: console of a failed build Box left unticked, as off as the form allowed: button, explained by the global provider Turned off on the form: no button; the endpoint refuses; 0 requests
Same folder, automatic explanation on Not checked Not explained, nothing in the build log, 0 requests
Same folder, a build explained before it was turned off Not applicable Explanation still shown, no re-explain control
Folder with its own provider, global off: console of a failed build No button; the endpoint refuses Button; explained by the folder's provider

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

Was generative AI tooling used to co-author this PR?
  • Yes (please specify below)

Assisted-by: Claude Code (claude-opus-5-5)

A folder's settings did not decide whether its jobs were explained.

Turning explanation off for a folder was not possible. The box at the
top of the folder's section, "Enable AI Error Explanation", only opens
the section: left unticked, which it is by default, the folder sets
nothing and its jobs follow the global switch. So did a folder stored
with it unticked, which every folder saved before 216 is. Builds in
such a folder were still sent to the provider whenever the global
switch was on.

A folder with a provider of its own, on the other hand, had no Explain
Error button while the global switch was off, and the console page's
endpoint refused with "disabled in global configuration". Only the
explainError() step and automatic explanation used the folder's
provider.

Now:

- The folder section has "Turn off AI error explanation for jobs in
  this folder" (disableExplanation). With it, there is no button, no
  automatic explanation, and explainError() does nothing. Explanations
  builds already have can still be read.
- The box that opens the section is called "Set AI error explanation
  for this folder", which is what it does. Its stored meaning is
  unchanged, so no folder changes behaviour on upgrade.
- The nearest folder that decides wins: one that turns explanation off
  says no, one with a provider of its own says yes. Otherwise the
  global switch applies.
- The console and Stages pages, and their endpoints, ask the same
  question for the build in front of them, so a folder with its own
  provider gets the button while the global switch is off, and the
  provider name shown is the folder's.
- Looking up the folder provider now passes over a folder whose
  section is unused, like the enabled check already did. Before, such
  a folder with a provider stored by an older form stopped the search
  and the global provider was used even under a parent folder with
  its own.
@shenxianpeng
shenxianpeng requested a review from a team as a code owner October 14, 2026 18:03
@shenxianpeng shenxianpeng added the bug For changelog: Minor bug. Will be listed after features label Oct 14, 2026
@shenxianpeng
shenxianpeng merged commit ffceecc into main Oct 14, 2026
20 checks passed
@shenxianpeng
shenxianpeng deleted the bugfix/folder-explanation-switch branch October 14, 2026 22:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug For changelog: Minor bug. Will be listed after features

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant