Offline nodes become online after config reload

Jenkins setup:

Jenkins: 2.504.1
OS: Linux - 6.1.0-31-amd64
Java: 21.0.7 - Oracle Corporation (Java HotSpot™ 64-Bit Server VM)

ace-editor:1.1
ansicolor:1.0.6
ant:513.vde9e7b_a_0da_0f
antisamy-markup-formatter:173.v680e3a_b_69ff3
apache-httpcomponents-client-4-api:4.5.14-269.vfa_2321039a_83
asm-api:9.8-135.vb_2239d08ee90
bootstrap4-api:4.6.0-6
bootstrap5-api:5.3.5-1
bouncycastle-api:2.30.1.80-256.vf98926042a_9b_
branch-api:2.1217.v43d8b_b_d8b_2c7
build-name-setter:2.5.0
build-timeout:1.38
build-user-vars-plugin:195.v8c35f9d5c3dc
caffeine-api:3.2.0-166.v72a_6d74b_870f
checks-api:370.vb_61a_c57328f3
cloudbees-folder:6.1012.v79a_86a_1ea_c1f
command-launcher:123.v37cfdc92ef67
commons-compress-api:1.27.1-3
commons-lang3-api:3.17.0-87.v5cf526e63b_8b_
commons-text-api:1.13.0-153.v91dcd89e2a_22
conditional-buildstep:1.5.0
configuration-as-code:1967.va_968e15fd05b_
credentials:1415.v831096eb_5534
credentials-binding:687.v619cb_15e923f
data-tables-api:2.2.2-1
description-setter:264.v1957f215dcd5
display-url-api:2.209.v582ed814ff2f
durable-task:587.v84b_877235b_45
echarts-api:5.6.0-4
eddsa-api:0.3.0.1-19.vc432d923e5ee
editable-choice:71.v02a291ebbe45
email-ext:1876.v28d8d38315b_d
envinject:2.926.v69c9b_3896a_96
envinject-api:1.235.va_14c74f8f487
font-awesome-api:6.7.2-1
gearman-plugin:0.8.0
generic-webhook-trigger:2.3.1
gerrit-trigger:2.42.0
git:5.7.0
git-client:6.1.3
git-parameter:439.vb_0e46ca_14534
git-server:137.ve0060b_432302
github:1.43.0
github-api:1.321-488.v9b_c0da_9533f8
github-branch-source:1815.v9152b_2ff7a_1b_
github-oauth:651.v135e939e8b_60
gitlab-api:5.6.0-100.v83f8f4b_f1129
gitlab-oauth:1.22
gradle:2.14.1
gson-api:2.13.1-139.v4569c2ef303f
handlebars:3.0.8
instance-identity:203.v15e81a_1b_7a_38
ionicons-api:88.va_4187cb_eddf1
jackson2-api:2.18.3-402.v74c4eb_f122b_2
jakarta-activation-api:2.1.3-2
jakarta-mail-api:2.1.3-2
javadoc:327.vdfe586651ee0
javax-activation-api:1.2.0-8
javax-mail-api:1.6.2-11
jaxb:2.3.9-133.vb_ec76a_73f706
jdk-tool:83.v417146707a_3d
jersey2-api:2.45-154.v4ded3dc34f81
jjwt-api:0.11.5-120.v0268cf544b_89
jnr-posix-api:3.1.20-138.vdb_9db_a_39182f
job-dsl:1.92
joda-time-api:2.14.0-127.v7d9da_295a_d51
jquery:1.12.4-3
jquery3-api:3.7.1-3
jsch:0.2.16-95.v3eecb_55fa_b_78
json-api:20250107-125.v28b_a_ffa_eb_f01
json-path-api:2.9.0-148.v22a_7ffe323ce
jsoup:1.20.1-46.ve5f1416988c2
junit:1322.v1556dc1c59a_f
ldap:780.vcb_33c9a_e4332
lockable-resources:1349.v8b_ccb_c5487f7
mailer:489.vd4b_25144138f
matrix-auth:3.2.6
matrix-project:849.v0cd64ed7e531
maven-plugin:3.26
mina-sshd-api-common:2.15.0-161.vb_200831a_c15b_
mina-sshd-api-core:2.15.0-161.vb_200831a_c15b_
momentjs:1.1.1
monitoring:2.5.0
nodelabelparameter:759.vb_b_e95db_f3251
okhttp-api:4.11.0-189.v976fa_d3379d6
oss-symbols-api:324.v432cce4172ca_
pam-auth:1.12
parameterized-trigger:859.vb_e3907a_07a_16
pipeline-build-step:567.vea_ce550ece97
pipeline-github:2.8-162.382498405fdc
pipeline-github-lib:65.v203688e7727e
pipeline-graph-analysis:235.vb_a_a_36b_f248c2
pipeline-groovy-lib:752.vdddedf804e72
pipeline-input-step:517.vf8e782ee645c
pipeline-milestone-step:134.vdf60d179845f
pipeline-model-api:2.2255.v56a_15e805f12
pipeline-model-definition:2.2255.v56a_15e805f12
pipeline-model-extensions:2.2255.v56a_15e805f12
pipeline-rest-api:2.38
pipeline-stage-step:322.vecffa_99f371c
pipeline-stage-tags-metadata:2.2255.v56a_15e805f12
pipeline-stage-view:2.38
pipeline-utility-steps:2.19.0
plain-credentials:195.vb_906e9073dee
plugin-util-api:6.1.0
popper-api:1.16.1-3
popper2-api:2.11.6-5
postbuild-task:72.v75dc459e4747
prism-api:1.30.0-1
rebuild:338.va_0a_b_50e29397
resource-disposer:0.25
robot:6.0.0
role-strategy:756.v978cb_392eb_d3
run-condition:243.v3c3f94e46a_8b_
scm-api:704.v3ce5c542825a_
script-security:1373.vb_b_4a_a_c26fa_00
sectioned-view:1.30
shiningpanda:0.24
snakeyaml-api:2.3-125.v4d77857a_b_402
ssh-credentials:355.v9b_e5b_cde5003
ssh-slaves:3.1031.v72c6b_883b_869
sshd:3.353.v2b_d33c46e970
startup-trigger-plugin:2.9.4
structs:343.vdcf37b_a_c81d5
throttle-concurrents:2.16
timestamper:1.28
token-macro:444.v52de7e9c573d
trilead-api:2.209.v0e69b_c43c245
uno-choice:2.8.8
variant:70.va_d9f17f859e0
workflow-aggregator:608.v67378e9d3db_1
workflow-api:1371.ve334280b_d611
workflow-basic-steps:1079.vce64b_a_929c5a_
workflow-cps:4106.v7a_8a_8176d450
workflow-cps-global-lib:615.vb_b_0664a_b_19f3
workflow-durable-task-step:1405.v1fcd4a_d00096
workflow-job:1520.v56d65e3b_4566
workflow-multibranch:806.vb_b_688f609ee9
workflow-scm-step:437.v05a_f66b_e5ef8
workflow-step-api:700.v6e45cb_a_5a_a_21
workflow-support:968.v8f17397e87b_8
ws-cleanup:0.48

After update my jenkins instane from version:

Jenkins: 2.346.3
OS: Linux - 4.19.0-21-cloud-amd64
Java: 11.0.16 - Debian (OpenJDK 64-Bit Server VM)

ace-editor:1.1
ansicolor:1.0.2
ant:481.v7b_09e538fcca
antisamy-markup-formatter:159.v25b_c67cd35fb_
apache-httpcomponents-client-4-api:4.5.13-138.v4e7d9a_7b_a_e61
bootstrap4-api:4.6.0-5
bootstrap5-api:5.2.1-3
bouncycastle-api:2.27
branch-api:2.1071.v1a_188a_562481
build-name-setter:2.2.0
build-timeout:1.24
build-user-vars-plugin:1.9
caffeine-api:2.9.3-65.v6a_47d0f4d1fe
checks-api:1.8.1
cloudbees-folder:6.740.ve4f4ffa_dea_54
command-launcher:90.v669d7ccb_7c31
commons-lang3-api:3.12.0-36.vd97de6465d5b_
commons-text-api:1.10.0-27.vb_fa_3896786a_7
conditional-buildstep:1.4.2
configuration-as-code:1569.vb_72405b_80249
credentials:1143.vb_e8b_b_ceee347
credentials-binding:523.525.vb_72269281873
description-setter:1.10
display-url-api:2.3.6
durable-task:507.v050055d0cb_dd
echarts-api:5.4.0-1
editable-choice:60.v68c6aa7fa01e
email-ext:2.92
envinject:2.901.v0038b_6471582
envinject-api:1.199.v3ce31253ed13
font-awesome-api:6.2.1-1
gearman-plugin:0.6.3.78b157a
generic-webhook-trigger:1.86.3
gerrit-trigger:2.36.0
git:4.14.3
git-client:3.13.1
git-parameter:0.9.18
git-server:1.11
github:1.34.5
github-api:1.303-400.v35c2d8258028
github-branch-source:1696.v3a_7603564d04
github-oauth:0.39
gitlab-api:5.1.0-84.v491924123a_f7
gitlab-oauth:1.16
gradle:2.7
handlebars:3.0.8
ionicons-api:31.v4757b_6987003
jackson2-api:2.14.2-319.v37853346a_229
jakarta-activation-api:2.0.1-2
jakarta-mail-api:2.0.1-2
javadoc:226.v71211feb_e7e9
javax-activation-api:1.2.0-5
javax-mail-api:1.6.2-8
jaxb:2.3.7-1
jdk-tool:63.v62d2fd4b_4793
jersey2-api:2.37-1
jjwt-api:0.11.5-77.v646c772fddb_0
jnr-posix-api:3.1.16-1
job-dsl:1.81.1
jquery:1.12.4-1
jquery3-api:3.6.1-2
jsch:0.2.8-65.v052c39de79b_2
junit:1166.1168.vd6b_8042a_06de
ldap:659.v8ca_b_a_fe79fa_d
lockable-resources:2.18
mailer:435.438.v5b_81173f5b_a_1
matrix-auth:3.1.5
matrix-project:772.v494f19991984
maven-plugin:3.22
mina-sshd-api-common:2.9.2-50.va_0e1f42659a_a
mina-sshd-api-core:2.9.2-50.va_0e1f42659a_a
momentjs:1.1.1
monitoring:1.94.1
nodelabelparameter:1.11.0
okhttp-api:4.9.3-108.v0feda04578cf
pam-auth:1.10
parameterized-trigger:2.45
pipeline-build-step:488.v8993df156e8d
pipeline-github:2.8-141.7e985db66f30
pipeline-github-lib:38.v445716ea_edda_
pipeline-graph-analysis:202.va_d268e64deb_3
pipeline-groovy-lib:629.vb_5627b_ee2104
pipeline-input-step:466.v6d0a_5df34f81
pipeline-milestone-step:111.v449306f708b_7
pipeline-model-api:2.2121.vd87fb_6536d1e
pipeline-model-definition:2.2121.vd87fb_6536d1e
pipeline-model-extensions:2.2121.vd87fb_6536d1e
pipeline-rest-api:2.28
pipeline-stage-step:305.ve96d0205c1c6
pipeline-stage-tags-metadata:2.2121.vd87fb_6536d1e
pipeline-stage-view:2.28
pipeline-utility-steps:2.15.0
plain-credentials:143.v1b_df8b_d3b_e48
plugin-util-api:2.20.0
popper-api:1.16.1-3
popper2-api:2.11.6-2
postbuild-task:1.9
rebuild:1.34
resource-disposer:0.20
robot:3.3.0
role-strategy:587.588.v850a_20a_30162
run-condition:1.5
scm-api:631.v9143df5b_e4a_a
script-security:1229.v4880b_b_e905a_6
sectioned-view:1.25
shiningpanda:0.24
snakeyaml-api:1.33-90.v80dcb_3814d35
ssh-credentials:305.v8f4381501156
ssh-slaves:1.834.v622da_57f702c
sshd:3.242.va_db_9da_b_26a_c3
startup-trigger-plugin:2.9.3
structs:324.va_f5d6774f3a_d
throttle-concurrents:2.10
timestamper:1.21
token-macro:321.vd7cc1f2a_52c8
trilead-api:1.67.vc3938a_35172f
uno-choice:2.6.5
variant:59.vf075fe829ccb
workflow-aggregator:596.v8c21c963d92d
workflow-api:1200.v8005c684b_a_c6
workflow-basic-steps:994.vd57e3ca_46d24
workflow-cps:3536.vb_8a_6628079d5
workflow-cps-global-lib:588.v576c103a_ff86
workflow-durable-task-step:1217.v38306d8fa_b_5c
workflow-job:1207.1209.v69351208a_5a_7
workflow-multibranch:716.vc692a_e52371b_
workflow-scm-step:408.v7d5b_135a_b_d49
workflow-step-api:639.v6eca_cd8c04a_a_
workflow-support:839.v35e2736cfd5c
ws-cleanup:0.43

I lost functionality when after jenkins reload (safeRestart/systemctl restart/by jcasc plugin - Reload existing configuration) all previously-set offline agents stay offline. On older jenkins version: Jenkins: 2.346.3 it was work that way. Offline nodes was offline until manual setting it online again. On newer version: Jenkins: 2.504.1 agents all the time(after restart/config reload) becomes online. It is bug or it was a bug before?

can’t reproduce this
Are the agents managed via CasC?

Yes, agents are currently also managed by CasC.
Am I understand that on your instance Jenkins remember offline state of agent and do not turn it on?

Yes
It might be due to CasC that the offline state is lost. You should check if the problem persists when you remove an agent from CasC

The Agent Maintenance plugin might be a workaround for your problem