Keep the global configuration unchanged when an update is rejected #12817
All Vouch review confidence checks passed
Residual risk 0.24 = Change Risk (0.60) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.60 · 214 lines diff across 2 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.321
Shallow Review Depth
shallow_review_depth
0.289
Sensitive Paths
sensitive_paths
0.060
Real PR Conversation Timeline
1 comments
"Review active on #12817"
general
weight: 0.35
RAMitchell
XGBSetGlobalConfigwrites new values into the global configuration before validating them. When validation fails, the call returns an error but the rejected values stay in place:It's worse with
use_cuda_async_poolon a machine without a usable GPU, for example the PyPI wheel on a CPU-only host. The rejected flag stays set, so every laterset_config/config_contextcall fails, including the context the sklearn estimators enter whenverbosityis set:config_contextcan't restore the previous configuration either, because the failure happens while entering it.This PR applies the update to a copy of the configuration and commits it only after validation passes;
nthreadis applied after validation as well. Valid updates behave as before. A Python test checks that a rejectedset_config/config_contextleavesget_config()unchanged; it fails without the fix.Tested on Linux x86_64 with a CPU build of master:
tests/python/test_config.py,test_basic.py,test_callback.py,test_openmp.pyandtest_with_sklearn.pypass (excepttest_sklearn_plotting, which needs the Graphviz executable), and pre-commit and mypy pass on the changed files. I didn't run the C++ gtests;TEST(CAPI, XGBGlobalConfig)only checks return codes and error messages.