You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
LLM placement: GPU role selection ignores status, and loopback is chosen per role rather than per node #20131
Follow-ups from review of #19861's fix, moved here because #19861 is closed.
autobot-slm-backend/api/setup_wizard.pyllm_infra_vars picks the GPU role by name before checking status, and on the full-inventory path all_active includes inactive and not_installed rows. not_installed rows must stay as a first-run fallback, so selection has to prefer active rows rather than filter. The test helper needs a status attribute.
autobot-slm-backend/services/llm_placement.py: nodes_by_role keeps the last node per role, so loopback is chosen for every backend node when the last one is the LLM node. Single-backend setups are unaffected. Give each client node its own value, or use loopback only when every client node is the LLM node.
Checked against main (f88cd37 or later): each row was read from the code, and the tests and paths named were confirmed to exist there. Tests were not run for this comment.
AC
Evidence
autobot-slm-backend/api/setup_wizard.pyllm_infra_vars picks the GPU role by name before checking status, and on the full-inventory path all_active includes inactive and not_installed rows. not_installed rows must stay as a first-run fallback, so selection has to prefer active rows rather than filter. The test helper needs a status attribute.
MET, with a reachability caveat. autobot-slm-backend/services/llm_placement.py:24-33_llm_node loops for active_only in (True, False) over _LLM_ROLES (GPU first), matching nr.status == "active" or not active_only, so active rows win and other statuses remain a fallback. Test helper has status: repo_tests/llm_node_reaches_backend_env_19861_test.py:37,85 (status="active", _row(..., status=...)). repo_tests/llm_node_reaches_backend_env_19861_test.py::test_an_active_llm_row_wins_and_the_others_stay_a_fallback. Caveat: autobot-slm-backend/api/setup_wizard.py:~614-618 builds all_active from select(NodeRole).where(NodeRole.status == "active") when node_ids is given, and from all_node_roles otherwise. So _llm_node's not_installed fallback is reachable only through the non-node_ids branch; the node_ids branch passes active rows only.
autobot-slm-backend/services/llm_placement.py: nodes_by_role keeps the last node per role, so loopback is chosen for every backend node when the last one is the LLM node. Single-backend setups are unaffected. Give each client node its own value, or use loopback only when every client node is the LLM node.
MET. autobot-slm-backend/services/llm_placement.py:~50-51: client_nodes = {nr.node_id for nr in node_roles if nr.role_name == role} and "127.0.0.1" if client_nodes == {llm_node} else ip. Tests: repo_tests/llm_node_reaches_backend_env_19861_test.py::test_loopback_is_not_chosen_when_another_backend_node_exists and repo_tests/llm_node_reaches_backend_env_19861_test.py::test_loopback_stays_when_every_backend_node_is_the_llm_node.
Evidence from origin/main (f88cd37), landed by #20435:
Item 1 (GPU role selection ignores status): autobot-slm-backend/services/llm_placement.py_llm_node loops for active_only in (True, False) and over _LLM_ROLES (GPU first), keeping only nr.status == "active" rows on the first pass and falling back to any status (so first-run not_installed rows still work) on the second. autobot-slm-backend/api/setup_wizard.py:293 calls llm_infra_vars(node_roles, node_id_to_ip); lines 616-620 build all_active from NodeRole.status == "active" when node_ids are given, else all_node_roles.
Item 2 (loopback per role, not per node): llm_infra_vars computes client_nodes = {nr.node_id for nr in node_roles if nr.role_name == role} per client and sets "127.0.0.1" if client_nodes == {llm_node} else ip - loopback only when every node of that client is the LLM node.
Both boxes ticked on that basis. Note for the record: the wizard's node_ids branch still passes active rows only (setup_wizard.py:616), so the not_installed fallback in _llm_node is only reachable via the else branch; not covered by this issue's criteria.
Activity
mrveiss commentedon Nov 1, 2026
Checked against
main(f88cd37 or later): each row was read from the code, and the tests and paths named were confirmed to exist there. Tests were not run for this comment.autobot-slm-backend/api/setup_wizard.pyllm_infra_varspicks the GPU role by name before checking status, and on the full-inventory pathall_activeincludes inactive and not_installed rows. not_installed rows must stay as a first-run fallback, so selection has to prefer active rows rather than filter. The test helper needs a status attribute.autobot-slm-backend/services/llm_placement.py:24-33_llm_nodeloopsfor active_only in (True, False)over_LLM_ROLES(GPU first), matchingnr.status == "active" or not active_only, so active rows win and other statuses remain a fallback. Test helper has status:repo_tests/llm_node_reaches_backend_env_19861_test.py:37,85(status="active",_row(..., status=...)).repo_tests/llm_node_reaches_backend_env_19861_test.py::test_an_active_llm_row_wins_and_the_others_stay_a_fallback. Caveat:autobot-slm-backend/api/setup_wizard.py:~614-618buildsall_activefromselect(NodeRole).where(NodeRole.status == "active")whennode_idsis given, and fromall_node_rolesotherwise. So_llm_node'snot_installedfallback is reachable only through the non-node_idsbranch; thenode_idsbranch passes active rows only.autobot-slm-backend/services/llm_placement.py:nodes_by_rolekeeps the last node per role, so loopback is chosen for every backend node when the last one is the LLM node. Single-backend setups are unaffected. Give each client node its own value, or use loopback only when every client node is the LLM node.autobot-slm-backend/services/llm_placement.py:~50-51:client_nodes = {nr.node_id for nr in node_roles if nr.role_name == role}and"127.0.0.1" if client_nodes == {llm_node} else ip. Tests:repo_tests/llm_node_reaches_backend_env_19861_test.py::test_loopback_is_not_chosen_when_another_backend_node_existsandrepo_tests/llm_node_reaches_backend_env_19861_test.py::test_loopback_stays_when_every_backend_node_is_the_llm_node.github-actions commentedon Nov 1, 2026
Landed via the merge train (#20459, merge
f88cd3756a) via #20435mrveiss commentedon Nov 1, 2026
Evidence from
origin/main(f88cd37), landed by #20435:autobot-slm-backend/services/llm_placement.py_llm_nodeloopsfor active_only in (True, False)and over_LLM_ROLES(GPU first), keeping onlynr.status == "active"rows on the first pass and falling back to any status (so first-runnot_installedrows still work) on the second.autobot-slm-backend/api/setup_wizard.py:293callsllm_infra_vars(node_roles, node_id_to_ip); lines 616-620 buildall_activefromNodeRole.status == "active"when node_ids are given, elseall_node_roles.llm_infra_varscomputesclient_nodes = {nr.node_id for nr in node_roles if nr.role_name == role}per client and sets"127.0.0.1" if client_nodes == {llm_node} else ip- loopback only when every node of that client is the LLM node.Both boxes ticked on that basis. Note for the record: the wizard's
node_idsbranch still passes active rows only (setup_wizard.py:616), so the not_installed fallback in_llm_nodeis only reachable via theelsebranch; not covered by this issue's criteria.