Skip to content

LLM placement: GPU role selection ignores status, and loopback is chosen per role rather than per node #20131

Closed

Description

@mrveiss

Follow-ups from review of #19861's fix, moved here because #19861 is closed.

  • autobot-slm-backend/api/setup_wizard.py llm_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.

Refs #19861, #19706.

Activity

  1. mrveiss commented on Nov 1, 2026

    @mrveiss
    OwnerAuthor

    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.py llm_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.
  2. removed
    needs-ac-evidenceClosed by a merge keyword; awaits an AC evidence table comment (#19520)
    on Nov 1, 2026
  3. added
    needs-ac-evidenceClosed by a merge keyword; awaits an AC evidence table comment (#19520)
    on Nov 1, 2026
  4. github-actions commented on Nov 1, 2026

    @github-actions
    Contributor

    Landed via the merge train (#20459, merge f88cd3756a) via #20435

  5. mrveiss commented on Nov 1, 2026

    @mrveiss
    OwnerAuthor

    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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions