Skip to content

feat(slm): run a role on more than one node — horizontal scaling per role #19706

Open

Description

@mrveiss

Goal

Maintainer decision (2026-10-26): the user chooses the environment and its size (Docker, VMs or bare metal) and can separate roles onto their own nodes and scale them.

Today

  • Separating roles works: the SLM assigns each role to a node.
  • Scaling one role across several nodes does not. check_role_uniqueness in autobot-slm-backend/services/role_registry.py lets a role sit on one node only. MULTI_NODE_ROLES covers just autobot_shared and slm-agent.
  • So "scale a role horizontally" (for example two backend nodes behind the frontend, or several NPU or LLM workers) cannot be configured.

Acceptance criteria

  • For each role, a decision (recorded here) on whether it can run on several nodes, and what that requires: state sharing via Redis or Postgres, sticky sessions, leader election, and how traffic is spread across nodes.
  • Roles marked scalable can be assigned to more than one node in the SLM, and the role check allows it for exactly those roles.
  • A role on several nodes gets traffic spread across them (load balancing or service discovery) and per-node health, and one node failing doesn't take the role down.
  • The landing page and the install docs then say roles can be scaled. Until this lands they say only that roles can be separated and each node sized.

Activity

  1. mrveiss commented on Nov 1, 2026

    @mrveiss
    OwnerAuthor

    Maintainer decision: no code yet. A per-role table comes first, showing whether each role can scale, what that requires and how big the work is. The maintainer rules on that table.

  2. mrveiss commented on Nov 1, 2026

    @mrveiss
    OwnerAuthor

    Per-role table for the maintainer's ruling. Read from main; no code changed. Sizes are estimates, not measured (S up to a few days, M up to two weeks, L more). "Read" means the cited code was opened; "inferred" means deduced from structure.

    Role Can scale? What blocks it Requires Size Basis
    autobot_shared, slm-agent Already Nothing; both are in MULTI_NODE_ROLES Nothing None Read
    npu-worker Yes, closest to ready Inference uses one URL (ai_hardware_accelerator.py:203), though NPUWorkerPool exists (autobot_shared/npu/integration.py:381). Whether the main path uses the pool is not confirmed Route through the pool; take the worker list from SLM assignments M Read, call path unknown
    frontend Yes One backend upstream (autobot-user.conf:5-7) A load balancer in front; same build on each node S Inferred
    tts-worker Yes One host (ssot_config.py:178). The real server code was not read URL list or load balancer in the client S Inferred
    autobot-llm-cpu Yes One default endpoint plus one GPU endpoint (config/model_config.py:118-135) Endpoint list and a picker; same models on each node M Read
    autobot-llm-gpu With work As above, plus the co-location rule with npu-worker As above M Read
    ai-stack With work One host and port (ssot_config.py:175). Hidden state not ruled out URL list or load balancer; check for state M Inferred
    browser-service With work Sessions held in memory (session-store.js) Sticky routing by session, or a session registry in Redis M Read
    celery With work Shares the backend's local SQLite and files. Task code not read Backend's shared-state fix M Inferred
    backend With work One upstream, and local state: secrets.db, conversation_files.db, project_state.db, transcriber.db, chat JSON files Move state to Postgres, Redis or a shared volume; multi-server upstream; sticky sessions and in-process caches not yet audited L Read for blockers, inferred for size
    redis With work One host (ssot_config.py:174), no Sentinel or cluster found. Other roles keep shared state here Sentinel or Cluster; client changes L Read
    postgres With work One server, no failover found Primary and replica, failover, routing L Inferred
    slm-frontend With work, moot Points at 127.0.0.1:8000. Only useful with a scaled slm-backend Scaled slm-backend S Inferred
    scheduler No, stay single A second celery beat fires every task twice; no leader election found Stay single (S), or a lease for failover (M) S or M Read
    slm-backend No, stay single In-process loops and WebSocket connections (main.py:330, api/websocket.py:147), one advisory lock only Leader election, pub/sub, agent failover address L Read
    slm-database No, until a Postgres HA decision Single Postgres. A Replication model exists and was not read Separate project L Read in part
    slm-monitoring No, stay single Static Prometheus targets Two independent scrapers; not analysed further M Inferred
    chromadb No, stay single One host, and some code uses local PersistentClient, so nodes would diverge Data replication, which this repo does not provide L Read
    vnc No, stay single Bound to one display and session (ssot_config.py:1832) Per-session node mapping; not investigated M Inferred
    docker Not applicable Infrastructure role with no service. Not in MULTI_NODE_ROLES; how the role check treats it was not checked None S Read

    Needed by every scaled role:

    • Role check: check_role_uniqueness (role_registry.py:647-669) becomes a per-role flag, and get_role_owners (:672) and api/roles.py:169-179 return a list. Callers are nodes.py:977, deployments.py:226 and blue_green.py:80. The database already allows many nodes per role (models/database.py:976).
    • Traffic: no generic load balancing or discovery exists. Consumers read one host per service (ssot_config.py:171-180). zero_downtime_deploy.py:707-763 generates multi-server upstreams and may be reusable; not read in depth.
    • Health: fleet health counts a role as up if any node is active (api/roles.py:205-260), so one dead node of a scaled role would not show as degraded. Nothing removes a failed node from an upstream.

    Not looked at: how the SLM generates each node's AUTOBOT_*_HOST values, the docker and vnc Ansible roles, the Windows NPU worker, and the landing and install text.

    Suggested first step, for the ruling: the role-check change and per-node health, then npu-worker, the LLM roles, tts-worker and frontend. They give real scaling without moving the backend's state. backend is the largest and most asked-for, and is a project of its own.

  3. mrveiss commented on Nov 1, 2026

    @mrveiss
    OwnerAuthor

    Maintainer decision on the table above: first the shared changes (a per-role flag, a list of nodes in the API, per-node health), then npu-worker, the LLM roles, tts-worker and frontend. backend is a separate project later.

  4. mrveiss commented on Nov 2, 2026

    @mrveiss
    OwnerAuthor

    Verified against main at the merge train (PR #20661), merge 6c34ee1. Members touching this issue: #20599. It delivers only the NPU-worker slice, so no criterion is ticked.

    AC Evidence
    Per-role decision on multi-node, and what it requires NOT ticked. No per-role decision is recorded on the issue.
    Scalable roles assignable to more than one node; role check allows exactly those NOT ticked. MULTI_NODE_ROLES = {"autobot_shared", "slm-agent"} is unchanged on main (autobot-slm-backend/services/role_registry.py:636).
    Traffic spread across a role's nodes, per-node health, one node failing does not take the role down NOT ticked, partial for NPU workers only. autobot-backend/services/npu_worker_routing.py (_spread, npu_worker_urls, post_inference_with_failover) sends requests to every healthy paired worker with failover. No equivalent for other roles.
    Landing page and install docs say roles can be scaled NOT ticked. Depends on the criteria above; README.md:185 only says to add nodes and NPU workers.

    The issue stays open.

  5. mrveiss commented on Nov 3, 2026

    @mrveiss
    OwnerAuthor

    Acceptance criteria after merge train #20768

    Checked against origin/main. This train carried only the npu-worker slice (#20601); the issue's scope is wider.

    Criterion Verdict Evidence
    Per-role decision recorded here (scalable or not, and what it requires) not met A per-role table is posted as a comment, but no maintainer ruling on it is recorded. Nothing to tick until the ruling exists.
    Scalable roles can be assigned to more than one node; role check allows it for exactly those roles not met autobot-slm-backend/services/role_registry.py:636 MULTI_NODE_ROLES = {"autobot_shared", "slm-agent"} is unchanged; check_role_uniqueness (:647) still refuses a second node for every other role, npu-worker included.
    Traffic spread across nodes, per-node health, one node failing doesn't take the role down not met Only the npu-worker client side exists: autobot-backend/services/npu_worker_routing.py (request order over paired workers), services/npu_client.py:191 (workers tried in order), ai_hardware_accelerator.py:268 (NPU available if any worker is). No SLM-level load balancing or service discovery for roles in general.
    Landing page and install docs say roles can be scaled not met Depends on the rows above; no role is assignable to several nodes yet.

    Issue stays open: 0 of 4 met.

  6. mrveiss commented on Nov 6, 2026

    @mrveiss
    OwnerAuthor

    Closure check against origin/main (T82 #20897, merge 19e62c8; PR #20597 content is commit 2ecc0c7, an ancestor). The issue stays open: 0 of 4 ticked. PR #20597 said Refs and delivers the shared groundwork only.

    AC Evidence Ticked
    Per-role decision (recorded here) on scalability and what it requires The per-role table (comment 6564730165) and the maintainer's ruling on order (comment 6565209098) are on the issue. The ruling names the first slice (npu-worker, LLM roles, tts-worker, frontend) and defers backend, but does not state a decision for every role in the table (scheduler, chromadb, redis, postgres, vnc and others). Not a code-checkable criterion. no
    Scalable roles assignable to more than one node, role check allows exactly those roles Mechanism delivered: autobot-slm-backend/services/role_registry.py:638 MULTI_NODE_ROLES = frozenset(r["name"] for r in DEFAULT_ROLES if r.get("multi_node")); check_role_uniqueness (:659) exempts them. But "multi_node": True appears 2 times (lines 431, 451: autobot_shared, slm-agent), both infrastructure roles. No service role is scalable, so no user can scale a role yet. no
    Traffic spread across nodes, per-node health, one node failing doesn't take the role down Per-node health delivered: autobot-slm-backend/services/role_nodes.py classify_role_nodes, get_roles_with_nodes_down, surfaced as roles_with_nodes_down in fleet health. Traffic spreading: 0 hits for load balancing, service discovery or sticky routing in role_registry.py or role_nodes.py; nothing removes a failed node from an upstream. Per-node health also only covers service roles with the flag, currently 0. no
    Landing page and install docs say roles can be scaled docs/guides/slm-docker-ansible-deployment.md only documents the /api/roles/owners and fleet-health response shapes. README.md "scale" hits (lines 41, 57, 138, 185, 219, 241) are the general deploy/operate/scale claim, not role scaling. Correctly absent until a role can be scaled. no

    Left: flag the first service roles (npu-worker, LLM roles, tts-worker, frontend) once their traffic reaches every node, add the traffic spreading, record the remaining per-role decisions, then update the docs. Host behaviour of per-node health is untested on a live fleet (the PR said "Not tried on a host").

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