From 125a8b283ee0f13c563fcf1de281bcae4f1fde6a Mon Sep 17 00:00:00 2001 From: "lei.chen" Date: Mon, 24 Aug 2026 14:17:50 +0000 Subject: [PATCH] fix(controller): push workers before configs on apiserver join MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit on_apiserver_join pushed configs first, then workers. The API server's OnHostConfigUpdated only applies config-sourced fields (max_slot, host_type/host_model) to hosts already in its store — so on a fresh connect every host was skipped and the API showed max_slot 0 and t1 host_type "unknown". Swap the order so the worker dataset populates the host entries before the config push lands. Verified on t1/t2/t3: all hosts now report max_slot 8 and host_type x86_64-linux-gnu; jobs still submit → RUN → DONE. Co-Authored-By: Claude --- src/controller/apiserver.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/controller/apiserver.c b/src/controller/apiserver.c index 58425c23..7e079e85 100644 --- a/src/controller/apiserver.c +++ b/src/controller/apiserver.c @@ -647,8 +647,14 @@ int apiserver_init(cluster_t* c) int on_apiserver_join(cluster_t* c, endpoint_t* ep) { - xce_apiserver_push_configs(c, ep); + /* Push the WORKER dataset BEFORE the config push. The API server's + * OnHostConfigUpdated only applies config-sourced fields (max_slot, + * host_type/host_model) to hosts already in its store — if the config + * push arrives first, every host is skipped (bug: hosts showed max_slot + * 0 and t1 host_type "unknown" on first connect). Pushing workers first + * populates the host entries so the config push lands. */ xce_apiserver_push_workers(c, ep); + xce_apiserver_push_configs(c, ep); xce_apiserver_push_jobs(c, ep); return 0;