Repository navigation
Description
Intent (product architecture)
AutoBot is one framework with one userbase. The SLM (Service Lifecycle Manager) is a separated UI surface for service management — split out so it doesn't overwhelm ordinary users — but it is the same AutoBot, backed by the same single user store. Access to the SLM/service-management surface is governed by role-based access control, not by a second identity system.
Current state (diverges from intent — verified on a live install)
Today there are two independent user stores + two auth systems:
| User app (autobot-backend) | SLM (autobot-slm-backend) | |
|---|---|---|
| User DB | autobot_users (AUTOBOT_USERS_DATABASE_URL) |
slm_users (SLM_USERS_DATABASE_URL) |
| Code | autobot-backend/user_management |
autobot-slm-backend/user_management (duplicate package) |
| Auth | db_session_context() → autobot_users; single_user falls back to a synthetic-admin bypass (#6838, AUTOBOT_DEV_AUTH_BYPASS) |
get_slm_session() → slm_users, validated vs SLM_ADMIN_PASSWORD |
| Proof | wrong password → 200 (bypass) | wrong password → 401 (real check) |
So a user created in one is invisible to the other; credentials, roles, and sessions don't carry across. RBAC scaffolding (Role, Permission, is_platform_admin) already exists in autobot-backend/user_management but the SLM doesn't use it.
Goal
- One user store is canonical for all of AutoBot (app + SLM).
- RBAC gates the SLM surface: e.g. an
operator/admin(service-management) permission unlocks the SLM UI/API; ordinary users authenticate against the same store but lack that permission and see only the app. - One auth/session domain (a token issued by one surface is honored by the other, subject to RBAC).
single_usermode = one real seeded admin in the one store (retire the synthetic-admin bypass divergence).
Open design decisions (need sign-off before build — PRD)
- Canonical store: adopt
autobot_users+autobot-backend/user_management(richer: Role/Permission/MFA) as the single source; SLM authenticates against it. Confirm. - How the SLM reaches the shared store: point the SLM's
user_managementatautobot_users, OR have the SLM delegate auth to a shared identity/auth service exposed by the backend. (Control-plane vs data-plane security isolation tradeoff — see [[architecture_two_backends]].) - RBAC model: which role/permission gates SLM access (
ADMIN_SYSTEM? a newservice_managementpermission?), and the default role for new/ordinary users. - Migration: consolidate existing
slm_usersaccounts intoautobot_users(or declareslm_usersdeprecated); session/token format reconciliation. - single_user: seed one admin in
autobot_users; both surfaces honor it; remove/disable the#6838synthetic-admin bypass once real single-user auth works.
Scope (high level — to be decomposed after design sign-off)
- Collapse the duplicate
user_managementpackage to one shared implementation. - SLM auth → shared store + RBAC permission gate on SLM routers/UI.
- DB: one users DB; migration/retirement of
slm_users. - single_user: real seeded admin; retire synthetic bypass.
- Tests for cross-surface auth + role gating.
Risks
- Control-plane/data-plane isolation: the SLM intentionally runs as a separate backend; sharing the user store must not couple them in a way that breaks that boundary or the single_user gating.
- Live divergence already exists (separate
slm_usersaccounts) — needs a migration story.
Relates to RBAC bootstrap (#9920 track) and the two-backend architecture. No code until the design decisions above are signed off (PRD-first).
Acceptance criteria
- One identity spans both backends by construction: one token issuer, or the main backend verifying SLM tokens through a published key (JWKS). Equal HS256 secrets maintained by deploy tooling do not count.
- The SLM's main-backend client stops surfacing a 401 as an error and logs out like every other SLM call:
client.setKeepSessionOn401(true)increateAutobotBackendClient()(autobot-slm-frontend/src/composables/useAutobotApi.ts) is removed, along with its test "surfaces a main-backend 401 instead of logging out until epic(auth): unify AutoBot + SLM into ONE user store with role-based access (SLM = role-gated view, not a separate userbase) #10193". The "Test connection" probe keeps its own per-requestkeepSessionOn401.
Activity
mrveiss commentedon Jun 15, 2026
Added constraint: must work DISTRIBUTED (SLM and user frontend on different machines, still one identity)
The single userbase cannot assume co-location. The SLM and the user app/frontend must be deployable on separate machines and still behave as one AutoBot with one identity + RBAC. This rules out "both processes just open the same local Postgres" as the only design.
Design implications (added to the open decisions):
autobot_usersPostgres both backends connect to over the network, plus a shared JWT signing key + shared/!distributed session store (Redis) so a token minted on either surface validates on the other. Simpler, but couples both machines to one DB and spreads DB credentials.SLM_AUTH_TOKEN, service-JWT/WebSocket from fix(compose): backend→SLM WebSocket 401 — SLM_AUTH_TOKEN missing (node event stream) #9852/fix(config): SLM_AUTH_TOKEN unset causes perpetual WebSocket 403 errors (4400+/day) #7689) rather than inventing a new one.Recommendation leans toward (B) shared auth service because it preserves the deliberate two-backend control/data-plane split (see [[architecture_two_backends]]) and reuses the service-auth channel that already exists between SLM and backend — but this is exactly the decision to confirm before any build.
mrveiss commentedon Jun 15, 2026
PRD — Unified AutoBot Userbase + RBAC (distributed-capable)
1. Problem & intent
AutoBot is one framework with one userbase. The SLM (Service Lifecycle Manager) is a separated UI surface for service management — carved out so ordinary users aren't overwhelmed — but it is the same AutoBot, over the same identity, with RBAC deciding who sees the service-management surface. The SLM and the user frontend must be deployable on different machines yet behave as one identity (tokens valid on both).
2. Current state (the gap)
autobot-backend)autobot-slm-backend)autobot_usersslm_users(separate DB)autobot-backend/user_managementautobot-slm-backend/user_managementdb_session_context(); single_user → synthetic-admin bypass (#6838)get_slm_session()vsSLM_ADMIN_PASSWORDRole/Permission/is_platform_adminexist, used3. Goals / non-goals
Goals: (1) one canonical user store for all of AutoBot; (2) RBAC gates the SLM surface; (3) one auth/session domain valid across machines; (4)
single_user= one real seeded admin (retire #6838 bypass); (5) works co-located AND distributed.Non-goals (this epic): external IdP/OIDC federation (future), multi-tenant org redesign, MFA changes beyond carrying it into the shared store.
4. Requirements
service_managementpermission; ordinary users lack it. R5 Distributed: SLM and frontend on separate hosts. R6 Co-located +single_userstill work (one seeded admin). R7 Defined network-partition behavior. R8 Preserve the control/data-plane boundary between the two backends.5. Recommended architecture — Pattern B: shared auth/identity service
The backend (
autobot-backend/user_management, the richer impl) becomes the identity authority, exposing auth + token-validation + RBAC over HTTP. The SLM delegates: it validates incoming tokens and checks theservice_managementpermission via the authority, reusing the existing SLM↔backend service-auth channel (SLM_AUTH_TOKEN, service-JWT/WebSocket from #9852/#7689) rather than a new one.Why B over A (shared DB endpoint): keeps the deliberate two-backend control/data-plane split; no DB credentials spread to the SLM host; reuses an existing trust channel. Cost: SLM needs the authority reachable at runtime → see partition handling (R7).
6. Canonical store
Adopt
autobot_users+autobot-backend/user_managementas the single source (it has Role/Permission/MFA). Collapse the duplicate SLMuser_managementto a thin client of the authority.slm_usersis migrated then deprecated.7. RBAC model
service_management(and/or reuseADMIN_SYSTEM); roleoperator/admincarries it. Default new users: ordinaryuser(no SLM access).require_permission(service_management). App-only users authenticate fine but are denied SLM routes (403) and the SLM nav is hidden.8. Token / session design
9. single_user
One real admin seeded in
autobot_usersat provision; both surfaces honor it; retire the #6838 synthetic-admin bypass once real single-user auth works (or keep it strictly dev-gated). Co-located deploy points the SLM authority at localhost.10. Migration
slm_usersaccounts intoautobot_users(dedupe by email/username); map SLM admin →service_managementrole. Provide a one-time migration; markslm_usersread-only then drop after cutover. Session format reconciliation (re-login acceptable).11. Network-partition behavior (R7)
If the SLM can't reach the authority: validate already-issued tokens from cached JWKS/claims up to a short TTL (read-mostly), deny new logins, surface a clear degraded-auth banner. Define TTL + whether destructive SLM actions are blocked while degraded.
12. Security
Single signing key custody; authority is now a higher-value target (rate-limit, audit); ensure SLM delegation can't be spoofed (mutual service auth); least-privilege default role; the bypass removal closes the passwordless-admin hole.
13. Task breakdown (post-approval → child issues)
service_managementpermission + role wiring + SLM router/UI gating. 3. SLMuser_management→ thin delegating client; removeslm_usersauth path. 4. Shared signing key/JWKS + shared Redis sessions; cross-surface token validity. 5. single_user seeded admin + retire security(auth): /api/auth/login accepts ANY password for admin user #6838 bypass. 6.slm_users→autobot_usersmigration + deprecation. 7. Partition/degraded-auth handling. 8. Tests: cross-machine auth, role gating (app-only denied SLM), single_user, partition. 9. Two-machine verification (CI can't cover — needs a real 2-host run).14. Risks / open questions
service_managementa new permission or reuseADMIN_SYSTEM? Default role for the first user on a fresh install?Requesting review of: Pattern B vs A (§5), canonical store (§6), RBAC permission choice (§7), and partition policy (§11). On approval I'll decompose §13 into child issues under this epic.
mrveiss commentedon Jun 15, 2026
Decision log
autobot_users+autobot-backend/user_managementis the single canonical source of truth.slm_users+ the duplicateautobot-slm-backend/user_managementare deprecated and migrated into it. (Canonical-source discipline: one store wins, the other defers.)Still open for sign-off: §5 Pattern B (shared auth service) vs A (shared DB endpoint); §7 RBAC permission name; §11 partition policy.
mrveiss commentedon Jun 15, 2026
Decision log (cont.)
single_usermode. A single-user deployment simply uses a real default admin account seeded in the canonicalautobot_usersstore. This supersedes §9 and removes the security(auth): /api/auth/login accepts ANY password for admin user #6838 synthetic-admin bypass entirely (not just gating it).Ripple effects of eliminating single_user (important)
autobot_usersand seed the default admin. (Aligns with the RBAC-bootstrap direction;AUTOBOT_USER_MODE=single_useris retired.)@requires_postgres/postgres_required, telemetry/LLC/thinking-prefs 503 paths: Consolidate + gate Postgres-dependent startup paths for single_user (no WARNING/traceback) #9765, chore(lifespan): extract @requires_postgres decorator — _llc_postgres_available() gate now duplicated across 8 startup steps #9913, telemetry consent modal cannot save in single_user mode — POST /api/settings/telemetry 503 (user management disabled) #10000, LLC + thinking-preferences endpoints 500 in single_user — need API-layer Postgres gate returning clean 503 (#9765 class) #10010) no longer trigger, since Postgres is always present. They can stay as harmless guards initially, then be removed in a follow-on cleanup. No behavior regression.AUTOBOT_DEV_AUTH_BYPASS(security(auth): /api/auth/login accepts ANY password for admin user #6838) is removed — the passwordless-admin hole closes.Open safety nuance — default-admin credential policy (need a choice)
"Safest" and "default admin account" pull in different directions. Options for the seeded admin's initial credential:
admin/ installer-set password from a provisioning secret (operator chooses at install).admin/adminonly as an explicit dev/test opt-in flag (not the default).Recommend the first. Confirm and I'll bake it into the task breakdown.
Revised single_user task (replaces §13.5)
single_usermode +AUTOBOT_USER_MODEbranching; provisioning always seeds a default admin inautobot_users; delete the security(auth): /api/auth/login accepts ANY password for admin user #6838 bypass; (follow-on) remove the now-dead single_user 503-gates.mrveiss commentedon Jun 15, 2026
Decision log (final)
All design decisions are now made (Pattern B; canonical
autobot_users; single_user eliminated → seeded default admin; installer-set creds + unsafe-password login warning). Carried defaults for detail items: §7 a newservice_managementpermission gates the SLM surface; §11 partition = cached token validation with a short TTL. Proceeding to decompose into child issues.mrveiss commentedon Jun 15, 2026
Decision refinement
autobot_usersat install. No shipped default; login still complains if the chosen password is unsafe.mrveiss commentedon Jun 15, 2026
Task tree (decomposition) — build order + dependencies
Phase 1 — foundation (parallel):
Phase 2 — wire the SLM in (after Phase 1):
slm_usersauth pathservice_managementpermission gates the SLM surface (403 + hidden nav for ordinary users)Phase 3 — single-user/provisioning + migration:
single_user+ security(auth): /api/auth/login accepts ANY password for admin user #6838 bypass; unsafe-password login warningslm_users→autobot_users, then deprecateslm_usersPhase 4 — resilience + cleanup + verification:
Decisions locked: Pattern B (shared auth service) · canonical
autobot_users·single_usereliminated → seeded default admin (password set at SLM deploy, unsafe-password login warning) ·service_managementRBAC gate · partition = cached-TTL validation.Suggested start: #10195 + #10196 (foundation), since everything else depends on them. Build in increments, one PR per child, respecting the PR-queue limit.
mrveiss commentedon Jun 15, 2026
Note: admin-password collection already exists (install.sh)
install.shalready collects a user-set admin password (wizard/flag/env) with a strong random fallback and no shipped default (preserved on reinstall). The unified-userbase work reuses this — #10199 just re-points the already-collected password at the canonicalautobot_usersadmin and removes single_user. Confirmed by mrveiss.mrveiss commentedon Jun 15, 2026
Decision log (Phase 1 crypto)
mrveiss commentedon Jun 15, 2026
Progress: Phase 1 — #10196 DONE
PR #10205 merged (
23cd8847e). RS256+JWKS authority foundation is live on Dev_new_gui. Next: #10195 (authorityvalidate/introspect + RBAC-list API).mrveiss commentedon Jun 16, 2026
Progress: Phase 1 COMPLETE ✅
23cd8847e34afbdc03The backend is now the full identity authority: RS256-signed tokens, public JWKS, token-validation with revocation, RBAC metadata. Next: Phase 2 — #10197 (SLM verifies via JWKS + delegates revocation/RBAC) and #10198 (
service_managementpermission gates the SLM surface).25 remaining items
mrveiss commentedon Oct 27, 2026
Maintainer decision (2026-10-27): unify the two frontends into one app. The SLM views become a role-gated back-office section of the main frontend, shown to admins and to granted advanced users, with one login and one session on the one user store this epic delivers. The two backends stay. A frontend-unification epic is being filed and will depend on this one.
mrveiss commentedon Oct 27, 2026
Today the SLM's main-backend 401 does not log out. This epic flips it.
This comes from the code review on PR #19819 (#12363 step 2). The maintainer decision recorded above (one identity, so a 401 from either backend logs out) is the target. On current main it cannot be enforced safely, because the main backend accepts an SLM token only by coincidence of configuration:
SLM_SECRET_KEY(autobot-slm-backend/config.py:288-289,services/auth.py:98-102), with noiss/aud.AUTOBOT_JWT_SECRET, thenSECRET_KEY, then the config file, then a generated value (autobot-backend/auth_middleware.py:86-120,:440-444). It has no SLM key, no token exchange and no introspection.AUTOBOT_JWT_SECRETequal toSLM_SECRET_KEY(bug(service-auth): backend→SLM WebSocket fails (403 handshake + 4001 token); JWT secret not distributed #10400:roles/backend/templates/backend.env.j2:50-51,roles/backend/tasks/main.yml:140-159,playbooks/update-all-nodes.yml). A bare or dev install gets a generated secret instead, so every SLM call to the main backend returns 401, and a logout-on-401 client would log the user out on every page.So #19819 sets
keepSessionOn401on the whole main-backend client: a main-backend 401 shows an error and never ends the session. The one-identity work has to remove the coincidence (one issuer, or JWKS) and then flip that setting. Both are now acceptance criteria on this epic.fix(slm): a main-backend 401 surfaces as an error and never logs out …
github-actions commentedon Oct 28, 2026
needs-structurecleared: goal milestone, matching phase label and native parent (or sub-issues) are all present (#19522).mrveiss commentedon Nov 1, 2026
Maintainer decision (2026-11-02), replacing this epic's single user store and the one-app plan in #19829: the SLM stays separate and is installed first. The SLM owns the first login and has its own users from the first install. Once the main app is installed it links to those users, so a person has one identity and SLM access is a grant. SLM login keeps working while the main app is down. The goal section above is superseded; the link's design is with the maintainer and will be recorded here.
mrveiss commentedon Nov 1, 2026
Maintainer decision (2026-11-02), the link's design: the main app becomes the record for a person once it's installed, and SLM login from the copy has no time limit.
Not verified, for the build:
#10200's copy from the SLM into the main app no longer fits as written and needs rescoping to this design. #19829's dependency on it needs re-planning too.
mrveiss commentedon Nov 8, 2026
Follow-up for this work: the SLM File Browser message
tools.admin.fileBrowserTool.downloadUnauthorized(en.json, added in #21087) currently tells the user to "Sign in there and try again", which cannot help while SLM-issued tokens are rejected by the main backend admin check. Reword it as part of this change once the shared identity lands, then verify a real SLM download and close #21029.