Skip to content

feat(sandbox): record lifecycle state on the sandbox row - #599

Merged
aivong-openhands merged 3 commits into
mainfrom
jl/sandbox-lifecycle-columns
Oct 5, 2026
Merged

aivong-openhands merged 3 commits into
mainfrom
jl/sandbox-lifecycle-columns

Conversation

@jlav

@jlav jlav commented Sep 30, 2026 •

Copy link
Copy Markdown
Member

HUMAN:

  • A human has tested these changes.

AGENT:


Why

Part 1 of 5 in the sandbox lifecycle stack.

The worker in part 5 pauses and deletes idle sandboxes, and it decides from the sandbox table. Today the row doesn't say whether a sandbox is running or paused, or since when.

Two transitions of one sandbox can also run at the same time, for example an API resume and a worker pause.

Summary

  • Migration 175 adds lifecycle_state, state_changed_at and last_active_at to v1_remote_sandbox.
  • The docker, E2B and k8s services now share a base class, ManagedSandboxService, which keeps them current on start, resume and pause.
  • Pause, resume and delete lock the row (SELECT ... FOR UPDATE) until the request's transaction ends.

Approach

ManagedSandboxService (managed_sandbox_service.py) owns the row. Its resume_sandbox, pause_sandbox and delete_sandbox lock the row, call the backend's hook, then update the row with mark_running or mark_paused.

The hooks are _resume_at_provider, _pause_at_provider and _delete_at_provider. They only talk to the provider, and report what they did as a ProviderOutcome. New rows come from _new_stored_sandbox, which marks them running.

Two cases might surprise a reviewer:

  • Resuming a sandbox that's already running leaves the row as it is, unless the row says paused. E2B resume now reads the sandbox's state first to tell these apart.
  • mark_paused keeps the original pause time when the row already says paused. The delete rule in part 5 counts from that time.
  • k8s now pauses the user's oldest running sandboxes on every resume, as docker and E2B already do. It used to skip that when the sandbox was already running. The base does it before it locks the row, because pausing those sandboxes locks their rows.

test_sandbox_lifecycle_contract.py runs one set of tests against all three backends, with fake providers and a real postgres.

Issue Number

How to Test

uv run pytest tests/unit/app_server/test_sandbox_lifecycle_contract.py
make local-db   # migrates to head, including 175

Video/Screenshots

N/A

Type

  • Bug fix
  • Feature
  • Refactor
  • Breaking change
  • Docs / chore

Notes

  • Each new column has a server default, so app servers on the previous release keep inserting rows during a rollout. Existing rows read as running.
  • The remote backend (runtime-api) doesn't use the columns.

Enterprise server image for this PR:

ghcr.io/openhands/enterprise-server:sha-3364580

@jlav
jlav added this pull request to stack #604 September 30, 2026 19:42
@github-actions

github-actions Bot commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  migrations/versions
  175_add_sandbox_lifecycle_columns.py 31-55, 63-68
  openhands/app_server/sandbox
  docker_sandbox_service.py 592, 614, 620, 641
  e2b_sandbox_service.py 643, 669
  k8s_agent_sandbox_service.py 721, 725, 730
  managed_sandbox_service.py
  sandbox_store.py
Project Total  

This report was generated by python-coverage-comment-action

@jlav jlav changed the title Record sandbox lifecycle state on the sandbox row feat(sandbox): record lifecycle state on the sandbox row Sep 30, 2026
@github-actions github-actions Bot added the type: feat A new feature label Sep 30, 2026
@jlav
jlav force-pushed the jl/sandbox-lifecycle-columns branch from 1302d08 to bd340b1 Compare September 30, 2026 21:43
@github-actions

Copy link
Copy Markdown
Contributor

⚠️ This PR contains migrations. Please synchronize before merging to prevent conflicts.

@jlav
jlav marked this pull request as ready for review September 30, 2026 22:15
@aivong-openhands

Copy link
Copy Markdown
Contributor

✅ Replicated install validation — PASS

Tested this PR's enterprise-server image on a self-hosted Replicated embedded-cluster install (external Postgres).

Image confirmed

The running openhands deployment/pod is on ghcr.io/openhands/enterprise-server:sha-52b8e8a — the image referenced in this PR.

Migration 175

  • alembic_version is at 175 after install.
  • v1_remote_sandbox has the three new columns with the expected server defaults:
column type default
lifecycle_state varchar 'running'
state_changed_at timestamptz now()
last_active_at timestamptz now()

Functional check

A real sandbox created by a test conversation was recorded in v1_remote_sandbox with lifecycle_state = running and state_changed_at / last_active_at populated — i.e. new rows are marked running as described in the PR.

End-to-end

Fresh install came up healthy (all app pods Running), auth/login + TOS worked, and a test conversation completed successfully with the agent responding.

Result: PASS ✅


This comment was posted by an AI agent (OpenHands) on behalf of @aivong.

@aivong-openhands aivong-openhands left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Taste rating: acceptable. Moving the row updates into one base class is the right shape. The contract suite runs the same tests against all three backends, so the rules stay the same across them. CI is green on 52b8e8a, and I ran test_sandbox_lifecycle_contract.py plus the docker, E2B and k8s service suites locally against Postgres: 263 passed.

I found one blocking regression and one minor one. Both are explained in the inline comments.

Findings

  1. 🔴 Resuming a k8s sandbox that's already running can now suspend it, while the API reports success and the row says running. (managed_sandbox_service.py:76) pause_old_sandboxes(max - 1) now runs before the k8s status check. If the sandbox being resumed is one of the user's oldest running sandboxes, it gets paused. On k8s that means it's patched to Suspended and its pod is deleted. The claim's Ready condition only changes after the controllers reconcile, so _resume_at_provider still reads RUNNING and returns ALREADY_DONE. The base then calls mark_running (the row was just marked paused by the nested pause) and returns True. Reproduced with the existing k8s fakes, changing only the claim condition so it lags (max_num_sandboxes=1, one running claim). resume_sandbox returned True, the row said running, and k8s.modes == [('openhands-agent-server-abcde', 'Suspended')]. On main, k8s returned before pausing, and test_resume_of_a_running_sandbox_does_nothing asserted pause_old_sandboxes was not called. This PR removes that assertion. The PR is meant to make the row a reliable input for the part 5 reaper, and this breaks that.
  2. 🟡 An E2B resume now fails on a single transient get_info error, without retrying. (e2b_sandbox_service.py:641) _get_info turns any SandboxException into None. The new pre-check then returns FAILED before the retry loop runs, so the router returns 404 for a sandbox that exists. Before this PR, the same error inside connect was retried resume_retries times.

Non-blocking note

  • The row lock lasts until the session commits. In LiveStatusAppConversationService._wait_for_sandbox_start, resume_sandbox runs on the long-lived start-task session, and the next commit only comes after wait_for_sandbox_running, which can take up to sandbox_startup_timeout. A pause or delete of that sandbox has to wait until then. So does another request's pause_old_sandboxes if it picks this sandbox. That may be fine, but it should be a deliberate choice before part 5's worker takes the same locks.

[RISK ASSESSMENT]
[Overall PR] ⚠️ Risk Assessment: 🔴 HIGH
This PR adds a schema migration on v1_remote_sandbox, a new base class shared by three sandbox backends, and a new concurrency pattern: SELECT … FOR UPDATE held while provider calls run, until the caller's transaction ends. The migration itself is low risk: now() is a stable default, so adding the columns is a metadata-only change, and the replicated install validation passed. Most of the risk is in the lock scope and transaction boundaries.
Recommendation: Do not auto-merge. A human reviewer should check how long the row locks are held on the long-lived sessions (conversation start, and the part 5 worker), as well as fix finding 1.

Verdict: Request changes. Finding 1 is a regression with a reproduction.

Key insight: pause_old_sandboxes calls the public pause_sandbox, so the resume transition now runs a nested pause on the same sandbox inside its own lock. The sandbox being resumed should be excluded from pause_old_sandboxes. Otherwise the outcome depends on how quickly each provider reports state changes.

Improve this review? If feedback seems incorrect or irrelevant, update the repository's .agents/skills/custom-codereview-guide.md (with the /codereview trigger), then re-request review. The reviewer reads the guide from the PR head.

Resolve with AI? Install the iterate skill and run /iterate.

Was this review helpful? React with 👍 or 👎.


This review was generated by an AI agent (OpenHands) on behalf of @aivong-openhands.

# Pausing old sandboxes locks their rows, so it runs before this row is
# locked. Otherwise two resumes of running sandboxes could each hold
# one row while waiting for the other's.
await self.pause_old_sandboxes(self.max_num_sandboxes - 1)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 Resuming a running k8s sandbox can suspend it, and the API still reports success.

This now runs for every backend before the provider's status check. When sandbox_id is one of the user's oldest running sandboxes, pause_old_sandboxes pauses it here: the row is marked paused and the k8s Sandbox is patched to Suspended. The claim's Ready condition only flips after the controllers reconcile, so K8sAgentSandboxService._resume_at_provider still sees RUNNING, returns ALREADY_DONE, and the code below calls mark_running and returns True. The pod is then deleted while the API and the row both say it's running.

Reproduced with FakeAgentSandbox, changing only set_operating_mode so it doesn't update the claim condition right away, and max_num_sandboxes=1:

resume_sandbox(CLAIM_NAME) -> True
row.lifecycle_state        -> 'running'
k8s.modes                  -> [('openhands-agent-server-abcde', 'Suspended')]

On main, k8s returned before pausing old sandboxes when the target wasn't paused, and test_resume_of_a_running_sandbox_does_nothing asserted pause_old_sandboxes wasn't called. This PR removed that assertion. Docker and E2B only get away with it because their resume reverses the pause right away. They still pause and resume the target for no reason.

Smallest fix: leave the target out, e.g. give pause_old_sandboxes an exclude_id and call it with sandbox_id here. Then restore the k8s assertion that resuming a running sandbox leaves k8s.modes == [] at the limit.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified against 52b8e8a: this is valid.

pause_old_sandboxes(max - 1) counts the target, since it's RUNNING. With max_num_sandboxes=1 it pauses the target itself. The nested pause_sandbox runs in the same transaction, so the row lock doesn't block it. mark_paused changes the same stored_sandbox object, and the Sandbox is patched to Suspended.

It's also wider than a lagging Ready condition. _claim_status only returns PAUSED when the reason is exactly Suspended. While the condition is between states, the claim reads as STARTING, so _resume_at_provider returns SKIPPED. resume_sandbox then returns True with the sandbox suspended and the row paused. The only safe case is a condition that already reads Suspended, and that case still does a pointless suspend and resume.

On main, k8s returned before pause_old_sandboxes when the claim wasn't paused, so this is a regression.

@aivong-openhands aivong-openhands Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Created followup issue #616

sandbox_id = stored_sandbox.id
info = await self._get_info(sandbox_id)
if info is None:
return ProviderOutcome.FAILED

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 One transient E2B lookup error now fails the whole resume.

_get_info returns None for any SandboxException, not only not-found. So a single transient API error here returns FAILED, and the router returns 404 for a sandbox that exists. Before this PR, the same kind of error was retried resume_retries times by the connect loop below.

Suggested fix: if info is None, run the connect loop anyway and let SandboxNotFoundException there decide FAILED. Report CHANGED when the earlier state is unknown. mark_running is safe to call on a row that's already running.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified against 52b8e8a: this is valid.

_get_info returns None for any SandboxException, not only SandboxNotFoundException. The pre-check then returns FAILED before the retry loop runs, and the router turns that into a 404. On main there was no pre-check, so the same error went through connect and was retried resume_retries times.

One caveat on the suggested fix. mark_running resets state_changed_at and last_active_at, so reporting CHANGED when the state is unknown would bump those timestamps on a row that's already running. Returning ALREADY_DONE after a successful connect gives the right row in both cases: the base only calls mark_running when the row doesn't already say running.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Created followup issue #617

@aivong-openhands aivong-openhands left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving as we can address the findings issues as a fast follow

@aivong-openhands
aivong-openhands force-pushed the jl/sandbox-lifecycle-columns branch from 4a71422 to 3364580 Compare October 5, 2026 18:21
@aivong-openhands
aivong-openhands merged commit 6a19624 into main Oct 5, 2026
19 checks passed
@aivong-openhands
aivong-openhands deleted the jl/sandbox-lifecycle-columns branch October 5, 2026 18:41
hieptl added a commit that referenced this pull request Oct 6, 2026
…#667)

Merging main into this branch brought in #599's
175_add_sandbox_lifecycle_columns.py. It declares revision 175 on top
of 174, the same as this branch's 175_add_org_status.py. Alembic keeps
only one file per id and then reports two heads (175 and 178), so
alembic upgrade head fails. The migration check fails on the duplicate
revision, and every backend test run stops while building the template
database.

- Rename 175_add_org_status.py to 179_add_org_status.py and chain it
  after 178. The chain is now 174 -> 175 (main's sandbox lifecycle
  columns) -> 176 -> 177 -> 178 -> 179.
- Move only this migration. 176-178 don't use org.status, and main's
  175 can't change because deployed databases have already applied it.
- Update the docstring's Revision ID and Revises to match.
@openhands-release-bot

Copy link
Copy Markdown
Contributor

🚀 Released in 1.69.0.

hieptl added a commit that referenced this pull request Oct 8, 2026
…pdates (#621)

* feat(frontend): add OpenHands-Neo theme tokens and scoped UI root

Wire agent-canvas-style --oh-* / cool-grey tokens, AgentServerUIRoot, and neo palette application so the SaaS shell can share the same theme foundation.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(frontend): add shared settings and form layout class helpers

Port agent-canvas layout utilities so settings-like pages can reuse the same form, list, and sidebar spacing classes.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(frontend): restyle settings navigation for OpenHands-Neo

Match agent-canvas settings chrome with tokenized nav links, logo header, bottom user menu, and settings-owned gutters.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(frontend): tokenize organization settings pages for neo theme

Restyle org management, members list, and git org rows with shared settings list/form tokens and updated mocks/tests.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(frontend): tokenize budgets and usage dashboard for neo theme

Replace hardcoded greys with base/surface/muted/primary tokens so budgets and usage monitoring match agent-canvas.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(frontend): tokenize shared chrome components for neo theme

Update spinners, badges, chips, context menus, and related shell controls to use --oh-* / muted tokens instead of hardcoded greys.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(frontend): align toast handlers with agent-canvas

Use neo toast tokens, custom CircleX error layout, loading helper, and route call sites through the shared handlers.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(openhands-ui): restyle toasterMessages for neo theme

Replace the pill toast chrome with agent-canvas-aligned surface, border, radius, and status icon colors.

Co-authored-by: Cursor <cursoragent@cursor.com>

* docs: add neo theme component audit notes

Track remaining hardcoded hex surfaces for follow-up tokenization work.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(frontend): align settings shell and neo theme chrome

Restyle the settings rail (sidebar, drawer, white brand mark), forms, integrations, and related surfaces to match OpenHands-Neo tokens and agent-canvas patterns.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(frontend): polish settings nav scope and continue neo UI work

Clarify Personal settings as org-scoped (This org chip), fold Integrations
and Skills into that section, and move User/Application to the bottom.
Continue settings shell, credits, MCP, and chrome alignment.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(frontend): refine neo skeletons and select-style dropdown toggle

Improve loading skeleton fidelity and stagger, and let non-searchable
dropdowns click-open/click-close like other selects.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(frontend): stop LLM profile rows clipping on mobile

Override the shared fixed list-row height and keep the Default badge
inline with the profile name so stacked mobile content no longer
overflows the overflow-hidden profiles list.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(frontend): align settings tests with neo UI behavior

Update frontend tests for neo chrome (toasts, dropdowns, budgets, git settings) and show the org-wide badge on budgets/credits.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(frontend): rename settings nav brand label to Account

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(frontend): reorder org settings nav and add create-org action

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(frontend): add Super Admin shell and polish usage dashboards

Introduce the Super Admin routes and layout with settings-aligned gutters, put Super Admin atop the account menu, and improve dashboard charts with hover tooltips plus a one-line filter toolbar.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat: gate Super Admin dashboard behind ENABLE_SUPER_ADMIN

Add an env/web-client feature flag so Super Admin entry points and /super-admin routes stay off until explicitly enabled (true/1), while mock SaaS and instance Super Admins can use the existing dashboard UI.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat: wire Super Admin live APIs with org suspend usage blocks

Replace Super Admin directory mocks with /api/admin endpoints, add org.status suspend/resume that blocks product and resolver traffic at effective-org resolution, and let instance Super Admins still open and administer suspended orgs.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat: wire Super Admin conversation list and stop actions

Fetch live org conversations into the Super Admin usage dashboard and call the org stop API instead of a local UI-only timeout.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix: tighten Super Admin access and show provision credentials

Gate Super Admin UI on manage_super_admins only, and surface one-time password plus API key after provisioning a user.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat: add the first-install Super Admin onboarding flow

Walk a fresh install through welcome, terms, and account creation, then into the setup guide, so the first Super Admin can finish setup without the settings chrome.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat: start mock API in preview builds

Let VITE_MOCK_API turn on the mock worker outside local dev so a static preview can walk through onboarding without a backend.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat: let Super Admins change membership in specific organizations

A user can be suspended, resumed, removed, or added in one or more groups, and the first-run setup guide stays closed on the setup page.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(frontend): put the resolver list on personal Integrations

Show Git and project-management providers on /settings/integrations with the configure modals from the resolver design, and send old Integrations Hub resolver URLs there.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(frontend): give Super Admin row menus a solid panel

The popover menu style was missing, so organization, user, and admin row actions drew as loose text over the table.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(frontend): require Super Admins to join an org before opening it

Opening an organization they are not an active member of asks them to grant themselves access, defaulting to the admin role.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(frontend): rebuild Super Admin manage user around org access

The dialog now shows the person, their org roles, and an add-to-org step, and a Super Admin can change a membership role in place.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(frontend): pick a role per org when provisioning a user

Each organization is added from a role menu and can be removed before submit, and that role is sent with the provision request.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(frontend): guide first install through company, org, and LLM setup

Super Admins name their company and first organization, then land on LLM setup with a starter prompt. The install screens share a progress bar, footer, and an optional instance logo.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(frontend): open Super Admin from the organization menu

The organization switcher now includes Super Admin Dashboard and stays on that screen, and the first-run starter modal can pick models before setup continues.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(frontend): keep the active setup step open while previewing another

The starter modal now holds the pinned accordion open, and the header, trial note, and last step read as part of the same first-run flow.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(frontend): pin the Super Admin dashboard link in the org menu

Super Admins get a distinct dashboard link above Create organization so it stays visible apart from the workspace list.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(frontend): restyle MCP servers and pin Super Admin in the org menu

Show MCP servers as integration-style rows with display names and known logos, and keep the Super Admin link at the top of the org menu with its shield in the closed field.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(frontend): add a mock catalog of the Super Admin screens

Give reviewers one page that opens each install, guide, and dashboard screen, and switch that page's own copy between English and Chinese.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix: make the Python, frontend test, and lint checks pass

- Extract the org suspension lookup used by require_permission into
  is_org_suspended and default it in the route-test conftest the same way
  the super-role lookup is defaulted. Stub the lifecycle gate and the
  membership lookup in the other unit tests that now reach the database,
  which has no sqlite fallback on main.
- Keep ContextMenuContainer open for clicks inside portalled children, so
  picking an organization in the dropdown no longer closes the user menu.
- Resolve the ESLint and prettier findings in the Super Admin files.

* fix(super-admin): stop redirecting /super-admin into the install wizard (OHE-3462) (#636)

The dashboard layout sent a Super Admin to /install unless this
browser's localStorage (oh-sa-nux) said the install wizard was
finished. The wizard's last step creates an organization, so opening
the dashboard on a new browser meant creating another one, and there
the default name was already taken.

- super-admin-layout: remove the wizard redirect, the oh-sa-nux
  subscription, and the catalogPreview check that only existed to skip
  it. Access still depends on ENABLE_SUPER_ADMIN and
  manage_super_admins, and everyone else is still sent to /settings.
- Stop seeding all five wizard steps in the layout test, and add a
  test that the dashboard opens with no wizard progress.

The floating setup guide and the starter modal keep their own
conditions. The starter modal opens from a one-shot flag set by the
wizard's last step, on /settings/org-defaults, which any org admin can
reach.

* fix(onboarding): flag-gate /install and remove the persona checklist (OHE-3471) (#637)

Three onboarding surfaces were not behind ENABLE_SUPER_ADMIN: the
/install wizard, the "Setup guide" card in the Settings sidebar, and
the floating "Product tour" button. With the flag off, every SaaS-mode
user still got the card. Members and personal-workspace owners could
never finish or dismiss it: nothing marked "Start first conversation"
done, "Invite teammates" is impossible in a personal workspace, and
"Finish" stays disabled until required steps are done.

- super-admin-install-layout: add a clientLoader that redirects /install
  to / when enable_super_admin is off.
- Remove the persona checklist (sidebar card and
  /settings/getting-started) and the product tour, per D5 in OHE-3461.
  Neither is in OHE-3384's scope. The Super Admin setup guide, already
  behind the flag and dismissible, is now the only checklist.
- Remove what only they used: setup-readiness, use-org-setup, their
  route and tests, 62 SETUP$/PRODUCT_TOUR$ i18n keys
  (PRODUCT_TOUR$DONE stays, the user groups modal uses it), and their
  entries in the mock-only setup test panel and UI catalog.
- Add tests that /install redirects away with the flag off and shows
  the wizard with it on.

* feat(super-admin): create organizations with an initial owner (OHE-3476) (#638)

The create-organization dialog labeled its fields "Owner name" and
"Owner email", but POST /api/organizations only stored them as contact
fields and created no membership, so every new organization started
with zero members. The frontend then switched the Super Admin into it,
which the Super Admin bypass in switch_org allows.

- OrgCreate takes an optional owner_user_id: the caller or an existing
  user. When set, the route checks that the user exists (404 if not)
  and creates the org through create_org_with_owner with
  add_creator_as_owner=True, the same path the default-org bootstrap
  uses: the owner joins the LiteLLM team, gets a key, and the owner
  membership is persisted with the org. Without the field, the call is
  unchanged.
- The dialog gets an Owner picker that defaults to the current user and
  lists the other users from /api/admin/users. The contact fields are
  labeled as contact fields again, the description and required-fields
  message go back to the main wording, and the unused ORG$OWNER_* keys
  are removed.
- useCreateOrganization no longer switches into an organization owned
  by someone else. With no owner (the /install wizard), it still
  switches as before.
- The mock create handler honors owner_user_id for another user; the
  no-owner case is left to OHE-3469.
- Add route tests for the caller, another existing user, and an unknown
  owner, and modal tests for the default owner and choosing another
  user.

* fix(super-admin): hide Provision User when provisioning is off (OHE-3480) (#639)

The Users page always offered "Provision User", but
POST /api/organizations/provision-user is only registered when
USER_PROVISIONING_ENABLED is set. That is an OEM option and is off by
default, so on a normal install the form ended in a 404. The mock
always answered, so the demo hid it.

- The web-client config gets a top-level user_provisioning_enabled
  field. It reads server.constants.USER_PROVISIONING_ENABLED, the same
  value saas_server uses to register the route, so the two cannot
  disagree.
- The Users page shows the button only when the field is true. When it
  is false, the subtitle reads "Review users across all organizations."
  instead of "Provision and review users across all organizations."
- The mock config reports provisioning on in mock SaaS mode, so the
  demo flow still works.
- Add a config test for both values of the switch, and Users page
  tests for the button and subtitle with provisioning on and off.

* fix(super-admin): confirm before destructive dashboard actions (OHE-3484) (#640)

Deleting or suspending an organization, revoking a Super Admin, and
removing a user from organizations all ran on a single click. The row
menu calls an item's handler as soon as it is clicked, and these
handlers called the API directly. Only "Delete user" asked first.

- Organizations page: Remove opens the same confirmation as the delete
  in organization settings, naming the organization. Suspend opens a
  confirmation that names the organization and says its members cannot
  use it until it is resumed.
- Admins page: Revoke opens a confirmation naming the Super Admin.
- Manage User modal: bulk and per-row membership Remove show an inline
  confirmation naming the user and the organizations, like the existing
  "Delete user" step in the same modal.
- Cancel closes the confirmation without calling the API.
- Add Organizations and Admins page tests and extend the Manage User
  modal tests. The existing remove assertions now confirm first.

* fix(super-admin): protect personal workspaces and the acting admin (OHE-3485) (#641)

The dashboard treated personal workspaces like team organizations and
let a Super Admin act on their own account. Removing the admin's own
personal workspace deleted their user record, and the Super Admin role
with it, which got around the rule that the last Super Admin cannot be
removed. "Grant yourself access" could add the admin to another user's
personal workspace, because the backend only rejected the target
user's own workspace. Removing a user from their personal workspace
was skipped silently while the UI reported success.

- Admin API: reject suspending or deleting a personal workspace, adding
  anyone to a personal workspace, and removing a user from their own
  personal workspace instead of skipping it. Reject suspending your own
  account and removing yourself from every team organization. Each
  returns 403.
- Organizations page: another user's personal workspace has no open
  link and no actions menu. Your own personal workspace offers only
  View.
- Users page: another user's personal workspace is not a link.
- Manage User modal: the user's own personal workspace is no longer
  listed as a group. Suspend account and Delete user are disabled when
  you manage yourself.
- Add a backend test for each rejected case and frontend tests for the
  hidden and disabled actions. Three existing route tests now patch the
  personal-workspace lookup.

* fix(super-admin): run the standard cleanup on dashboard removals (OHE-3486) (#642)

Removing a user from an organization in the Super Admin dashboard
deleted the membership row and nothing else. The Members page removal
also resets the user's current organization when it pointed at that
organization, and removes the user from the organization's LiteLLM
team. The dashboard skipped both, so a removed user could be left with
a current organization they no longer belong to and keep their LiteLLM
team membership. The dashboard could not reuse remove_org_member,
which requires the caller to be a member who outranks the target.

- Move the row delete, current-org reset and LiteLLM team removal out
  of OrgMemberService.remove_org_member, unchanged, into
  remove_member_with_cleanup. remove_org_member keeps its checks and
  calls it.
- Both dashboard removals, DELETE /api/admin/users/{id} and the
  "remove" action on /groups, call it instead of deleting the row
  directly. Their own checks are unchanged.
- Add a route test for each that asserts the current-org reset and the
  LiteLLM team removal.

* fix(super-admin): show real instance values and link the SSO docs (OHE-3482) (#643)

The Instance page had no link to the SSO documentation, which the
dashboard ticket asks for. Its "Allow users to have personal workspace"
switch was hard-coded off whatever the deployment said, and the page
still called its controls "local stubs" although the email switch
already read the real config. The setup guide's optional SAML stop also
highlighted the "Show Setup guide" switch, because that selector came
first in its anchor list.

- Instance page: add a "Single sign-on (SAML)" entry that links to the
  SAML SSO guide on docs.openhands.dev in a new tab.
- The personal-workspace switch now reads hide_personal_workspaces from
  the web-client config (HIDE_PERSONAL_WORKSPACES). It stays read-only.
- Remove the "These controls are local stubs" hint and its i18n key.
- Setup guide: the tour's optional SAML stop highlights the new SSO
  entry.
- Add Instance page tests for the docs link and for the switch with
  personal workspaces shown and hidden.

* feat(super-admin): store the company name and logo on the server (OHE-3467) (#644)

The company name and logo set in the first-install wizard and on the
Super Admin Instance page lived only in the localStorage of the browser
that set them. Other users, and the same admin on another browser,
never saw the logo, and clearing site data lost it. The backend had no
instance-level settings to keep them in.

- Add a single-row instance_settings table (migration 176) for the
  company name and the logo, stored as the client-resized data URL.
- GET /api/admin/instance-settings returns them to any signed-in user.
  PATCH requires MANAGE_SUPER_ADMINS, changes only the fields it is
  sent (null clears one), and accepts only a PNG, JPEG or WebP data
  URL of at most 512 KB.
- The Instance page and the logo beside the product mark read and
  write through the API. The read runs only when ENABLE_SUPER_ADMIN is
  on, so other deployments make no extra request. The localStorage
  logo store is removed.
- The wizard's company step saves the name and any newly chosen logo
  on Continue, shows the saved logo when the admin comes back to the
  step, and stays on the step if saving fails.
- Add mock handlers for both endpoints, and update the UI catalog copy
  that said the logo is never uploaded.
- Add route tests for sign-in, permission, partial updates, visibility
  to other users and invalid values, and frontend tests for the
  Instance page, the settings navigation logo and the company step.

* fix(super-admin): gate the admin directory and require org membership (OHE-3483) (#645)

ENABLE_SUPER_ADMIN only hid the UI. The /api/admin directory routes
were always mounted, and authorization changed on every deployment,
flag on or off: an instance Super Admin passed every permission the
organization owner role has, in any organization, without being a
member. That covered organization secrets, API keys, billing and LLM
settings. /me returned a made-up owner record for them, and they could
switch into organizations they did not belong to. This contradicted the
model documented in authorization.py and OHE-2605, and the service
layer still required membership, so the access only half worked. The
dashboard already asks the admin to grant themselves access before
opening an organization, so explicit join is the model kept here.

- Mount the /api/admin directory router (organizations, users,
  instance-settings) only when ENABLE_SUPER_ADMIN is on. The
  super-admins API, create-organization and provision-user stay
  mounted.
- Remove the owner-level fallback from require_permission and
  authorize_permission. A Super Admin who is not a member gets only
  the explicit super-role permissions.
- Remove the made-up /me record (MeResponse.for_instance_super_admin).
  get_me raises not-found for non-members again.
- switch_org requires membership for everyone again. The suspended-org
  and inactive-membership rules are unchanged.
- Return the superadmin permission set to main's. VIEW_ORG_CONVERSATIONS,
  which the dashboard overview needs to read usage across
  organizations, is granted only while the flag is on.
  DELETE_ORGANIZATION and VIEW_ORG_SETTINGS are dropped: the dashboard
  deletes through /api/admin, and the regular delete still requires an
  owner, so the extra permission only showed a Delete button that
  failed.
- Tests state the model: a non-member Super Admin is refused org
  secrets, API keys, billing and org settings edits, /me raises
  not-found, switch_org refuses them, the dashboard permission follows
  the flag, and the directory routes are served only with the flag on.

* docs(super-admin): name both variables that turn the flag on (OHE-3487) (#646)

The comment on enable_super_admin told operators to set
ENABLE_SUPER_ADMIN=true. That only works when no
OH_WEB_CLIENT_FEATURE_FLAGS_* variable is set. Replicated and every
saas-deploy environment set several, and then the web-client flags are
built from those alone, so the bare variable never reaches
enable_super_admin and the dashboard stays hidden. The server still reads
only the bare variable to mount the /api/admin directory, so a
deployment needs both.

- web_client_models.py: name both variables and say what each one
  drives. Comment only.

* feat(super-admin): store first-install and setup-guide state on the server (OHE-3463) (#647)

The first-install wizard and the Super Admin setup guide kept their
state only in browser localStorage. The server could not tell whether
an instance still needed setup, who should do it, whether they had
finished, which organization the guide belonged to, or whether it was
dismissed, and Agent Canvas could not read any of it. The per-user
onboarding_completed flag cannot answer this: OHE never clears it, and
its self-hosted first-owner check matches every personal workspace.

- Add setup_user_id, wizard_completed, guide_org_id and
  guide_dismissed to instance_settings (migration 177). guide_org_id
  is cleared when its organization is deleted.
- create_user records the first user, the one it makes Super Admin,
  as setup_user_id while ENABLE_SUPER_ADMIN is on. Upgraded instances
  and instances first used with the flag off record no one.
- GET /api/admin/setup-state returns the wizard and guide state for
  the caller. Only the first Super Admin gets real values; everyone
  else gets the defaults. PATCH changes only the fields it is sent,
  is limited to the first Super Admin, and returns 404 for an unknown
  organization.
- Add the frontend service methods, useSetupState (runs only with
  enable_super_admin), useUpdateSetupState and mock handlers.
- Add route tests for sign-in, an instance with no recorded setup
  user, the first Super Admin, a later admin, a completed wizard,
  guide org and dismissal, the 403 and 404 cases and org deletion;
  user store tests for recording the first user with the flag on and
  off; and hook tests for reading, the flag-off case and updating.

* fix(super-admin): drop the install account step and require sign-in (OHE-3465) (#648)

The first-install wizard asked for a name, an email and a password to
"create your Super Admin account", but created nothing: the name and
email went to localStorage and the password was dropped. The server
has no way to create that account either. It has no password login,
and the Keycloak realm turns off registration and password sign-in.
The first user already becomes Super Admin when they first sign in
through the identity provider, and #647 records them as the setup
user at that point. So the wizard now runs after sign-in, as that
user, instead of pretending to create one.

- Remove the account step: its route, its place in the NUX state and
  the step bar, its intermediate-page entry, the mock harness jump and
  the 15 i18n keys only it used. Terms now continues to company.
- The org step took the new org's contact name and email from the
  account step. It now reads them from the signed-in user's personal
  workspace, which holds the name and email from sign-in. Without
  that, its admin@localhost fallback fails the backend's email check.
- The install layout's loader sends a signed-out visitor to
  /login?returnTo=<path>, the same URL the root layout uses. Only a
  401 counts as signed out; other errors still surface.
- Update the UI catalog entries and their zh-CN/zh-TW copy that
  listed the account step, and the two tests that referenced it.

* fix(super-admin): drop the install terms step and rely on /accept-tos (OHE-3466) (#649)

The first-install wizard showed twelve paragraphs of placeholder terms
labelled "Placeholder draft" and kept acceptance only in localStorage.
It was also a second acceptance. Both login callbacks send a user who
has not accepted the terms to /accept-tos, which records them with
POST /api/accept_tos. Until then the auth middleware rejects every API
call except that one, including the /api/authenticate check the
install layout has run since #648. So the wizard cannot load before
the real terms are accepted, and its own terms step could only ask
again.

- Remove the terms step: its route, its place in the NUX state and the
  step bar, its intermediate-page entry, the mock harness jump and the
  3 i18n keys only it used. Welcome now continues to company, and the
  step bar has five steps.
- Update the UI catalog entries and their zh-CN/zh-TW copy that listed
  the terms step, and the two tests that referenced it.

* feat(super-admin): route the first Super Admin into /install and guard it (OHE-3464) (#650)

A fresh install had no way into the first-install wizard. Sign-in only
knew about the /onboarding survey, and on OHE that page bounces straight
back out because enable_onboarding is off. /install itself only checked
that the flag was on and the visitor was signed in, so anyone could
open it at any time, and its last step never told the server the wizard
was done. #647 stored that state on the server, but nothing used it yet.

- Sign-in: _get_post_auth_redirect sends the first Super Admin to
  /install while the wizard is unfinished. New users reach it through
  /accept-tos on both the Keycloak and the OAuth v2 path. The Keycloak
  callback does the same for a returning first Super Admin, in the
  branch that already checks for onboarding.
- The wizard replaces the onboarding survey for that user (D3 in
  OHE-3461): _should_redirect_to_onboarding returns false for them, so
  /api/onboarding_status no longer sends them to /onboarding either.
- With ENABLE_SUPER_ADMIN off the setup row is never read, and instances
  with no recorded first Super Admin behave as before.
- /install: the loader fetches the setup state and redirects to / unless
  the wizard is pending for the caller. If this browser holds finished
  progress the server doesn't (an earlier install on the same host), it
  clears it so the wizard can run.
- The org step, the wizard's last, records wizard_completed after it
  creates the organization, so the wizard doesn't come back on another
  browser. If that fails, the admin stays on the step with an error.
- The mock setup state starts pending, like a fresh install.
- Tests: the post-auth redirect for a pending, a finished and another
  user and with the flag off, against Postgres; the Keycloak callback
  for a returning first Super Admin; the /install guard; the org step
  recording completion and failing to.

* fix(super-admin): make the Super Admin the owner of the first organization (OHE-3469) (#651)

The wizard's org step created the first organization without an owner.
Since #638, POST /api/organizations adds an owner membership only when
owner_user_id is sent, so the new org had no members. The create hook
then called /switch, which the server refuses for non-members, ignored
the error and selected the org in the browser anyway. The Super Admin
landed on org LLM defaults for an org they weren't in: reads and saves
returned 404 and the org was missing from their switcher. The mock hid
this by making the creator the owner.

The default-org bootstrap (D4 in OHE-3461) only runs from the Keycloak
callback, and that path is going away (OHE-3293), so the fix lives in
the wizard and works whatever the sign-in path.

- Org step: on submit it reads the org list. If the Super Admin already
  belongs to a team org (the default-org bootstrap's, or one an earlier
  attempt created before recording completion failed), it renames that
  org. Otherwise it creates one with owner_user_id set to the Super
  Admin, whose id is their personal workspace's id. It never creates a
  second org.
- It then switches into the org and only then records wizard_completed.
  If the server refuses the switch, the admin stays on the step with
  the error and can retry. One submitting flag covers the whole step.
- useCreateOrganization selects the new org locally only after /switch
  succeeds.
- Mock: POST /api/organizations adds the current user only when
  owner_user_id is theirs, and no longer switches into the new org,
  like the real endpoint.
- Tests: the org step creating an org owned by the Super Admin, renaming
  an org they already belong to, and staying put when the switch is
  refused; the create dialog staying in the current org when the switch
  is refused.

* fix(super-admin): drop the install license-key box and its trial copy (OHE-3468) (#652)

The company step of the first-install wizard had a license-key box
that did nothing. Connect kept the typed key in component state, and
Continue saved only a hasLicenseKey boolean to localStorage that
nothing reads. The key was never validated, sent or stored, yet the
screen promised "a 30-day trial" or "the evaluation trial". Its
Register and Login buttons opened two hard-coded external URLs, one
of them the Replicated customer portal.

The enterprise backend has no license endpoint, and Replicated
installs already require a license: every image is pulled through the
license's proxy registry path. So this removes the box, as D6 in
OHE-3461 recommended, instead of building a check.

- Company step: remove the license-key input and Connect button, both
  trial messages, the Register and Login buttons, and the two URL
  constants. Saving the company name and logo is unchanged.
- NUX state: remove hasLicenseKey from the company entry, its setter
  and the mock harness presets.
- i18n: remove the 7 keys only the box used, and reword
  SA_NUX$COMPANY_BODY and SA_NUX$STEP_COMPANY_DETAIL, which still
  mentioned licensing.
- Update the UI catalog's company entry and its zh-CN/zh-TW copy, and
  the one NUX test that passed hasLicenseKey.

* feat(super-admin): save the starter modal's LLM to the org profile (OHE-3470) (#653)

The starter modal on org LLM defaults let the Super Admin pick a
provider, models and an API key, but the lists were hard-coded and
"Get started" only cleared the local starterModalPending flag. Nothing
was saved, so the organization kept its previous LLM.

The modal now uses the same model catalogue and the same three calls as
the org LLM form. Saving a profile with an explicit llm and activating
it would only change the caller's member settings, so the org defaults
are saved first, as the form does.

- Starter fields: providers and models come from the config search API,
  with hidden aliases left out and verified models first. The model menu
  keeps its look but picks one model: each row is a radio and the All
  action is gone, since a provider can list more models than an org can
  hold profiles. The list scrolls past a fixed height.
- The API key field follows the form's rule: hidden for OpenHands
  models and when allow_user_llm_configuration is off. Changing the
  provider clears the model and the key.
- Get started saves the org settings with the model, a null base_url
  and the typed key, saves a profile that copies them, activates it,
  marks the guide's add-llm step and closes. It stays disabled until a
  model is chosen and the org is known. A failure shows the server's
  message in the modal and keeps it open. Skip still saves nothing.
- Catalog: the starter card no longer says models are checkboxes with
  All.
- Tests: the list comes from the server, Get started waits for a model,
  saving runs the three calls and closes, a failed save stays open with
  the error, Skip saves nothing, and no key is asked for when user LLM
  configuration is off.

* feat(super-admin): derive setup-guide progress from server data (OHE-3472) (#654)

The Super Admin setup guide kept its progress and visibility in one
localStorage key, so it was per browser and not tied to an
organization. Only "create organization" and "add an LLM" were ticked
by real actions, and the LLM tick fired for any organization. The other
steps were checkboxes the admin ticked by hand. The floating widget
also waited on this browser's own wizard key, so it never showed on
another browser. #647 stored the guide's organization and dismissal on
the server, but nothing set the organization and the guide still read
only localStorage.

- setup-state: GET and PATCH return guide_steps for the first Super
  Admin while the guide has an organization and is not dismissed. Each
  step is read from what that organization really has:
  - org_llm: a saved LLM profile other than the Default one every org
    is seeded with.
  - mcp_server: the first Super Admin has an MCP server in the org. MCP
    servers belong to each member.
  - invite: a second member, or a pending invitation that has not
    expired.
  - automation: the automation service lists one for the org.
    Automations live in that service's own database, so the caller's
    cookie or Authorization header is forwarded with X-Org-Id. If the
    service is not configured or the call fails, the step stays undone.
- The wizard's org step saves guide_org_id with wizard_completed, so the
  guide belongs to the organization the Super Admin owns.
- The guide page, its sidebar card and the floating widget read that
  state instead of localStorage. The widget no longer waits on the
  local oh-sa-nux key, and it re-reads progress on navigation and after
  an LLM save. The manual checkboxes are gone; each row shows a status
  circle with the same look.
- Remove setup guide and the Instance page switch save guide_dismissed
  on the server. The switch is disabled for Super Admins without a
  guide, since only the first Super Admin can change it.
- "Add an integration" now opens /settings/mcp and is checked by the
  MCP signal, matching the ticket's "connect MCP integrations" step.
  Its tour stop and hint follow. Optional SAML stays a link and does
  not count toward progress.
- Remove the oh-super-admin-setup store and the unused mark
  complete/incomplete strings. The tour still advances on the step
  event. Update the mock, the QA panel and the catalog copy.
- Tests: route tests against Postgres for each step, an expired
  invitation, the headers sent to the automation service and a failing
  service; frontend tests for the derived progress, SAML not counting,
  no guide for other users or after dismissal, removing and toggling
  the guide on the server, and the widget re-reading progress on the
  next page.

* fix(super-admin): align the setup guide's steps with the ticket (OHE-3473) (#655)

OHE-3384 asks the setup guide for four steps: configure the org LLM,
choose an automation template, connect MCP integrations and invite
users. The guide had six. "Create an organization" was always checked,
because the guide only exists once the install wizard has given it an
organization (OHE-3469). "Create first automation" opened the
automations list instead of the templates. Its tour stop went to "/",
which hard-redirects into Agent Canvas, so the tour ended there on an
anchor no page renders.

- The steps are now: add an LLM, choose an automation template, add an
  MCP integration, invite users, then the optional SAML link. Progress
  counts four steps.
- The automation step is "Choose an automation template". It opens
  /automations/templates, which lands on the Agent Canvas templates
  page. The link goes through the automations redirect rather than
  /canvas/..., because the cross-app redirect shows an error on a
  second in-app visit to the same /canvas URL.
- The tour drops the create-org stops and the cross-app automation
  stop. Starting the guide on a step that has no tour stop opens that
  step's page instead of restarting the tour at the LLM step.
- The create-organization modal no longer signals a guide step.
- Remove the organization step's strings. Update the setup subtitle
  and the UI catalog copy.

* fix(super-admin): make Delete user remove the account and its data (OHE-3477) (#656)

The dashboard's Delete user only removed the user from their team
organizations. The user row, the personal workspace, API keys, git and
Keycloak tokens, the LiteLLM user and the Keycloak account all stayed,
so the person could sign in again and every API key kept working. The
user row could not simply be deleted either: conversation, quota,
budget, Git claim and invitation rows hold foreign keys to it, and a
leftover legacy user_settings row re-creates the user on the next
lookup.

- Add UserStore.delete_user. In one transaction it deletes the user's
  conversations in every organization, API keys, git and Keycloak
  tokens, device codes, personal secrets, quota and budget rows,
  legacy settings and memberships, then the user row. Git claims and
  invitations the user made in a team organization pass to another
  owner of that organization, and the setup-user pointer is cleared.
- DELETE /api/admin/users/{id} now deletes the user. It still refuses
  self-deletion and the last owner of a team organization, and now
  refuses the last Super Admin through revoke_super_admin's locked
  check. Once the account is gone it removes the personal workspace,
  the LiteLLM user and the Keycloak account best effort, logging any
  failure.
- Manage User: the hint, confirmation and toasts describe a permanent
  delete, a successful delete also refreshes the Admins list, and the
  mock API drops the user.
- Replace the route tests for the old behaviour. Add route tests for
  the refusals and the cleanup order, Postgres tests for the cleanup
  steps, and a hook test for the Admins refresh.

* fix(super-admin): make Suspend account block sign-in and API keys (OHE-3478) (#657)

The dashboard's Suspend account only marked each of the user's
memberships inactive. The user could still sign in and use their API
keys, any new active membership un-suspended them, a user with no
memberships could not be suspended, and suspending a Super Admin did
nothing because Super Admins skip the membership check.

- Add user.is_disabled (migration 178). Migration 162 dropped the
  column of the same name when #181 was reverted.
- PATCH /api/admin/users/{id} now sets the flag instead of every
  membership status. It still refuses suspending yourself, and now
  refuses the last enabled Super Admin with a 409, checked under a
  FOR UPDATE lock. The directory reads the user's status from the flag.
- revoke_super_admin, which delete also uses, now requires another
  enabled Super Admin, so the instance cannot be left with only
  disabled ones.
- SaasUserAuth.get_instance rejects a disabled user, so API keys, the
  legacy cookie and the OAuth v2 cookie all get a 401 and the cookies
  are cleared.
- Sign-in refuses a disabled user with 401 account_disabled: the
  Keycloak path in DefaultUserAuthorizer, like blocked domains, and the
  OAuth v2 login callback before tokens are stored. Without this,
  auto-login would send them back to the identity provider in a loop.
- Manage User: a user suspended in every organization no longer shows
  as an inactive account, the account hint describes the new effect,
  and the mock API matches the server.
- Update the route tests for the old behaviour. Add Postgres tests for
  the flag and the Super Admin guards, and tests for get_instance, both
  sign-in paths and the Users page.

* fix(super-admin): explain a suspension to the affected user (OHE-3479) (#659)

A Super Admin can suspend an organization, a user's membership in one,
or the whole account, and the server enforces all three, but the
affected user was never told why. A refused sign-in showed the raw
callback JSON {"detail":"account_disabled"}. Requests in a suspended
organization failed with a 403 the frontend ignored, so /settings sat
on a loading skeleton and other calls showed raw toasts.

- Sign-in: both callbacks send a disabled user to
  /login?account_disabled=true instead of a 401 JSON, the way
  recaptcha_blocked already works, and the login page explains it. No
  tokens are stored and no cookie is set, as before.
- Suspended organization or membership: the response interceptor
  records a 403 "Organization is suspended" or "User membership is
  suspended" against the selected organization. A failed switch is
  left alone and stays a toast. The root layout then shows only a
  blocking modal that says what is suspended and who to contact, and
  lists the user's other organizations. Switching lifts it.
- Add the five strings in all 15 languages.
- Update the two callback tests for the redirect. Add tests for the
  login message, the block and the switch, the membership message, and
  the 403s the interceptor must ignore.

* feat(super-admin): invite a person into any organization from the dashboard (OHE-3481) (#661)

The PRD lets a Super Admin add someone to any organization by
invitation. The dashboard could only add people who already had an
account: "Add to org" in Manage user needs an existing user, and
"Provision User" is hidden unless USER_PROVISIONING_ENABLED is set. The
invitation API already lets a Super Admin who is not a member invite
into any organization, including as owner, and returns a link to copy.
Nothing on the dashboard called it.

- Reuse the Add Members modal. When the dashboard passes it a list of
  organizations, it shows an organization picker and offers the owner
  role. Settings > Members is unchanged.
- useInviteMembersBatch and usePendingInvitations take an optional org
  id and fall back to the selected org, as before.
- The Users page gets an "Invite by email" button. Each team
  organization's row menu on the Organizations page gets an "Invite by
  email" item with that organization preselected. Personal workspaces
  are not offered.
- With email delivery off, the modal shows each invite link to copy,
  as it already did in settings.
- Add the "Invite by email" string, mention inviting in both Users page
  subtitles, and add the dialog to the UI catalog.
- Add tests for the organization picker, the owner role, both entry
  points, the links shown when email delivery is off, and personal
  workspaces.

* test(super-admin): cover the untested admin actions, API client and usage hook (OHE-3489) (#663)

OHE-3489 asks for a test behind every Super Admin screen and admin
action. Its list of gaps predates the sub-PRs that dropped the account,
terms and license steps and added tests for most screens. What was
still untested: the add, set_role and resume membership actions, org
resume and account re-enable, two personal-workspace cases, the
structured feature-flag variable, the Admins page grant flow, Resume on
the Organizations page, the usage hook and the API client. Every
frontend test mocked the client, so a wrong URL, method or body could
not fail any of them.

Backend:
- add: creates a missing membership at the chosen role with the
  LiteLLM key, and reactivates a suspended one instead of adding a
  second row.
- set_role: changes the role on an existing membership and refuses to
  demote the last owner.
- resume: the existing suspend tests for memberships, organizations
  and accounts now also cover resume and re-enable.
- Deleting a user is not blocked by owning their personal workspace.
- The personal-workspace check runs against the database for a
  personal workspace and for a team organization.
- OH_WEB_CLIENT_FEATURE_FLAGS_ENABLE_SUPER_ADMIN turns the web-client
  flag on.

Frontend:
- superAdminService: each of the 15 calls sends the method, path, body
  and headers of its backend route, and the list calls unwrap their
  response envelopes.
- Admins: granting Super Admin by email closes the dialog and lists
  the new admin.
- Organizations: Resume runs without a confirmation dialog.
- useUpdateSuperAdminUserGroups and useUpdateSuperAdminUserStatus call
  the client and refresh the user list. useProvisionUserToGroups
  provisions each organization in order and leaves the password out
  when none is given.
- useSuperAdminUsage sums usage across team organizations only,
  fetches only the selected organizations, and requests every
  conversation for the year-to-date window.

* chore(super-admin): remove the mock and QA tooling and stale stub copy (OHE-3488) (#664)

The prototype's review tooling was still in the app. The UI catalog and
the setup test harness did nothing without VITE_MOCK_API, but their
routes, a persona override inside the Super Admin access checks, and an
ungated ?catalogPreview=1 bypass of the install step order all reached
production builds. The mock API also disagreed with the backend on
create-organization and provisioning, which is how OHE-3469 and OHE-3480
stayed hidden.

- Remove the /ui-catalog pages, the setup test harness panel and its
  persona override, the catalogPreview and forceOpen branches, the
  unused root-to-settings route and the sample usage data. The catalog's
  reviewer notes move to .pr/ui-catalog-review-notes.md.
- Move the Super Admin row types from super-admin-mock.ts to
  super-admin-types.ts.
- Start the mock worker in development only again, as on main.
- Drop "This UI is not wired to the API yet." from the grant dialog and
  delete the unused "stub data" hint.
- Mock create-organization like the backend: request validation, the
  owner lookup, the exact 409 message, and only the owner becomes a
  member. /me, switch and the organization list now respect membership.
- Mock provisioning like the backend: 405 when it is off, the target-org
  and personal-workspace checks, the requested password, and no
  re-enabling of suspended accounts.
- Delete the two tests whose subject is gone, and move the sample user
  rows into the one test that uses them.

* fix(super-admin): renumber the org status migration to 179 (OHE-3491) (#667)

Merging main into this branch brought in #599's
175_add_sandbox_lifecycle_columns.py. It declares revision 175 on top
of 174, the same as this branch's 175_add_org_status.py. Alembic keeps
only one file per id and then reports two heads (175 and 178), so
alembic upgrade head fails. The migration check fails on the duplicate
revision, and every backend test run stops while building the template
database.

- Rename 175_add_org_status.py to 179_add_org_status.py and chain it
  after 178. The chain is now 174 -> 175 (main's sandbox lifecycle
  columns) -> 176 -> 177 -> 178 -> 179.
- Move only this migration. 176-178 don't use org.status, and main's
  175 can't change because deployed databases have already applied it.
- Update the docstring's Revision ID and Revises to match.

* fix(super-admin): wait for sign-in before showing the setup guide (OHE-3497) (#668)

With ENABLE_SUPER_ADMIN on, a first-time user who accepted the Terms of
Service landed back on /login and could never finish signing up. The
setup guide widget is mounted around every root-layout page, including
/accept-tos, and its query reads GET /api/admin/setup-state whenever the
flag is on. On /accept-tos the session cookie still says
accepted_tos=false, so the auth middleware refuses the call with
TosNotAcceptedError. That is an AuthError, so the middleware also ends
the Keycloak session and deletes the keycloak_auth cookie. The
POST /api/accept_tos that follows has no cookie and gets a 401, the page
falls back to /, and the user is sent to /login. Acceptance is never
saved, so every retry loops.

- Mount the widget only when the user is signed in and not on an
  intermediate page (/accept-tos, /information-request, /install). The
  layout already skips the auth check on those pages for the same
  reason.
- Add root-layout tests: /accept-tos makes no setup-state call, and a
  signed-in page still loads the guide. The config is seeded into the
  query cache as PostHogWrapper does in the app, and the file uses the
  real intermediate-page hook instead of the global mock.

* fix(super-admin): open the automation templates after the starter modal saves the LLM (OHE-3499) (#669)

After the first Super Admin saved an LLM in the starter modal on
/settings/org-defaults, the modal closed and left them on that page. The
setup guide's next step, choosing an automation template, then needed
another click in the guide. saveLlm marked the LLM step done and cleared
the modal, but never navigated.

- After a successful save, navigate to the automation step's destination,
  read from SUPER_ADMIN_SETUP_STEPS (/automations/templates). The
  /automations/* route hands off to /canvas/automations/templates.
- Skip and a failed save stay on the page, as before.
- Render the modal tests through a router stub, and check that saving
  opens the templates page while skipping or failing does not.

* fix(super-admin): refresh the setup guide after adding an MCP server or inviting someone (OHE-3500) (#670)

After adding an MCP server, "Add an integration" stayed unchecked in the
setup guide until the page was reloaded, and "Invite users" did the same
after an invitation. The server already counts both at once. The guide
re-reads its progress only when the route changes or when
SUPER_ADMIN_SETUP_STEP_EVENT fires, and the query is cached for five
minutes. Both actions stay on the same page, and only the LLM saves fired
the event.

- Fire notifySuperAdminSetupStep("add-integration") when adding an MCP
  server succeeds on /settings/mcp.
- Fire notifySuperAdminSetupStep("invite-users") when an invitation
  succeeds. The invite modal is shared by Members settings and the Super
  Admin dashboard.
- Notify from the callers, as the LLM paths do, so the mutation hooks
  stay free of guide code.
- Test both events, and that the floating guide re-reads its progress on
  the event without a route change.

* fix(super-admin): show personal workspaces as Personal Workspace in the organizations table (OHE-3501) (#671)

The Super Admin Organizations table showed a personal workspace by its
stored name, user_<id>_org. Personal workspaces are created with that
name, and the admin API already marks them with is_personal. The rest of
the app shows ORG$PERSONAL_WORKSPACE when it is set (the org selector,
the suspended-workspace modal and the API key pages), but the table
copied org.name as is.

- Use ORG$PERSONAL_WORKSPACE for rows with is_personal. Team
  organizations keep their names, and the stored name does not change.
- The search and the confirmation text use the same label. The contact
  email column still tells personal workspaces apart.
- Add a test, and update the personal-workspace test that looked for
  user_7_org.

* fix(super-admin): show personal workspaces as Personal Workspace in the users table (OHE-3502) (#672)

The Super Admin Users table listed a user's personal workspace by its
stored name, user_<id>_org, in the Organizations column. OHE-3501 fixed
the Organizations table, but the users mapping copied each membership's
org_name as is. Membership rows carry no is_personal flag; a personal
workspace shares its owner's id, which is the rule the server and the
other Super Admin views already use.

- Use ORG$PERSONAL_WORKSPACE for a membership whose org_id equals the
  user's id. Team organizations keep their names, and the stored name and
  the API do not change.
- The users search and the open-organization prompt use the same label.
- Add a test, and update the personal-workspace test that looked for
  user_7_org.

* fix(super-admin): open Agent Canvas's MCP page from the setup guide's integration step (OHE-3516) (#685)

The Agent Canvas setup guide's "Add an integration" step now opens Canvas's
own MCP page (OpenHands/OpenHands#18066). The enterprise guide still sent
the admin to /settings/mcp, so the two guides opened different pages for
the same step. Canvas's MCP page saves to the same member settings the
mcp_server signal checks.

The guide opens steps with React Router's navigate. A /canvas/... URL
opened that way goes through routes/cross-app-redirect.tsx, which shows an
error page when the same URL is opened twice in a session. That is why
the automation step points at /automations/....

- Point "Add an integration" at /canvas/mcp.
- Open setup steps with navigateOrHardRedirect from Start, the floating
  guide and the setup page. A /canvas/... step gets a page load, and the
  other steps navigate as before.
- Remove the step's tour stop and its unused nav selector. The tour cannot
  follow into Canvas, the same as for the automation template step.
- Test that Start, the setup page row and the floating guide row open
  /canvas/mcp with a page load.

* feat(super-admin): open the next setup guide step when one is done (OHE-3525) (#702)

Finishing a setup step ticked its checkbox but left the Super Admin where
they were: the next step and its tour opened only from a click. The
completion event only made the floating guide re-read its progress, and an
open LLM tour carried on through its own stops to the invite tip, skipping
the two steps that live in Agent Canvas.

- When the guide's next step is reported done and the server confirms it,
  the floating guide opens the step after it the way Start does: its tour
  here, or its page in Agent Canvas. A step finished out of order or again,
  and the last required step, open nothing.
- Start and the hand-off show one step's tour, so the LLM tour ends when
  the LLM is saved.
- The tour engine ignores delayed callbacks from a tour that was stopped or
  replaced. driver.js keeps its state at module level, so they would have
  torn down the current tour.
- Links into Agent Canvas name the step in setup_tour, and a page opened
  with setup_tour starts that step's tour here.
- The starter modal leaves the next step to the guide.

* fix(migrations): move the Super Admin migrations after main's 179

Main's #708 added 179_add_integrated_idp_provider (revises 178), the
same revision id as this branch's 179_create_instance_settings. Alembic
saw duplicate revisions and two heads (179 and 182), so `upgrade head`
and the migration integrity check failed.

Main's migration has shipped, so this branch's four move up by one and
chain after it. Only the file names and revision ids change:

- 179_create_instance_settings -> 180 (revises 179)
- 180_add_setup_state_to_instance_settings -> 181
- 181_add_user_is_disabled -> 182
- 182_add_org_status -> 183

#708 only seeds an oauth_providers row, so the order does not change
what either side's migrations do.

* fix(settings): keep the Integrations settings page as it is on main (OHE-3535) (#711)

/settings/integrations rendered a new resolver list for every user, with
or without the Super Admin flag. It listed providers the instance has not
configured, connected GitLab and Azure DevOps through a fresh sign-in
instead of linking the account, offered no disconnect for GitHub, GitLab
or Azure DevOps, and dropped the link_status and Jira DC webhook messages
after the redirect back. It came from aaa8bc9180 ("put the resolver list
on personal Integrations"), which is not part of the Super Admin work.

The commit can't be reverted mechanically: later main merges changed the
same files. The neo-theme styling of these pages is already on main
(#174), so their main versions are the state before that commit.

- /settings/integrations renders git-settings.tsx again; the
  /settings/integrations-hub redirects go.
- git-settings.tsx, configure-modal.tsx, jira-dc-integration-panel.tsx,
  project-management-integration.tsx, integration-provider-icon.tsx and
  base-modal.tsx are back to main's versions.
- The resolver list, its modal shell and header, and its 20
  SETTINGS$RESOLVER_* translation keys are removed.

* fix(super-admin): skip suspension and disabled-user lookups when the flag is off (OHE-3536) (#713)

Every authenticated request had picked up database lookups for Super
Admin states, whether or not ENABLE_SUPER_ADMIN was on: the user's
disabled flag in get_instance, the org, membership and super role in
assert_org_usable_for_product, and the org's status plus an up-front
super-role read in require_permission and authorize_permission. With the
flag off only the Super Admin directory could set those states, and it
is not mounted, so the queries guarded nothing.

- With the flag off, get_instance skips the disabled check,
  assert_org_usable_for_product returns at once, and the permission
  checks skip the suspension lookup and read the super role only as the
  fallback, as on main.
- With the flag on the outcomes are unchanged. The super role is read
  up front only when the org is suspended, where it decides the Super
  Admin exemption.
- The suspension and disabled-user tests turn the flag on explicitly.
  New tests cover the flag-off path, and main's
  test_org_role_short_circuits_super_role_lookup is back.

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: hieptl <hieptl.developer@gmail.com>
Co-authored-by: Hiep Le <69354317+hieptl@users.noreply.github.com>
hieptl added a commit that referenced this pull request Oct 9, 2026
…users' conversations the same way (OHE-3527) (#703)

* feat(frontend): add OpenHands-Neo theme tokens and scoped UI root

Wire agent-canvas-style --oh-* / cool-grey tokens, AgentServerUIRoot, and neo palette application so the SaaS shell can share the same theme foundation.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(frontend): add shared settings and form layout class helpers

Port agent-canvas layout utilities so settings-like pages can reuse the same form, list, and sidebar spacing classes.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(frontend): restyle settings navigation for OpenHands-Neo

Match agent-canvas settings chrome with tokenized nav links, logo header, bottom user menu, and settings-owned gutters.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(frontend): tokenize organization settings pages for neo theme

Restyle org management, members list, and git org rows with shared settings list/form tokens and updated mocks/tests.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(frontend): tokenize budgets and usage dashboard for neo theme

Replace hardcoded greys with base/surface/muted/primary tokens so budgets and usage monitoring match agent-canvas.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(frontend): tokenize shared chrome components for neo theme

Update spinners, badges, chips, context menus, and related shell controls to use --oh-* / muted tokens instead of hardcoded greys.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(frontend): align toast handlers with agent-canvas

Use neo toast tokens, custom CircleX error layout, loading helper, and route call sites through the shared handlers.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(openhands-ui): restyle toasterMessages for neo theme

Replace the pill toast chrome with agent-canvas-aligned surface, border, radius, and status icon colors.

Co-authored-by: Cursor <cursoragent@cursor.com>

* docs: add neo theme component audit notes

Track remaining hardcoded hex surfaces for follow-up tokenization work.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(frontend): align settings shell and neo theme chrome

Restyle the settings rail (sidebar, drawer, white brand mark), forms, integrations, and related surfaces to match OpenHands-Neo tokens and agent-canvas patterns.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(frontend): polish settings nav scope and continue neo UI work

Clarify Personal settings as org-scoped (This org chip), fold Integrations
and Skills into that section, and move User/Application to the bottom.
Continue settings shell, credits, MCP, and chrome alignment.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(frontend): refine neo skeletons and select-style dropdown toggle

Improve loading skeleton fidelity and stagger, and let non-searchable
dropdowns click-open/click-close like other selects.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(frontend): stop LLM profile rows clipping on mobile

Override the shared fixed list-row height and keep the Default badge
inline with the profile name so stacked mobile content no longer
overflows the overflow-hidden profiles list.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(frontend): align settings tests with neo UI behavior

Update frontend tests for neo chrome (toasts, dropdowns, budgets, git settings) and show the org-wide badge on budgets/credits.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(frontend): rename settings nav brand label to Account

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(frontend): reorder org settings nav and add create-org action

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(frontend): add Super Admin shell and polish usage dashboards

Introduce the Super Admin routes and layout with settings-aligned gutters, put Super Admin atop the account menu, and improve dashboard charts with hover tooltips plus a one-line filter toolbar.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat: gate Super Admin dashboard behind ENABLE_SUPER_ADMIN

Add an env/web-client feature flag so Super Admin entry points and /super-admin routes stay off until explicitly enabled (true/1), while mock SaaS and instance Super Admins can use the existing dashboard UI.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat: wire Super Admin live APIs with org suspend usage blocks

Replace Super Admin directory mocks with /api/admin endpoints, add org.status suspend/resume that blocks product and resolver traffic at effective-org resolution, and let instance Super Admins still open and administer suspended orgs.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat: wire Super Admin conversation list and stop actions

Fetch live org conversations into the Super Admin usage dashboard and call the org stop API instead of a local UI-only timeout.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix: tighten Super Admin access and show provision credentials

Gate Super Admin UI on manage_super_admins only, and surface one-time password plus API key after provisioning a user.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat: add the first-install Super Admin onboarding flow

Walk a fresh install through welcome, terms, and account creation, then into the setup guide, so the first Super Admin can finish setup without the settings chrome.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat: start mock API in preview builds

Let VITE_MOCK_API turn on the mock worker outside local dev so a static preview can walk through onboarding without a backend.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat: let Super Admins change membership in specific organizations

A user can be suspended, resumed, removed, or added in one or more groups, and the first-run setup guide stays closed on the setup page.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(frontend): put the resolver list on personal Integrations

Show Git and project-management providers on /settings/integrations with the configure modals from the resolver design, and send old Integrations Hub resolver URLs there.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(frontend): give Super Admin row menus a solid panel

The popover menu style was missing, so organization, user, and admin row actions drew as loose text over the table.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(frontend): require Super Admins to join an org before opening it

Opening an organization they are not an active member of asks them to grant themselves access, defaulting to the admin role.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(frontend): rebuild Super Admin manage user around org access

The dialog now shows the person, their org roles, and an add-to-org step, and a Super Admin can change a membership role in place.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(frontend): pick a role per org when provisioning a user

Each organization is added from a role menu and can be removed before submit, and that role is sent with the provision request.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(frontend): guide first install through company, org, and LLM setup

Super Admins name their company and first organization, then land on LLM setup with a starter prompt. The install screens share a progress bar, footer, and an optional instance logo.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(frontend): open Super Admin from the organization menu

The organization switcher now includes Super Admin Dashboard and stays on that screen, and the first-run starter modal can pick models before setup continues.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(frontend): keep the active setup step open while previewing another

The starter modal now holds the pinned accordion open, and the header, trial note, and last step read as part of the same first-run flow.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(frontend): pin the Super Admin dashboard link in the org menu

Super Admins get a distinct dashboard link above Create organization so it stays visible apart from the workspace list.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(frontend): restyle MCP servers and pin Super Admin in the org menu

Show MCP servers as integration-style rows with display names and known logos, and keep the Super Admin link at the top of the org menu with its shield in the closed field.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(frontend): add a mock catalog of the Super Admin screens

Give reviewers one page that opens each install, guide, and dashboard screen, and switch that page's own copy between English and Chinese.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix: make the Python, frontend test, and lint checks pass

- Extract the org suspension lookup used by require_permission into
  is_org_suspended and default it in the route-test conftest the same way
  the super-role lookup is defaulted. Stub the lifecycle gate and the
  membership lookup in the other unit tests that now reach the database,
  which has no sqlite fallback on main.
- Keep ContextMenuContainer open for clicks inside portalled children, so
  picking an organization in the dropdown no longer closes the user menu.
- Resolve the ESLint and prettier findings in the Super Admin files.

* fix(super-admin): stop redirecting /super-admin into the install wizard (OHE-3462) (#636)

The dashboard layout sent a Super Admin to /install unless this
browser's localStorage (oh-sa-nux) said the install wizard was
finished. The wizard's last step creates an organization, so opening
the dashboard on a new browser meant creating another one, and there
the default name was already taken.

- super-admin-layout: remove the wizard redirect, the oh-sa-nux
  subscription, and the catalogPreview check that only existed to skip
  it. Access still depends on ENABLE_SUPER_ADMIN and
  manage_super_admins, and everyone else is still sent to /settings.
- Stop seeding all five wizard steps in the layout test, and add a
  test that the dashboard opens with no wizard progress.

The floating setup guide and the starter modal keep their own
conditions. The starter modal opens from a one-shot flag set by the
wizard's last step, on /settings/org-defaults, which any org admin can
reach.

* fix(onboarding): flag-gate /install and remove the persona checklist (OHE-3471) (#637)

Three onboarding surfaces were not behind ENABLE_SUPER_ADMIN: the
/install wizard, the "Setup guide" card in the Settings sidebar, and
the floating "Product tour" button. With the flag off, every SaaS-mode
user still got the card. Members and personal-workspace owners could
never finish or dismiss it: nothing marked "Start first conversation"
done, "Invite teammates" is impossible in a personal workspace, and
"Finish" stays disabled until required steps are done.

- super-admin-install-layout: add a clientLoader that redirects /install
  to / when enable_super_admin is off.
- Remove the persona checklist (sidebar card and
  /settings/getting-started) and the product tour, per D5 in OHE-3461.
  Neither is in OHE-3384's scope. The Super Admin setup guide, already
  behind the flag and dismissible, is now the only checklist.
- Remove what only they used: setup-readiness, use-org-setup, their
  route and tests, 62 SETUP$/PRODUCT_TOUR$ i18n keys
  (PRODUCT_TOUR$DONE stays, the user groups modal uses it), and their
  entries in the mock-only setup test panel and UI catalog.
- Add tests that /install redirects away with the flag off and shows
  the wizard with it on.

* feat(super-admin): create organizations with an initial owner (OHE-3476) (#638)

The create-organization dialog labeled its fields "Owner name" and
"Owner email", but POST /api/organizations only stored them as contact
fields and created no membership, so every new organization started
with zero members. The frontend then switched the Super Admin into it,
which the Super Admin bypass in switch_org allows.

- OrgCreate takes an optional owner_user_id: the caller or an existing
  user. When set, the route checks that the user exists (404 if not)
  and creates the org through create_org_with_owner with
  add_creator_as_owner=True, the same path the default-org bootstrap
  uses: the owner joins the LiteLLM team, gets a key, and the owner
  membership is persisted with the org. Without the field, the call is
  unchanged.
- The dialog gets an Owner picker that defaults to the current user and
  lists the other users from /api/admin/users. The contact fields are
  labeled as contact fields again, the description and required-fields
  message go back to the main wording, and the unused ORG$OWNER_* keys
  are removed.
- useCreateOrganization no longer switches into an organization owned
  by someone else. With no owner (the /install wizard), it still
  switches as before.
- The mock create handler honors owner_user_id for another user; the
  no-owner case is left to OHE-3469.
- Add route tests for the caller, another existing user, and an unknown
  owner, and modal tests for the default owner and choosing another
  user.

* fix(super-admin): hide Provision User when provisioning is off (OHE-3480) (#639)

The Users page always offered "Provision User", but
POST /api/organizations/provision-user is only registered when
USER_PROVISIONING_ENABLED is set. That is an OEM option and is off by
default, so on a normal install the form ended in a 404. The mock
always answered, so the demo hid it.

- The web-client config gets a top-level user_provisioning_enabled
  field. It reads server.constants.USER_PROVISIONING_ENABLED, the same
  value saas_server uses to register the route, so the two cannot
  disagree.
- The Users page shows the button only when the field is true. When it
  is false, the subtitle reads "Review users across all organizations."
  instead of "Provision and review users across all organizations."
- The mock config reports provisioning on in mock SaaS mode, so the
  demo flow still works.
- Add a config test for both values of the switch, and Users page
  tests for the button and subtitle with provisioning on and off.

* fix(super-admin): confirm before destructive dashboard actions (OHE-3484) (#640)

Deleting or suspending an organization, revoking a Super Admin, and
removing a user from organizations all ran on a single click. The row
menu calls an item's handler as soon as it is clicked, and these
handlers called the API directly. Only "Delete user" asked first.

- Organizations page: Remove opens the same confirmation as the delete
  in organization settings, naming the organization. Suspend opens a
  confirmation that names the organization and says its members cannot
  use it until it is resumed.
- Admins page: Revoke opens a confirmation naming the Super Admin.
- Manage User modal: bulk and per-row membership Remove show an inline
  confirmation naming the user and the organizations, like the existing
  "Delete user" step in the same modal.
- Cancel closes the confirmation without calling the API.
- Add Organizations and Admins page tests and extend the Manage User
  modal tests. The existing remove assertions now confirm first.

* fix(super-admin): protect personal workspaces and the acting admin (OHE-3485) (#641)

The dashboard treated personal workspaces like team organizations and
let a Super Admin act on their own account. Removing the admin's own
personal workspace deleted their user record, and the Super Admin role
with it, which got around the rule that the last Super Admin cannot be
removed. "Grant yourself access" could add the admin to another user's
personal workspace, because the backend only rejected the target
user's own workspace. Removing a user from their personal workspace
was skipped silently while the UI reported success.

- Admin API: reject suspending or deleting a personal workspace, adding
  anyone to a personal workspace, and removing a user from their own
  personal workspace instead of skipping it. Reject suspending your own
  account and removing yourself from every team organization. Each
  returns 403.
- Organizations page: another user's personal workspace has no open
  link and no actions menu. Your own personal workspace offers only
  View.
- Users page: another user's personal workspace is not a link.
- Manage User modal: the user's own personal workspace is no longer
  listed as a group. Suspend account and Delete user are disabled when
  you manage yourself.
- Add a backend test for each rejected case and frontend tests for the
  hidden and disabled actions. Three existing route tests now patch the
  personal-workspace lookup.

* fix(super-admin): run the standard cleanup on dashboard removals (OHE-3486) (#642)

Removing a user from an organization in the Super Admin dashboard
deleted the membership row and nothing else. The Members page removal
also resets the user's current organization when it pointed at that
organization, and removes the user from the organization's LiteLLM
team. The dashboard skipped both, so a removed user could be left with
a current organization they no longer belong to and keep their LiteLLM
team membership. The dashboard could not reuse remove_org_member,
which requires the caller to be a member who outranks the target.

- Move the row delete, current-org reset and LiteLLM team removal out
  of OrgMemberService.remove_org_member, unchanged, into
  remove_member_with_cleanup. remove_org_member keeps its checks and
  calls it.
- Both dashboard removals, DELETE /api/admin/users/{id} and the
  "remove" action on /groups, call it instead of deleting the row
  directly. Their own checks are unchanged.
- Add a route test for each that asserts the current-org reset and the
  LiteLLM team removal.

* fix(super-admin): show real instance values and link the SSO docs (OHE-3482) (#643)

The Instance page had no link to the SSO documentation, which the
dashboard ticket asks for. Its "Allow users to have personal workspace"
switch was hard-coded off whatever the deployment said, and the page
still called its controls "local stubs" although the email switch
already read the real config. The setup guide's optional SAML stop also
highlighted the "Show Setup guide" switch, because that selector came
first in its anchor list.

- Instance page: add a "Single sign-on (SAML)" entry that links to the
  SAML SSO guide on docs.openhands.dev in a new tab.
- The personal-workspace switch now reads hide_personal_workspaces from
  the web-client config (HIDE_PERSONAL_WORKSPACES). It stays read-only.
- Remove the "These controls are local stubs" hint and its i18n key.
- Setup guide: the tour's optional SAML stop highlights the new SSO
  entry.
- Add Instance page tests for the docs link and for the switch with
  personal workspaces shown and hidden.

* feat(super-admin): store the company name and logo on the server (OHE-3467) (#644)

The company name and logo set in the first-install wizard and on the
Super Admin Instance page lived only in the localStorage of the browser
that set them. Other users, and the same admin on another browser,
never saw the logo, and clearing site data lost it. The backend had no
instance-level settings to keep them in.

- Add a single-row instance_settings table (migration 176) for the
  company name and the logo, stored as the client-resized data URL.
- GET /api/admin/instance-settings returns them to any signed-in user.
  PATCH requires MANAGE_SUPER_ADMINS, changes only the fields it is
  sent (null clears one), and accepts only a PNG, JPEG or WebP data
  URL of at most 512 KB.
- The Instance page and the logo beside the product mark read and
  write through the API. The read runs only when ENABLE_SUPER_ADMIN is
  on, so other deployments make no extra request. The localStorage
  logo store is removed.
- The wizard's company step saves the name and any newly chosen logo
  on Continue, shows the saved logo when the admin comes back to the
  step, and stays on the step if saving fails.
- Add mock handlers for both endpoints, and update the UI catalog copy
  that said the logo is never uploaded.
- Add route tests for sign-in, permission, partial updates, visibility
  to other users and invalid values, and frontend tests for the
  Instance page, the settings navigation logo and the company step.

* fix(super-admin): gate the admin directory and require org membership (OHE-3483) (#645)

ENABLE_SUPER_ADMIN only hid the UI. The /api/admin directory routes
were always mounted, and authorization changed on every deployment,
flag on or off: an instance Super Admin passed every permission the
organization owner role has, in any organization, without being a
member. That covered organization secrets, API keys, billing and LLM
settings. /me returned a made-up owner record for them, and they could
switch into organizations they did not belong to. This contradicted the
model documented in authorization.py and OHE-2605, and the service
layer still required membership, so the access only half worked. The
dashboard already asks the admin to grant themselves access before
opening an organization, so explicit join is the model kept here.

- Mount the /api/admin directory router (organizations, users,
  instance-settings) only when ENABLE_SUPER_ADMIN is on. The
  super-admins API, create-organization and provision-user stay
  mounted.
- Remove the owner-level fallback from require_permission and
  authorize_permission. A Super Admin who is not a member gets only
  the explicit super-role permissions.
- Remove the made-up /me record (MeResponse.for_instance_super_admin).
  get_me raises not-found for non-members again.
- switch_org requires membership for everyone again. The suspended-org
  and inactive-membership rules are unchanged.
- Return the superadmin permission set to main's. VIEW_ORG_CONVERSATIONS,
  which the dashboard overview needs to read usage across
  organizations, is granted only while the flag is on.
  DELETE_ORGANIZATION and VIEW_ORG_SETTINGS are dropped: the dashboard
  deletes through /api/admin, and the regular delete still requires an
  owner, so the extra permission only showed a Delete button that
  failed.
- Tests state the model: a non-member Super Admin is refused org
  secrets, API keys, billing and org settings edits, /me raises
  not-found, switch_org refuses them, the dashboard permission follows
  the flag, and the directory routes are served only with the flag on.

* docs(super-admin): name both variables that turn the flag on (OHE-3487) (#646)

The comment on enable_super_admin told operators to set
ENABLE_SUPER_ADMIN=true. That only works when no
OH_WEB_CLIENT_FEATURE_FLAGS_* variable is set. Replicated and every
saas-deploy environment set several, and then the web-client flags are
built from those alone, so the bare variable never reaches
enable_super_admin and the dashboard stays hidden. The server still reads
only the bare variable to mount the /api/admin directory, so a
deployment needs both.

- web_client_models.py: name both variables and say what each one
  drives. Comment only.

* feat(super-admin): store first-install and setup-guide state on the server (OHE-3463) (#647)

The first-install wizard and the Super Admin setup guide kept their
state only in browser localStorage. The server could not tell whether
an instance still needed setup, who should do it, whether they had
finished, which organization the guide belonged to, or whether it was
dismissed, and Agent Canvas could not read any of it. The per-user
onboarding_completed flag cannot answer this: OHE never clears it, and
its self-hosted first-owner check matches every personal workspace.

- Add setup_user_id, wizard_completed, guide_org_id and
  guide_dismissed to instance_settings (migration 177). guide_org_id
  is cleared when its organization is deleted.
- create_user records the first user, the one it makes Super Admin,
  as setup_user_id while ENABLE_SUPER_ADMIN is on. Upgraded instances
  and instances first used with the flag off record no one.
- GET /api/admin/setup-state returns the wizard and guide state for
  the caller. Only the first Super Admin gets real values; everyone
  else gets the defaults. PATCH changes only the fields it is sent,
  is limited to the first Super Admin, and returns 404 for an unknown
  organization.
- Add the frontend service methods, useSetupState (runs only with
  enable_super_admin), useUpdateSetupState and mock handlers.
- Add route tests for sign-in, an instance with no recorded setup
  user, the first Super Admin, a later admin, a completed wizard,
  guide org and dismissal, the 403 and 404 cases and org deletion;
  user store tests for recording the first user with the flag on and
  off; and hook tests for reading, the flag-off case and updating.

* fix(super-admin): drop the install account step and require sign-in (OHE-3465) (#648)

The first-install wizard asked for a name, an email and a password to
"create your Super Admin account", but created nothing: the name and
email went to localStorage and the password was dropped. The server
has no way to create that account either. It has no password login,
and the Keycloak realm turns off registration and password sign-in.
The first user already becomes Super Admin when they first sign in
through the identity provider, and #647 records them as the setup
user at that point. So the wizard now runs after sign-in, as that
user, instead of pretending to create one.

- Remove the account step: its route, its place in the NUX state and
  the step bar, its intermediate-page entry, the mock harness jump and
  the 15 i18n keys only it used. Terms now continues to company.
- The org step took the new org's contact name and email from the
  account step. It now reads them from the signed-in user's personal
  workspace, which holds the name and email from sign-in. Without
  that, its admin@localhost fallback fails the backend's email check.
- The install layout's loader sends a signed-out visitor to
  /login?returnTo=<path>, the same URL the root layout uses. Only a
  401 counts as signed out; other errors still surface.
- Update the UI catalog entries and their zh-CN/zh-TW copy that
  listed the account step, and the two tests that referenced it.

* fix(super-admin): drop the install terms step and rely on /accept-tos (OHE-3466) (#649)

The first-install wizard showed twelve paragraphs of placeholder terms
labelled "Placeholder draft" and kept acceptance only in localStorage.
It was also a second acceptance. Both login callbacks send a user who
has not accepted the terms to /accept-tos, which records them with
POST /api/accept_tos. Until then the auth middleware rejects every API
call except that one, including the /api/authenticate check the
install layout has run since #648. So the wizard cannot load before
the real terms are accepted, and its own terms step could only ask
again.

- Remove the terms step: its route, its place in the NUX state and the
  step bar, its intermediate-page entry, the mock harness jump and the
  3 i18n keys only it used. Welcome now continues to company, and the
  step bar has five steps.
- Update the UI catalog entries and their zh-CN/zh-TW copy that listed
  the terms step, and the two tests that referenced it.

* feat(super-admin): route the first Super Admin into /install and guard it (OHE-3464) (#650)

A fresh install had no way into the first-install wizard. Sign-in only
knew about the /onboarding survey, and on OHE that page bounces straight
back out because enable_onboarding is off. /install itself only checked
that the flag was on and the visitor was signed in, so anyone could
open it at any time, and its last step never told the server the wizard
was done. #647 stored that state on the server, but nothing used it yet.

- Sign-in: _get_post_auth_redirect sends the first Super Admin to
  /install while the wizard is unfinished. New users reach it through
  /accept-tos on both the Keycloak and the OAuth v2 path. The Keycloak
  callback does the same for a returning first Super Admin, in the
  branch that already checks for onboarding.
- The wizard replaces the onboarding survey for that user (D3 in
  OHE-3461): _should_redirect_to_onboarding returns false for them, so
  /api/onboarding_status no longer sends them to /onboarding either.
- With ENABLE_SUPER_ADMIN off the setup row is never read, and instances
  with no recorded first Super Admin behave as before.
- /install: the loader fetches the setup state and redirects to / unless
  the wizard is pending for the caller. If this browser holds finished
  progress the server doesn't (an earlier install on the same host), it
  clears it so the wizard can run.
- The org step, the wizard's last, records wizard_completed after it
  creates the organization, so the wizard doesn't come back on another
  browser. If that fails, the admin stays on the step with an error.
- The mock setup state starts pending, like a fresh install.
- Tests: the post-auth redirect for a pending, a finished and another
  user and with the flag off, against Postgres; the Keycloak callback
  for a returning first Super Admin; the /install guard; the org step
  recording completion and failing to.

* fix(super-admin): make the Super Admin the owner of the first organization (OHE-3469) (#651)

The wizard's org step created the first organization without an owner.
Since #638, POST /api/organizations adds an owner membership only when
owner_user_id is sent, so the new org had no members. The create hook
then called /switch, which the server refuses for non-members, ignored
the error and selected the org in the browser anyway. The Super Admin
landed on org LLM defaults for an org they weren't in: reads and saves
returned 404 and the org was missing from their switcher. The mock hid
this by making the creator the owner.

The default-org bootstrap (D4 in OHE-3461) only runs from the Keycloak
callback, and that path is going away (OHE-3293), so the fix lives in
the wizard and works whatever the sign-in path.

- Org step: on submit it reads the org list. If the Super Admin already
  belongs to a team org (the default-org bootstrap's, or one an earlier
  attempt created before recording completion failed), it renames that
  org. Otherwise it creates one with owner_user_id set to the Super
  Admin, whose id is their personal workspace's id. It never creates a
  second org.
- It then switches into the org and only then records wizard_completed.
  If the server refuses the switch, the admin stays on the step with
  the error and can retry. One submitting flag covers the whole step.
- useCreateOrganization selects the new org locally only after /switch
  succeeds.
- Mock: POST /api/organizations adds the current user only when
  owner_user_id is theirs, and no longer switches into the new org,
  like the real endpoint.
- Tests: the org step creating an org owned by the Super Admin, renaming
  an org they already belong to, and staying put when the switch is
  refused; the create dialog staying in the current org when the switch
  is refused.

* fix(super-admin): drop the install license-key box and its trial copy (OHE-3468) (#652)

The company step of the first-install wizard had a license-key box
that did nothing. Connect kept the typed key in component state, and
Continue saved only a hasLicenseKey boolean to localStorage that
nothing reads. The key was never validated, sent or stored, yet the
screen promised "a 30-day trial" or "the evaluation trial". Its
Register and Login buttons opened two hard-coded external URLs, one
of them the Replicated customer portal.

The enterprise backend has no license endpoint, and Replicated
installs already require a license: every image is pulled through the
license's proxy registry path. So this removes the box, as D6 in
OHE-3461 recommended, instead of building a check.

- Company step: remove the license-key input and Connect button, both
  trial messages, the Register and Login buttons, and the two URL
  constants. Saving the company name and logo is unchanged.
- NUX state: remove hasLicenseKey from the company entry, its setter
  and the mock harness presets.
- i18n: remove the 7 keys only the box used, and reword
  SA_NUX$COMPANY_BODY and SA_NUX$STEP_COMPANY_DETAIL, which still
  mentioned licensing.
- Update the UI catalog's company entry and its zh-CN/zh-TW copy, and
  the one NUX test that passed hasLicenseKey.

* feat(super-admin): save the starter modal's LLM to the org profile (OHE-3470) (#653)

The starter modal on org LLM defaults let the Super Admin pick a
provider, models and an API key, but the lists were hard-coded and
"Get started" only cleared the local starterModalPending flag. Nothing
was saved, so the organization kept its previous LLM.

The modal now uses the same model catalogue and the same three calls as
the org LLM form. Saving a profile with an explicit llm and activating
it would only change the caller's member settings, so the org defaults
are saved first, as the form does.

- Starter fields: providers and models come from the config search API,
  with hidden aliases left out and verified models first. The model menu
  keeps its look but picks one model: each row is a radio and the All
  action is gone, since a provider can list more models than an org can
  hold profiles. The list scrolls past a fixed height.
- The API key field follows the form's rule: hidden for OpenHands
  models and when allow_user_llm_configuration is off. Changing the
  provider clears the model and the key.
- Get started saves the org settings with the model, a null base_url
  and the typed key, saves a profile that copies them, activates it,
  marks the guide's add-llm step and closes. It stays disabled until a
  model is chosen and the org is known. A failure shows the server's
  message in the modal and keeps it open. Skip still saves nothing.
- Catalog: the starter card no longer says models are checkboxes with
  All.
- Tests: the list comes from the server, Get started waits for a model,
  saving runs the three calls and closes, a failed save stays open with
  the error, Skip saves nothing, and no key is asked for when user LLM
  configuration is off.

* feat(super-admin): derive setup-guide progress from server data (OHE-3472) (#654)

The Super Admin setup guide kept its progress and visibility in one
localStorage key, so it was per browser and not tied to an
organization. Only "create organization" and "add an LLM" were ticked
by real actions, and the LLM tick fired for any organization. The other
steps were checkboxes the admin ticked by hand. The floating widget
also waited on this browser's own wizard key, so it never showed on
another browser. #647 stored the guide's organization and dismissal on
the server, but nothing set the organization and the guide still read
only localStorage.

- setup-state: GET and PATCH return guide_steps for the first Super
  Admin while the guide has an organization and is not dismissed. Each
  step is read from what that organization really has:
  - org_llm: a saved LLM profile other than the Default one every org
    is seeded with.
  - mcp_server: the first Super Admin has an MCP server in the org. MCP
    servers belong to each member.
  - invite: a second member, or a pending invitation that has not
    expired.
  - automation: the automation service lists one for the org.
    Automations live in that service's own database, so the caller's
    cookie or Authorization header is forwarded with X-Org-Id. If the
    service is not configured or the call fails, the step stays undone.
- The wizard's org step saves guide_org_id with wizard_completed, so the
  guide belongs to the organization the Super Admin owns.
- The guide page, its sidebar card and the floating widget read that
  state instead of localStorage. The widget no longer waits on the
  local oh-sa-nux key, and it re-reads progress on navigation and after
  an LLM save. The manual checkboxes are gone; each row shows a status
  circle with the same look.
- Remove setup guide and the Instance page switch save guide_dismissed
  on the server. The switch is disabled for Super Admins without a
  guide, since only the first Super Admin can change it.
- "Add an integration" now opens /settings/mcp and is checked by the
  MCP signal, matching the ticket's "connect MCP integrations" step.
  Its tour stop and hint follow. Optional SAML stays a link and does
  not count toward progress.
- Remove the oh-super-admin-setup store and the unused mark
  complete/incomplete strings. The tour still advances on the step
  event. Update the mock, the QA panel and the catalog copy.
- Tests: route tests against Postgres for each step, an expired
  invitation, the headers sent to the automation service and a failing
  service; frontend tests for the derived progress, SAML not counting,
  no guide for other users or after dismissal, removing and toggling
  the guide on the server, and the widget re-reading progress on the
  next page.

* fix(super-admin): align the setup guide's steps with the ticket (OHE-3473) (#655)

OHE-3384 asks the setup guide for four steps: configure the org LLM,
choose an automation template, connect MCP integrations and invite
users. The guide had six. "Create an organization" was always checked,
because the guide only exists once the install wizard has given it an
organization (OHE-3469). "Create first automation" opened the
automations list instead of the templates. Its tour stop went to "/",
which hard-redirects into Agent Canvas, so the tour ended there on an
anchor no page renders.

- The steps are now: add an LLM, choose an automation template, add an
  MCP integration, invite users, then the optional SAML link. Progress
  counts four steps.
- The automation step is "Choose an automation template". It opens
  /automations/templates, which lands on the Agent Canvas templates
  page. The link goes through the automations redirect rather than
  /canvas/..., because the cross-app redirect shows an error on a
  second in-app visit to the same /canvas URL.
- The tour drops the create-org stops and the cross-app automation
  stop. Starting the guide on a step that has no tour stop opens that
  step's page instead of restarting the tour at the LLM step.
- The create-organization modal no longer signals a guide step.
- Remove the organization step's strings. Update the setup subtitle
  and the UI catalog copy.

* fix(super-admin): make Delete user remove the account and its data (OHE-3477) (#656)

The dashboard's Delete user only removed the user from their team
organizations. The user row, the personal workspace, API keys, git and
Keycloak tokens, the LiteLLM user and the Keycloak account all stayed,
so the person could sign in again and every API key kept working. The
user row could not simply be deleted either: conversation, quota,
budget, Git claim and invitation rows hold foreign keys to it, and a
leftover legacy user_settings row re-creates the user on the next
lookup.

- Add UserStore.delete_user. In one transaction it deletes the user's
  conversations in every organization, API keys, git and Keycloak
  tokens, device codes, personal secrets, quota and budget rows,
  legacy settings and memberships, then the user row. Git claims and
  invitations the user made in a team organization pass to another
  owner of that organization, and the setup-user pointer is cleared.
- DELETE /api/admin/users/{id} now deletes the user. It still refuses
  self-deletion and the last owner of a team organization, and now
  refuses the last Super Admin through revoke_super_admin's locked
  check. Once the account is gone it removes the personal workspace,
  the LiteLLM user and the Keycloak account best effort, logging any
  failure.
- Manage User: the hint, confirmation and toasts describe a permanent
  delete, a successful delete also refreshes the Admins list, and the
  mock API drops the user.
- Replace the route tests for the old behaviour. Add route tests for
  the refusals and the cleanup order, Postgres tests for the cleanup
  steps, and a hook test for the Admins refresh.

* fix(super-admin): make Suspend account block sign-in and API keys (OHE-3478) (#657)

The dashboard's Suspend account only marked each of the user's
memberships inactive. The user could still sign in and use their API
keys, any new active membership un-suspended them, a user with no
memberships could not be suspended, and suspending a Super Admin did
nothing because Super Admins skip the membership check.

- Add user.is_disabled (migration 178). Migration 162 dropped the
  column of the same name when #181 was reverted.
- PATCH /api/admin/users/{id} now sets the flag instead of every
  membership status. It still refuses suspending yourself, and now
  refuses the last enabled Super Admin with a 409, checked under a
  FOR UPDATE lock. The directory reads the user's status from the flag.
- revoke_super_admin, which delete also uses, now requires another
  enabled Super Admin, so the instance cannot be left with only
  disabled ones.
- SaasUserAuth.get_instance rejects a disabled user, so API keys, the
  legacy cookie and the OAuth v2 cookie all get a 401 and the cookies
  are cleared.
- Sign-in refuses a disabled user with 401 account_disabled: the
  Keycloak path in DefaultUserAuthorizer, like blocked domains, and the
  OAuth v2 login callback before tokens are stored. Without this,
  auto-login would send them back to the identity provider in a loop.
- Manage User: a user suspended in every organization no longer shows
  as an inactive account, the account hint describes the new effect,
  and the mock API matches the server.
- Update the route tests for the old behaviour. Add Postgres tests for
  the flag and the Super Admin guards, and tests for get_instance, both
  sign-in paths and the Users page.

* fix(super-admin): explain a suspension to the affected user (OHE-3479) (#659)

A Super Admin can suspend an organization, a user's membership in one,
or the whole account, and the server enforces all three, but the
affected user was never told why. A refused sign-in showed the raw
callback JSON {"detail":"account_disabled"}. Requests in a suspended
organization failed with a 403 the frontend ignored, so /settings sat
on a loading skeleton and other calls showed raw toasts.

- Sign-in: both callbacks send a disabled user to
  /login?account_disabled=true instead of a 401 JSON, the way
  recaptcha_blocked already works, and the login page explains it. No
  tokens are stored and no cookie is set, as before.
- Suspended organization or membership: the response interceptor
  records a 403 "Organization is suspended" or "User membership is
  suspended" against the selected organization. A failed switch is
  left alone and stays a toast. The root layout then shows only a
  blocking modal that says what is suspended and who to contact, and
  lists the user's other organizations. Switching lifts it.
- Add the five strings in all 15 languages.
- Update the two callback tests for the redirect. Add tests for the
  login message, the block and the switch, the membership message, and
  the 403s the interceptor must ignore.

* feat(super-admin): invite a person into any organization from the dashboard (OHE-3481) (#661)

The PRD lets a Super Admin add someone to any organization by
invitation. The dashboard could only add people who already had an
account: "Add to org" in Manage user needs an existing user, and
"Provision User" is hidden unless USER_PROVISIONING_ENABLED is set. The
invitation API already lets a Super Admin who is not a member invite
into any organization, including as owner, and returns a link to copy.
Nothing on the dashboard called it.

- Reuse the Add Members modal. When the dashboard passes it a list of
  organizations, it shows an organization picker and offers the owner
  role. Settings > Members is unchanged.
- useInviteMembersBatch and usePendingInvitations take an optional org
  id and fall back to the selected org, as before.
- The Users page gets an "Invite by email" button. Each team
  organization's row menu on the Organizations page gets an "Invite by
  email" item with that organization preselected. Personal workspaces
  are not offered.
- With email delivery off, the modal shows each invite link to copy,
  as it already did in settings.
- Add the "Invite by email" string, mention inviting in both Users page
  subtitles, and add the dialog to the UI catalog.
- Add tests for the organization picker, the owner role, both entry
  points, the links shown when email delivery is off, and personal
  workspaces.

* test(super-admin): cover the untested admin actions, API client and usage hook (OHE-3489) (#663)

OHE-3489 asks for a test behind every Super Admin screen and admin
action. Its list of gaps predates the sub-PRs that dropped the account,
terms and license steps and added tests for most screens. What was
still untested: the add, set_role and resume membership actions, org
resume and account re-enable, two personal-workspace cases, the
structured feature-flag variable, the Admins page grant flow, Resume on
the Organizations page, the usage hook and the API client. Every
frontend test mocked the client, so a wrong URL, method or body could
not fail any of them.

Backend:
- add: creates a missing membership at the chosen role with the
  LiteLLM key, and reactivates a suspended one instead of adding a
  second row.
- set_role: changes the role on an existing membership and refuses to
  demote the last owner.
- resume: the existing suspend tests for memberships, organizations
  and accounts now also cover resume and re-enable.
- Deleting a user is not blocked by owning their personal workspace.
- The personal-workspace check runs against the database for a
  personal workspace and for a team organization.
- OH_WEB_CLIENT_FEATURE_FLAGS_ENABLE_SUPER_ADMIN turns the web-client
  flag on.

Frontend:
- superAdminService: each of the 15 calls sends the method, path, body
  and headers of its backend route, and the list calls unwrap their
  response envelopes.
- Admins: granting Super Admin by email closes the dialog and lists
  the new admin.
- Organizations: Resume runs without a confirmation dialog.
- useUpdateSuperAdminUserGroups and useUpdateSuperAdminUserStatus call
  the client and refresh the user list. useProvisionUserToGroups
  provisions each organization in order and leaves the password out
  when none is given.
- useSuperAdminUsage sums usage across team organizations only,
  fetches only the selected organizations, and requests every
  conversation for the year-to-date window.

* chore(super-admin): remove the mock and QA tooling and stale stub copy (OHE-3488) (#664)

The prototype's review tooling was still in the app. The UI catalog and
the setup test harness did nothing without VITE_MOCK_API, but their
routes, a persona override inside the Super Admin access checks, and an
ungated ?catalogPreview=1 bypass of the install step order all reached
production builds. The mock API also disagreed with the backend on
create-organization and provisioning, which is how OHE-3469 and OHE-3480
stayed hidden.

- Remove the /ui-catalog pages, the setup test harness panel and its
  persona override, the catalogPreview and forceOpen branches, the
  unused root-to-settings route and the sample usage data. The catalog's
  reviewer notes move to .pr/ui-catalog-review-notes.md.
- Move the Super Admin row types from super-admin-mock.ts to
  super-admin-types.ts.
- Start the mock worker in development only again, as on main.
- Drop "This UI is not wired to the API yet." from the grant dialog and
  delete the unused "stub data" hint.
- Mock create-organization like the backend: request validation, the
  owner lookup, the exact 409 message, and only the owner becomes a
  member. /me, switch and the organization list now respect membership.
- Mock provisioning like the backend: 405 when it is off, the target-org
  and personal-workspace checks, the requested password, and no
  re-enabling of suspended accounts.
- Delete the two tests whose subject is gone, and move the sample user
  rows into the one test that uses them.

* fix(super-admin): renumber the org status migration to 179 (OHE-3491) (#667)

Merging main into this branch brought in #599's
175_add_sandbox_lifecycle_columns.py. It declares revision 175 on top
of 174, the same as this branch's 175_add_org_status.py. Alembic keeps
only one file per id and then reports two heads (175 and 178), so
alembic upgrade head fails. The migration check fails on the duplicate
revision, and every backend test run stops while building the template
database.

- Rename 175_add_org_status.py to 179_add_org_status.py and chain it
  after 178. The chain is now 174 -> 175 (main's sandbox lifecycle
  columns) -> 176 -> 177 -> 178 -> 179.
- Move only this migration. 176-178 don't use org.status, and main's
  175 can't change because deployed databases have already applied it.
- Update the docstring's Revision ID and Revises to match.

* fix(super-admin): wait for sign-in before showing the setup guide (OHE-3497) (#668)

With ENABLE_SUPER_ADMIN on, a first-time user who accepted the Terms of
Service landed back on /login and could never finish signing up. The
setup guide widget is mounted around every root-layout page, including
/accept-tos, and its query reads GET /api/admin/setup-state whenever the
flag is on. On /accept-tos the session cookie still says
accepted_tos=false, so the auth middleware refuses the call with
TosNotAcceptedError. That is an AuthError, so the middleware also ends
the Keycloak session and deletes the keycloak_auth cookie. The
POST /api/accept_tos that follows has no cookie and gets a 401, the page
falls back to /, and the user is sent to /login. Acceptance is never
saved, so every retry loops.

- Mount the widget only when the user is signed in and not on an
  intermediate page (/accept-tos, /information-request, /install). The
  layout already skips the auth check on those pages for the same
  reason.
- Add root-layout tests: /accept-tos makes no setup-state call, and a
  signed-in page still loads the guide. The config is seeded into the
  query cache as PostHogWrapper does in the app, and the file uses the
  real intermediate-page hook instead of the global mock.

* fix(super-admin): open the automation templates after the starter modal saves the LLM (OHE-3499) (#669)

After the first Super Admin saved an LLM in the starter modal on
/settings/org-defaults, the modal closed and left them on that page. The
setup guide's next step, choosing an automation template, then needed
another click in the guide. saveLlm marked the LLM step done and cleared
the modal, but never navigated.

- After a successful save, navigate to the automation step's destination,
  read from SUPER_ADMIN_SETUP_STEPS (/automations/templates). The
  /automations/* route hands off to /canvas/automations/templates.
- Skip and a failed save stay on the page, as before.
- Render the modal tests through a router stub, and check that saving
  opens the templates page while skipping or failing does not.

* fix(super-admin): refresh the setup guide after adding an MCP server or inviting someone (OHE-3500) (#670)

After adding an MCP server, "Add an integration" stayed unchecked in the
setup guide until the page was reloaded, and "Invite users" did the same
after an invitation. The server already counts both at once. The guide
re-reads its progress only when the route changes or when
SUPER_ADMIN_SETUP_STEP_EVENT fires, and the query is cached for five
minutes. Both actions stay on the same page, and only the LLM saves fired
the event.

- Fire notifySuperAdminSetupStep("add-integration") when adding an MCP
  server succeeds on /settings/mcp.
- Fire notifySuperAdminSetupStep("invite-users") when an invitation
  succeeds. The invite modal is shared by Members settings and the Super
  Admin dashboard.
- Notify from the callers, as the LLM paths do, so the mutation hooks
  stay free of guide code.
- Test both events, and that the floating guide re-reads its progress on
  the event without a route change.

* fix(super-admin): show personal workspaces as Personal Workspace in the organizations table (OHE-3501) (#671)

The Super Admin Organizations table showed a personal workspace by its
stored name, user_<id>_org. Personal workspaces are created with that
name, and the admin API already marks them with is_personal. The rest of
the app shows ORG$PERSONAL_WORKSPACE when it is set (the org selector,
the suspended-workspace modal and the API key pages), but the table
copied org.name as is.

- Use ORG$PERSONAL_WORKSPACE for rows with is_personal. Team
  organizations keep their names, and the stored name does not change.
- The search and the confirmation text use the same label. The contact
  email column still tells personal workspaces apart.
- Add a test, and update the personal-workspace test that looked for
  user_7_org.

* fix(super-admin): show personal workspaces as Personal Workspace in the users table (OHE-3502) (#672)

The Super Admin Users table listed a user's personal workspace by its
stored name, user_<id>_org, in the Organizations column. OHE-3501 fixed
the Organizations table, but the users mapping copied each membership's
org_name as is. Membership rows carry no is_personal flag; a personal
workspace shares its owner's id, which is the rule the server and the
other Super Admin views already use.

- Use ORG$PERSONAL_WORKSPACE for a membership whose org_id equals the
  user's id. Team organizations keep their names, and the stored name and
  the API do not change.
- The users search and the open-organization prompt use the same label.
- Add a test, and update the personal-workspace test that looked for
  user_7_org.

* fix(super-admin): open Agent Canvas's MCP page from the setup guide's integration step (OHE-3516) (#685)

The Agent Canvas setup guide's "Add an integration" step now opens Canvas's
own MCP page (OpenHands/OpenHands#18066). The enterprise guide still sent
the admin to /settings/mcp, so the two guides opened different pages for
the same step. Canvas's MCP page saves to the same member settings the
mcp_server signal checks.

The guide opens steps with React Router's navigate. A /canvas/... URL
opened that way goes through routes/cross-app-redirect.tsx, which shows an
error page when the same URL is opened twice in a session. That is why
the automation step points at /automations/....

- Point "Add an integration" at /canvas/mcp.
- Open setup steps with navigateOrHardRedirect from Start, the floating
  guide and the setup page. A /canvas/... step gets a page load, and the
  other steps navigate as before.
- Remove the step's tour stop and its unused nav selector. The tour cannot
  follow into Canvas, the same as for the automation template step.
- Test that Start, the setup page row and the floating guide row open
  /canvas/mcp with a page load.

* feat(super-admin): open the next setup guide step when one is done (OHE-3525) (#702)

Finishing a setup step ticked its checkbox but left the Super Admin where
they were: the next step and its tour opened only from a click. The
completion event only made the floating guide re-read its progress, and an
open LLM tour carried on through its own stops to the invite tip, skipping
the two steps that live in Agent Canvas.

- When the guide's next step is reported done and the server confirms it,
  the floating guide opens the step after it the way Start does: its tour
  here, or its page in Agent Canvas. A step finished out of order or again,
  and the last required step, open nothing.
- Start and the hand-off show one step's tour, so the LLM tour ends when
  the LLM is saved.
- The tour engine ignores delayed callbacks from a tour that was stopped or
  replaced. driver.js keeps its state at module level, so they would have
  torn down the current tour.
- Links into Agent Canvas name the step in setup_tour, and a page opened
  with setup_tour starts that step's tour here.
- The starter modal leaves the next step to the guide.

* fix(super-admin): show every conversation on the dashboard and count users' conversations the same way (OHE-3527)

With "All orgs" selected, the Super Admin Dashboard's Users tab showed 2
conversations and its Conversations tab showed 1. The Conversations tab
started filtered to running conversations, applied in the browser and not
shown as an active filter, so a finished conversation was hidden. The Users
counts also came from an endpoint that ignored the time window and counted
sub-conversations, which the conversation list leaves out.

- The Super Admin Dashboard's Conversations tab starts at all statuses, and
  Reset filters returns there. ConversationsTab takes the default as a prop,
  so the org-level usage dashboard still starts at running.
- GET .../conversations/user-usage takes an optional time_window (7d, 30d,
  90d) for the conversation count, and counts top-level conversations only,
  as the conversation list does. Spend columns keep their own periods.
- The Super Admin Dashboard sends its time window with the users request;
  YTD means all time, as for the conversation list.

* chore: Remove PR-only artifacts [automated]

---------

Co-authored-by: FraterCCCLXIII <panentheum@gmail.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: allhands-bot <allhands-bot@users.noreply.github.com>
hieptl added a commit that referenced this pull request Oct 9, 2026
…fter navigating away (OHE-3528) (#704)

* feat(frontend): add OpenHands-Neo theme tokens and scoped UI root

Wire agent-canvas-style --oh-* / cool-grey tokens, AgentServerUIRoot, and neo palette application so the SaaS shell can share the same theme foundation.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(frontend): add shared settings and form layout class helpers

Port agent-canvas layout utilities so settings-like pages can reuse the same form, list, and sidebar spacing classes.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(frontend): restyle settings navigation for OpenHands-Neo

Match agent-canvas settings chrome with tokenized nav links, logo header, bottom user menu, and settings-owned gutters.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(frontend): tokenize organization settings pages for neo theme

Restyle org management, members list, and git org rows with shared settings list/form tokens and updated mocks/tests.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(frontend): tokenize budgets and usage dashboard for neo theme

Replace hardcoded greys with base/surface/muted/primary tokens so budgets and usage monitoring match agent-canvas.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(frontend): tokenize shared chrome components for neo theme

Update spinners, badges, chips, context menus, and related shell controls to use --oh-* / muted tokens instead of hardcoded greys.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(frontend): align toast handlers with agent-canvas

Use neo toast tokens, custom CircleX error layout, loading helper, and route call sites through the shared handlers.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(openhands-ui): restyle toasterMessages for neo theme

Replace the pill toast chrome with agent-canvas-aligned surface, border, radius, and status icon colors.

Co-authored-by: Cursor <cursoragent@cursor.com>

* docs: add neo theme component audit notes

Track remaining hardcoded hex surfaces for follow-up tokenization work.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(frontend): align settings shell and neo theme chrome

Restyle the settings rail (sidebar, drawer, white brand mark), forms, integrations, and related surfaces to match OpenHands-Neo tokens and agent-canvas patterns.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(frontend): polish settings nav scope and continue neo UI work

Clarify Personal settings as org-scoped (This org chip), fold Integrations
and Skills into that section, and move User/Application to the bottom.
Continue settings shell, credits, MCP, and chrome alignment.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(frontend): refine neo skeletons and select-style dropdown toggle

Improve loading skeleton fidelity and stagger, and let non-searchable
dropdowns click-open/click-close like other selects.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(frontend): stop LLM profile rows clipping on mobile

Override the shared fixed list-row height and keep the Default badge
inline with the profile name so stacked mobile content no longer
overflows the overflow-hidden profiles list.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(frontend): align settings tests with neo UI behavior

Update frontend tests for neo chrome (toasts, dropdowns, budgets, git settings) and show the org-wide badge on budgets/credits.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(frontend): rename settings nav brand label to Account

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(frontend): reorder org settings nav and add create-org action

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(frontend): add Super Admin shell and polish usage dashboards

Introduce the Super Admin routes and layout with settings-aligned gutters, put Super Admin atop the account menu, and improve dashboard charts with hover tooltips plus a one-line filter toolbar.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat: gate Super Admin dashboard behind ENABLE_SUPER_ADMIN

Add an env/web-client feature flag so Super Admin entry points and /super-admin routes stay off until explicitly enabled (true/1), while mock SaaS and instance Super Admins can use the existing dashboard UI.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat: wire Super Admin live APIs with org suspend usage blocks

Replace Super Admin directory mocks with /api/admin endpoints, add org.status suspend/resume that blocks product and resolver traffic at effective-org resolution, and let instance Super Admins still open and administer suspended orgs.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat: wire Super Admin conversation list and stop actions

Fetch live org conversations into the Super Admin usage dashboard and call the org stop API instead of a local UI-only timeout.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix: tighten Super Admin access and show provision credentials

Gate Super Admin UI on manage_super_admins only, and surface one-time password plus API key after provisioning a user.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat: add the first-install Super Admin onboarding flow

Walk a fresh install through welcome, terms, and account creation, then into the setup guide, so the first Super Admin can finish setup without the settings chrome.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat: start mock API in preview builds

Let VITE_MOCK_API turn on the mock worker outside local dev so a static preview can walk through onboarding without a backend.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat: let Super Admins change membership in specific organizations

A user can be suspended, resumed, removed, or added in one or more groups, and the first-run setup guide stays closed on the setup page.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(frontend): put the resolver list on personal Integrations

Show Git and project-management providers on /settings/integrations with the configure modals from the resolver design, and send old Integrations Hub resolver URLs there.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(frontend): give Super Admin row menus a solid panel

The popover menu style was missing, so organization, user, and admin row actions drew as loose text over the table.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(frontend): require Super Admins to join an org before opening it

Opening an organization they are not an active member of asks them to grant themselves access, defaulting to the admin role.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(frontend): rebuild Super Admin manage user around org access

The dialog now shows the person, their org roles, and an add-to-org step, and a Super Admin can change a membership role in place.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(frontend): pick a role per org when provisioning a user

Each organization is added from a role menu and can be removed before submit, and that role is sent with the provision request.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(frontend): guide first install through company, org, and LLM setup

Super Admins name their company and first organization, then land on LLM setup with a starter prompt. The install screens share a progress bar, footer, and an optional instance logo.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(frontend): open Super Admin from the organization menu

The organization switcher now includes Super Admin Dashboard and stays on that screen, and the first-run starter modal can pick models before setup continues.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(frontend): keep the active setup step open while previewing another

The starter modal now holds the pinned accordion open, and the header, trial note, and last step read as part of the same first-run flow.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(frontend): pin the Super Admin dashboard link in the org menu

Super Admins get a distinct dashboard link above Create organization so it stays visible apart from the workspace list.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(frontend): restyle MCP servers and pin Super Admin in the org menu

Show MCP servers as integration-style rows with display names and known logos, and keep the Super Admin link at the top of the org menu with its shield in the closed field.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(frontend): add a mock catalog of the Super Admin screens

Give reviewers one page that opens each install, guide, and dashboard screen, and switch that page's own copy between English and Chinese.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix: make the Python, frontend test, and lint checks pass

- Extract the org suspension lookup used by require_permission into
  is_org_suspended and default it in the route-test conftest the same way
  the super-role lookup is defaulted. Stub the lifecycle gate and the
  membership lookup in the other unit tests that now reach the database,
  which has no sqlite fallback on main.
- Keep ContextMenuContainer open for clicks inside portalled children, so
  picking an organization in the dropdown no longer closes the user menu.
- Resolve the ESLint and prettier findings in the Super Admin files.

* fix(super-admin): stop redirecting /super-admin into the install wizard (OHE-3462) (#636)

The dashboard layout sent a Super Admin to /install unless this
browser's localStorage (oh-sa-nux) said the install wizard was
finished. The wizard's last step creates an organization, so opening
the dashboard on a new browser meant creating another one, and there
the default name was already taken.

- super-admin-layout: remove the wizard redirect, the oh-sa-nux
  subscription, and the catalogPreview check that only existed to skip
  it. Access still depends on ENABLE_SUPER_ADMIN and
  manage_super_admins, and everyone else is still sent to /settings.
- Stop seeding all five wizard steps in the layout test, and add a
  test that the dashboard opens with no wizard progress.

The floating setup guide and the starter modal keep their own
conditions. The starter modal opens from a one-shot flag set by the
wizard's last step, on /settings/org-defaults, which any org admin can
reach.

* fix(onboarding): flag-gate /install and remove the persona checklist (OHE-3471) (#637)

Three onboarding surfaces were not behind ENABLE_SUPER_ADMIN: the
/install wizard, the "Setup guide" card in the Settings sidebar, and
the floating "Product tour" button. With the flag off, every SaaS-mode
user still got the card. Members and personal-workspace owners could
never finish or dismiss it: nothing marked "Start first conversation"
done, "Invite teammates" is impossible in a personal workspace, and
"Finish" stays disabled until required steps are done.

- super-admin-install-layout: add a clientLoader that redirects /install
  to / when enable_super_admin is off.
- Remove the persona checklist (sidebar card and
  /settings/getting-started) and the product tour, per D5 in OHE-3461.
  Neither is in OHE-3384's scope. The Super Admin setup guide, already
  behind the flag and dismissible, is now the only checklist.
- Remove what only they used: setup-readiness, use-org-setup, their
  route and tests, 62 SETUP$/PRODUCT_TOUR$ i18n keys
  (PRODUCT_TOUR$DONE stays, the user groups modal uses it), and their
  entries in the mock-only setup test panel and UI catalog.
- Add tests that /install redirects away with the flag off and shows
  the wizard with it on.

* feat(super-admin): create organizations with an initial owner (OHE-3476) (#638)

The create-organization dialog labeled its fields "Owner name" and
"Owner email", but POST /api/organizations only stored them as contact
fields and created no membership, so every new organization started
with zero members. The frontend then switched the Super Admin into it,
which the Super Admin bypass in switch_org allows.

- OrgCreate takes an optional owner_user_id: the caller or an existing
  user. When set, the route checks that the user exists (404 if not)
  and creates the org through create_org_with_owner with
  add_creator_as_owner=True, the same path the default-org bootstrap
  uses: the owner joins the LiteLLM team, gets a key, and the owner
  membership is persisted with the org. Without the field, the call is
  unchanged.
- The dialog gets an Owner picker that defaults to the current user and
  lists the other users from /api/admin/users. The contact fields are
  labeled as contact fields again, the description and required-fields
  message go back to the main wording, and the unused ORG$OWNER_* keys
  are removed.
- useCreateOrganization no longer switches into an organization owned
  by someone else. With no owner (the /install wizard), it still
  switches as before.
- The mock create handler honors owner_user_id for another user; the
  no-owner case is left to OHE-3469.
- Add route tests for the caller, another existing user, and an unknown
  owner, and modal tests for the default owner and choosing another
  user.

* fix(super-admin): hide Provision User when provisioning is off (OHE-3480) (#639)

The Users page always offered "Provision User", but
POST /api/organizations/provision-user is only registered when
USER_PROVISIONING_ENABLED is set. That is an OEM option and is off by
default, so on a normal install the form ended in a 404. The mock
always answered, so the demo hid it.

- The web-client config gets a top-level user_provisioning_enabled
  field. It reads server.constants.USER_PROVISIONING_ENABLED, the same
  value saas_server uses to register the route, so the two cannot
  disagree.
- The Users page shows the button only when the field is true. When it
  is false, the subtitle reads "Review users across all organizations."
  instead of "Provision and review users across all organizations."
- The mock config reports provisioning on in mock SaaS mode, so the
  demo flow still works.
- Add a config test for both values of the switch, and Users page
  tests for the button and subtitle with provisioning on and off.

* fix(super-admin): confirm before destructive dashboard actions (OHE-3484) (#640)

Deleting or suspending an organization, revoking a Super Admin, and
removing a user from organizations all ran on a single click. The row
menu calls an item's handler as soon as it is clicked, and these
handlers called the API directly. Only "Delete user" asked first.

- Organizations page: Remove opens the same confirmation as the delete
  in organization settings, naming the organization. Suspend opens a
  confirmation that names the organization and says its members cannot
  use it until it is resumed.
- Admins page: Revoke opens a confirmation naming the Super Admin.
- Manage User modal: bulk and per-row membership Remove show an inline
  confirmation naming the user and the organizations, like the existing
  "Delete user" step in the same modal.
- Cancel closes the confirmation without calling the API.
- Add Organizations and Admins page tests and extend the Manage User
  modal tests. The existing remove assertions now confirm first.

* fix(super-admin): protect personal workspaces and the acting admin (OHE-3485) (#641)

The dashboard treated personal workspaces like team organizations and
let a Super Admin act on their own account. Removing the admin's own
personal workspace deleted their user record, and the Super Admin role
with it, which got around the rule that the last Super Admin cannot be
removed. "Grant yourself access" could add the admin to another user's
personal workspace, because the backend only rejected the target
user's own workspace. Removing a user from their personal workspace
was skipped silently while the UI reported success.

- Admin API: reject suspending or deleting a personal workspace, adding
  anyone to a personal workspace, and removing a user from their own
  personal workspace instead of skipping it. Reject suspending your own
  account and removing yourself from every team organization. Each
  returns 403.
- Organizations page: another user's personal workspace has no open
  link and no actions menu. Your own personal workspace offers only
  View.
- Users page: another user's personal workspace is not a link.
- Manage User modal: the user's own personal workspace is no longer
  listed as a group. Suspend account and Delete user are disabled when
  you manage yourself.
- Add a backend test for each rejected case and frontend tests for the
  hidden and disabled actions. Three existing route tests now patch the
  personal-workspace lookup.

* fix(super-admin): run the standard cleanup on dashboard removals (OHE-3486) (#642)

Removing a user from an organization in the Super Admin dashboard
deleted the membership row and nothing else. The Members page removal
also resets the user's current organization when it pointed at that
organization, and removes the user from the organization's LiteLLM
team. The dashboard skipped both, so a removed user could be left with
a current organization they no longer belong to and keep their LiteLLM
team membership. The dashboard could not reuse remove_org_member,
which requires the caller to be a member who outranks the target.

- Move the row delete, current-org reset and LiteLLM team removal out
  of OrgMemberService.remove_org_member, unchanged, into
  remove_member_with_cleanup. remove_org_member keeps its checks and
  calls it.
- Both dashboard removals, DELETE /api/admin/users/{id} and the
  "remove" action on /groups, call it instead of deleting the row
  directly. Their own checks are unchanged.
- Add a route test for each that asserts the current-org reset and the
  LiteLLM team removal.

* fix(super-admin): show real instance values and link the SSO docs (OHE-3482) (#643)

The Instance page had no link to the SSO documentation, which the
dashboard ticket asks for. Its "Allow users to have personal workspace"
switch was hard-coded off whatever the deployment said, and the page
still called its controls "local stubs" although the email switch
already read the real config. The setup guide's optional SAML stop also
highlighted the "Show Setup guide" switch, because that selector came
first in its anchor list.

- Instance page: add a "Single sign-on (SAML)" entry that links to the
  SAML SSO guide on docs.openhands.dev in a new tab.
- The personal-workspace switch now reads hide_personal_workspaces from
  the web-client config (HIDE_PERSONAL_WORKSPACES). It stays read-only.
- Remove the "These controls are local stubs" hint and its i18n key.
- Setup guide: the tour's optional SAML stop highlights the new SSO
  entry.
- Add Instance page tests for the docs link and for the switch with
  personal workspaces shown and hidden.

* feat(super-admin): store the company name and logo on the server (OHE-3467) (#644)

The company name and logo set in the first-install wizard and on the
Super Admin Instance page lived only in the localStorage of the browser
that set them. Other users, and the same admin on another browser,
never saw the logo, and clearing site data lost it. The backend had no
instance-level settings to keep them in.

- Add a single-row instance_settings table (migration 176) for the
  company name and the logo, stored as the client-resized data URL.
- GET /api/admin/instance-settings returns them to any signed-in user.
  PATCH requires MANAGE_SUPER_ADMINS, changes only the fields it is
  sent (null clears one), and accepts only a PNG, JPEG or WebP data
  URL of at most 512 KB.
- The Instance page and the logo beside the product mark read and
  write through the API. The read runs only when ENABLE_SUPER_ADMIN is
  on, so other deployments make no extra request. The localStorage
  logo store is removed.
- The wizard's company step saves the name and any newly chosen logo
  on Continue, shows the saved logo when the admin comes back to the
  step, and stays on the step if saving fails.
- Add mock handlers for both endpoints, and update the UI catalog copy
  that said the logo is never uploaded.
- Add route tests for sign-in, permission, partial updates, visibility
  to other users and invalid values, and frontend tests for the
  Instance page, the settings navigation logo and the company step.

* fix(super-admin): gate the admin directory and require org membership (OHE-3483) (#645)

ENABLE_SUPER_ADMIN only hid the UI. The /api/admin directory routes
were always mounted, and authorization changed on every deployment,
flag on or off: an instance Super Admin passed every permission the
organization owner role has, in any organization, without being a
member. That covered organization secrets, API keys, billing and LLM
settings. /me returned a made-up owner record for them, and they could
switch into organizations they did not belong to. This contradicted the
model documented in authorization.py and OHE-2605, and the service
layer still required membership, so the access only half worked. The
dashboard already asks the admin to grant themselves access before
opening an organization, so explicit join is the model kept here.

- Mount the /api/admin directory router (organizations, users,
  instance-settings) only when ENABLE_SUPER_ADMIN is on. The
  super-admins API, create-organization and provision-user stay
  mounted.
- Remove the owner-level fallback from require_permission and
  authorize_permission. A Super Admin who is not a member gets only
  the explicit super-role permissions.
- Remove the made-up /me record (MeResponse.for_instance_super_admin).
  get_me raises not-found for non-members again.
- switch_org requires membership for everyone again. The suspended-org
  and inactive-membership rules are unchanged.
- Return the superadmin permission set to main's. VIEW_ORG_CONVERSATIONS,
  which the dashboard overview needs to read usage across
  organizations, is granted only while the flag is on.
  DELETE_ORGANIZATION and VIEW_ORG_SETTINGS are dropped: the dashboard
  deletes through /api/admin, and the regular delete still requires an
  owner, so the extra permission only showed a Delete button that
  failed.
- Tests state the model: a non-member Super Admin is refused org
  secrets, API keys, billing and org settings edits, /me raises
  not-found, switch_org refuses them, the dashboard permission follows
  the flag, and the directory routes are served only with the flag on.

* docs(super-admin): name both variables that turn the flag on (OHE-3487) (#646)

The comment on enable_super_admin told operators to set
ENABLE_SUPER_ADMIN=true. That only works when no
OH_WEB_CLIENT_FEATURE_FLAGS_* variable is set. Replicated and every
saas-deploy environment set several, and then the web-client flags are
built from those alone, so the bare variable never reaches
enable_super_admin and the dashboard stays hidden. The server still reads
only the bare variable to mount the /api/admin directory, so a
deployment needs both.

- web_client_models.py: name both variables and say what each one
  drives. Comment only.

* feat(super-admin): store first-install and setup-guide state on the server (OHE-3463) (#647)

The first-install wizard and the Super Admin setup guide kept their
state only in browser localStorage. The server could not tell whether
an instance still needed setup, who should do it, whether they had
finished, which organization the guide belonged to, or whether it was
dismissed, and Agent Canvas could not read any of it. The per-user
onboarding_completed flag cannot answer this: OHE never clears it, and
its self-hosted first-owner check matches every personal workspace.

- Add setup_user_id, wizard_completed, guide_org_id and
  guide_dismissed to instance_settings (migration 177). guide_org_id
  is cleared when its organization is deleted.
- create_user records the first user, the one it makes Super Admin,
  as setup_user_id while ENABLE_SUPER_ADMIN is on. Upgraded instances
  and instances first used with the flag off record no one.
- GET /api/admin/setup-state returns the wizard and guide state for
  the caller. Only the first Super Admin gets real values; everyone
  else gets the defaults. PATCH changes only the fields it is sent,
  is limited to the first Super Admin, and returns 404 for an unknown
  organization.
- Add the frontend service methods, useSetupState (runs only with
  enable_super_admin), useUpdateSetupState and mock handlers.
- Add route tests for sign-in, an instance with no recorded setup
  user, the first Super Admin, a later admin, a completed wizard,
  guide org and dismissal, the 403 and 404 cases and org deletion;
  user store tests for recording the first user with the flag on and
  off; and hook tests for reading, the flag-off case and updating.

* fix(super-admin): drop the install account step and require sign-in (OHE-3465) (#648)

The first-install wizard asked for a name, an email and a password to
"create your Super Admin account", but created nothing: the name and
email went to localStorage and the password was dropped. The server
has no way to create that account either. It has no password login,
and the Keycloak realm turns off registration and password sign-in.
The first user already becomes Super Admin when they first sign in
through the identity provider, and #647 records them as the setup
user at that point. So the wizard now runs after sign-in, as that
user, instead of pretending to create one.

- Remove the account step: its route, its place in the NUX state and
  the step bar, its intermediate-page entry, the mock harness jump and
  the 15 i18n keys only it used. Terms now continues to company.
- The org step took the new org's contact name and email from the
  account step. It now reads them from the signed-in user's personal
  workspace, which holds the name and email from sign-in. Without
  that, its admin@localhost fallback fails the backend's email check.
- The install layout's loader sends a signed-out visitor to
  /login?returnTo=<path>, the same URL the root layout uses. Only a
  401 counts as signed out; other errors still surface.
- Update the UI catalog entries and their zh-CN/zh-TW copy that
  listed the account step, and the two tests that referenced it.

* fix(super-admin): drop the install terms step and rely on /accept-tos (OHE-3466) (#649)

The first-install wizard showed twelve paragraphs of placeholder terms
labelled "Placeholder draft" and kept acceptance only in localStorage.
It was also a second acceptance. Both login callbacks send a user who
has not accepted the terms to /accept-tos, which records them with
POST /api/accept_tos. Until then the auth middleware rejects every API
call except that one, including the /api/authenticate check the
install layout has run since #648. So the wizard cannot load before
the real terms are accepted, and its own terms step could only ask
again.

- Remove the terms step: its route, its place in the NUX state and the
  step bar, its intermediate-page entry, the mock harness jump and the
  3 i18n keys only it used. Welcome now continues to company, and the
  step bar has five steps.
- Update the UI catalog entries and their zh-CN/zh-TW copy that listed
  the terms step, and the two tests that referenced it.

* feat(super-admin): route the first Super Admin into /install and guard it (OHE-3464) (#650)

A fresh install had no way into the first-install wizard. Sign-in only
knew about the /onboarding survey, and on OHE that page bounces straight
back out because enable_onboarding is off. /install itself only checked
that the flag was on and the visitor was signed in, so anyone could
open it at any time, and its last step never told the server the wizard
was done. #647 stored that state on the server, but nothing used it yet.

- Sign-in: _get_post_auth_redirect sends the first Super Admin to
  /install while the wizard is unfinished. New users reach it through
  /accept-tos on both the Keycloak and the OAuth v2 path. The Keycloak
  callback does the same for a returning first Super Admin, in the
  branch that already checks for onboarding.
- The wizard replaces the onboarding survey for that user (D3 in
  OHE-3461): _should_redirect_to_onboarding returns false for them, so
  /api/onboarding_status no longer sends them to /onboarding either.
- With ENABLE_SUPER_ADMIN off the setup row is never read, and instances
  with no recorded first Super Admin behave as before.
- /install: the loader fetches the setup state and redirects to / unless
  the wizard is pending for the caller. If this browser holds finished
  progress the server doesn't (an earlier install on the same host), it
  clears it so the wizard can run.
- The org step, the wizard's last, records wizard_completed after it
  creates the organization, so the wizard doesn't come back on another
  browser. If that fails, the admin stays on the step with an error.
- The mock setup state starts pending, like a fresh install.
- Tests: the post-auth redirect for a pending, a finished and another
  user and with the flag off, against Postgres; the Keycloak callback
  for a returning first Super Admin; the /install guard; the org step
  recording completion and failing to.

* fix(super-admin): make the Super Admin the owner of the first organization (OHE-3469) (#651)

The wizard's org step created the first organization without an owner.
Since #638, POST /api/organizations adds an owner membership only when
owner_user_id is sent, so the new org had no members. The create hook
then called /switch, which the server refuses for non-members, ignored
the error and selected the org in the browser anyway. The Super Admin
landed on org LLM defaults for an org they weren't in: reads and saves
returned 404 and the org was missing from their switcher. The mock hid
this by making the creator the owner.

The default-org bootstrap (D4 in OHE-3461) only runs from the Keycloak
callback, and that path is going away (OHE-3293), so the fix lives in
the wizard and works whatever the sign-in path.

- Org step: on submit it reads the org list. If the Super Admin already
  belongs to a team org (the default-org bootstrap's, or one an earlier
  attempt created before recording completion failed), it renames that
  org. Otherwise it creates one with owner_user_id set to the Super
  Admin, whose id is their personal workspace's id. It never creates a
  second org.
- It then switches into the org and only then records wizard_completed.
  If the server refuses the switch, the admin stays on the step with
  the error and can retry. One submitting flag covers the whole step.
- useCreateOrganization selects the new org locally only after /switch
  succeeds.
- Mock: POST /api/organizations adds the current user only when
  owner_user_id is theirs, and no longer switches into the new org,
  like the real endpoint.
- Tests: the org step creating an org owned by the Super Admin, renaming
  an org they already belong to, and staying put when the switch is
  refused; the create dialog staying in the current org when the switch
  is refused.

* fix(super-admin): drop the install license-key box and its trial copy (OHE-3468) (#652)

The company step of the first-install wizard had a license-key box
that did nothing. Connect kept the typed key in component state, and
Continue saved only a hasLicenseKey boolean to localStorage that
nothing reads. The key was never validated, sent or stored, yet the
screen promised "a 30-day trial" or "the evaluation trial". Its
Register and Login buttons opened two hard-coded external URLs, one
of them the Replicated customer portal.

The enterprise backend has no license endpoint, and Replicated
installs already require a license: every image is pulled through the
license's proxy registry path. So this removes the box, as D6 in
OHE-3461 recommended, instead of building a check.

- Company step: remove the license-key input and Connect button, both
  trial messages, the Register and Login buttons, and the two URL
  constants. Saving the company name and logo is unchanged.
- NUX state: remove hasLicenseKey from the company entry, its setter
  and the mock harness presets.
- i18n: remove the 7 keys only the box used, and reword
  SA_NUX$COMPANY_BODY and SA_NUX$STEP_COMPANY_DETAIL, which still
  mentioned licensing.
- Update the UI catalog's company entry and its zh-CN/zh-TW copy, and
  the one NUX test that passed hasLicenseKey.

* feat(super-admin): save the starter modal's LLM to the org profile (OHE-3470) (#653)

The starter modal on org LLM defaults let the Super Admin pick a
provider, models and an API key, but the lists were hard-coded and
"Get started" only cleared the local starterModalPending flag. Nothing
was saved, so the organization kept its previous LLM.

The modal now uses the same model catalogue and the same three calls as
the org LLM form. Saving a profile with an explicit llm and activating
it would only change the caller's member settings, so the org defaults
are saved first, as the form does.

- Starter fields: providers and models come from the config search API,
  with hidden aliases left out and verified models first. The model menu
  keeps its look but picks one model: each row is a radio and the All
  action is gone, since a provider can list more models than an org can
  hold profiles. The list scrolls past a fixed height.
- The API key field follows the form's rule: hidden for OpenHands
  models and when allow_user_llm_configuration is off. Changing the
  provider clears the model and the key.
- Get started saves the org settings with the model, a null base_url
  and the typed key, saves a profile that copies them, activates it,
  marks the guide's add-llm step and closes. It stays disabled until a
  model is chosen and the org is known. A failure shows the server's
  message in the modal and keeps it open. Skip still saves nothing.
- Catalog: the starter card no longer says models are checkboxes with
  All.
- Tests: the list comes from the server, Get started waits for a model,
  saving runs the three calls and closes, a failed save stays open with
  the error, Skip saves nothing, and no key is asked for when user LLM
  configuration is off.

* feat(super-admin): derive setup-guide progress from server data (OHE-3472) (#654)

The Super Admin setup guide kept its progress and visibility in one
localStorage key, so it was per browser and not tied to an
organization. Only "create organization" and "add an LLM" were ticked
by real actions, and the LLM tick fired for any organization. The other
steps were checkboxes the admin ticked by hand. The floating widget
also waited on this browser's own wizard key, so it never showed on
another browser. #647 stored the guide's organization and dismissal on
the server, but nothing set the organization and the guide still read
only localStorage.

- setup-state: GET and PATCH return guide_steps for the first Super
  Admin while the guide has an organization and is not dismissed. Each
  step is read from what that organization really has:
  - org_llm: a saved LLM profile other than the Default one every org
    is seeded with.
  - mcp_server: the first Super Admin has an MCP server in the org. MCP
    servers belong to each member.
  - invite: a second member, or a pending invitation that has not
    expired.
  - automation: the automation service lists one for the org.
    Automations live in that service's own database, so the caller's
    cookie or Authorization header is forwarded with X-Org-Id. If the
    service is not configured or the call fails, the step stays undone.
- The wizard's org step saves guide_org_id with wizard_completed, so the
  guide belongs to the organization the Super Admin owns.
- The guide page, its sidebar card and the floating widget read that
  state instead of localStorage. The widget no longer waits on the
  local oh-sa-nux key, and it re-reads progress on navigation and after
  an LLM save. The manual checkboxes are gone; each row shows a status
  circle with the same look.
- Remove setup guide and the Instance page switch save guide_dismissed
  on the server. The switch is disabled for Super Admins without a
  guide, since only the first Super Admin can change it.
- "Add an integration" now opens /settings/mcp and is checked by the
  MCP signal, matching the ticket's "connect MCP integrations" step.
  Its tour stop and hint follow. Optional SAML stays a link and does
  not count toward progress.
- Remove the oh-super-admin-setup store and the unused mark
  complete/incomplete strings. The tour still advances on the step
  event. Update the mock, the QA panel and the catalog copy.
- Tests: route tests against Postgres for each step, an expired
  invitation, the headers sent to the automation service and a failing
  service; frontend tests for the derived progress, SAML not counting,
  no guide for other users or after dismissal, removing and toggling
  the guide on the server, and the widget re-reading progress on the
  next page.

* fix(super-admin): align the setup guide's steps with the ticket (OHE-3473) (#655)

OHE-3384 asks the setup guide for four steps: configure the org LLM,
choose an automation template, connect MCP integrations and invite
users. The guide had six. "Create an organization" was always checked,
because the guide only exists once the install wizard has given it an
organization (OHE-3469). "Create first automation" opened the
automations list instead of the templates. Its tour stop went to "/",
which hard-redirects into Agent Canvas, so the tour ended there on an
anchor no page renders.

- The steps are now: add an LLM, choose an automation template, add an
  MCP integration, invite users, then the optional SAML link. Progress
  counts four steps.
- The automation step is "Choose an automation template". It opens
  /automations/templates, which lands on the Agent Canvas templates
  page. The link goes through the automations redirect rather than
  /canvas/..., because the cross-app redirect shows an error on a
  second in-app visit to the same /canvas URL.
- The tour drops the create-org stops and the cross-app automation
  stop. Starting the guide on a step that has no tour stop opens that
  step's page instead of restarting the tour at the LLM step.
- The create-organization modal no longer signals a guide step.
- Remove the organization step's strings. Update the setup subtitle
  and the UI catalog copy.

* fix(super-admin): make Delete user remove the account and its data (OHE-3477) (#656)

The dashboard's Delete user only removed the user from their team
organizations. The user row, the personal workspace, API keys, git and
Keycloak tokens, the LiteLLM user and the Keycloak account all stayed,
so the person could sign in again and every API key kept working. The
user row could not simply be deleted either: conversation, quota,
budget, Git claim and invitation rows hold foreign keys to it, and a
leftover legacy user_settings row re-creates the user on the next
lookup.

- Add UserStore.delete_user. In one transaction it deletes the user's
  conversations in every organization, API keys, git and Keycloak
  tokens, device codes, personal secrets, quota and budget rows,
  legacy settings and memberships, then the user row. Git claims and
  invitations the user made in a team organization pass to another
  owner of that organization, and the setup-user pointer is cleared.
- DELETE /api/admin/users/{id} now deletes the user. It still refuses
  self-deletion and the last owner of a team organization, and now
  refuses the last Super Admin through revoke_super_admin's locked
  check. Once the account is gone it removes the personal workspace,
  the LiteLLM user and the Keycloak account best effort, logging any
  failure.
- Manage User: the hint, confirmation and toasts describe a permanent
  delete, a successful delete also refreshes the Admins list, and the
  mock API drops the user.
- Replace the route tests for the old behaviour. Add route tests for
  the refusals and the cleanup order, Postgres tests for the cleanup
  steps, and a hook test for the Admins refresh.

* fix(super-admin): make Suspend account block sign-in and API keys (OHE-3478) (#657)

The dashboard's Suspend account only marked each of the user's
memberships inactive. The user could still sign in and use their API
keys, any new active membership un-suspended them, a user with no
memberships could not be suspended, and suspending a Super Admin did
nothing because Super Admins skip the membership check.

- Add user.is_disabled (migration 178). Migration 162 dropped the
  column of the same name when #181 was reverted.
- PATCH /api/admin/users/{id} now sets the flag instead of every
  membership status. It still refuses suspending yourself, and now
  refuses the last enabled Super Admin with a 409, checked under a
  FOR UPDATE lock. The directory reads the user's status from the flag.
- revoke_super_admin, which delete also uses, now requires another
  enabled Super Admin, so the instance cannot be left with only
  disabled ones.
- SaasUserAuth.get_instance rejects a disabled user, so API keys, the
  legacy cookie and the OAuth v2 cookie all get a 401 and the cookies
  are cleared.
- Sign-in refuses a disabled user with 401 account_disabled: the
  Keycloak path in DefaultUserAuthorizer, like blocked domains, and the
  OAuth v2 login callback before tokens are stored. Without this,
  auto-login would send them back to the identity provider in a loop.
- Manage User: a user suspended in every organization no longer shows
  as an inactive account, the account hint describes the new effect,
  and the mock API matches the server.
- Update the route tests for the old behaviour. Add Postgres tests for
  the flag and the Super Admin guards, and tests for get_instance, both
  sign-in paths and the Users page.

* fix(super-admin): explain a suspension to the affected user (OHE-3479) (#659)

A Super Admin can suspend an organization, a user's membership in one,
or the whole account, and the server enforces all three, but the
affected user was never told why. A refused sign-in showed the raw
callback JSON {"detail":"account_disabled"}. Requests in a suspended
organization failed with a 403 the frontend ignored, so /settings sat
on a loading skeleton and other calls showed raw toasts.

- Sign-in: both callbacks send a disabled user to
  /login?account_disabled=true instead of a 401 JSON, the way
  recaptcha_blocked already works, and the login page explains it. No
  tokens are stored and no cookie is set, as before.
- Suspended organization or membership: the response interceptor
  records a 403 "Organization is suspended" or "User membership is
  suspended" against the selected organization. A failed switch is
  left alone and stays a toast. The root layout then shows only a
  blocking modal that says what is suspended and who to contact, and
  lists the user's other organizations. Switching lifts it.
- Add the five strings in all 15 languages.
- Update the two callback tests for the redirect. Add tests for the
  login message, the block and the switch, the membership message, and
  the 403s the interceptor must ignore.

* feat(super-admin): invite a person into any organization from the dashboard (OHE-3481) (#661)

The PRD lets a Super Admin add someone to any organization by
invitation. The dashboard could only add people who already had an
account: "Add to org" in Manage user needs an existing user, and
"Provision User" is hidden unless USER_PROVISIONING_ENABLED is set. The
invitation API already lets a Super Admin who is not a member invite
into any organization, including as owner, and returns a link to copy.
Nothing on the dashboard called it.

- Reuse the Add Members modal. When the dashboard passes it a list of
  organizations, it shows an organization picker and offers the owner
  role. Settings > Members is unchanged.
- useInviteMembersBatch and usePendingInvitations take an optional org
  id and fall back to the selected org, as before.
- The Users page gets an "Invite by email" button. Each team
  organization's row menu on the Organizations page gets an "Invite by
  email" item with that organization preselected. Personal workspaces
  are not offered.
- With email delivery off, the modal shows each invite link to copy,
  as it already did in settings.
- Add the "Invite by email" string, mention inviting in both Users page
  subtitles, and add the dialog to the UI catalog.
- Add tests for the organization picker, the owner role, both entry
  points, the links shown when email delivery is off, and personal
  workspaces.

* test(super-admin): cover the untested admin actions, API client and usage hook (OHE-3489) (#663)

OHE-3489 asks for a test behind every Super Admin screen and admin
action. Its list of gaps predates the sub-PRs that dropped the account,
terms and license steps and added tests for most screens. What was
still untested: the add, set_role and resume membership actions, org
resume and account re-enable, two personal-workspace cases, the
structured feature-flag variable, the Admins page grant flow, Resume on
the Organizations page, the usage hook and the API client. Every
frontend test mocked the client, so a wrong URL, method or body could
not fail any of them.

Backend:
- add: creates a missing membership at the chosen role with the
  LiteLLM key, and reactivates a suspended one instead of adding a
  second row.
- set_role: changes the role on an existing membership and refuses to
  demote the last owner.
- resume: the existing suspend tests for memberships, organizations
  and accounts now also cover resume and re-enable.
- Deleting a user is not blocked by owning their personal workspace.
- The personal-workspace check runs against the database for a
  personal workspace and for a team organization.
- OH_WEB_CLIENT_FEATURE_FLAGS_ENABLE_SUPER_ADMIN turns the web-client
  flag on.

Frontend:
- superAdminService: each of the 15 calls sends the method, path, body
  and headers of its backend route, and the list calls unwrap their
  response envelopes.
- Admins: granting Super Admin by email closes the dialog and lists
  the new admin.
- Organizations: Resume runs without a confirmation dialog.
- useUpdateSuperAdminUserGroups and useUpdateSuperAdminUserStatus call
  the client and refresh the user list. useProvisionUserToGroups
  provisions each organization in order and leaves the password out
  when none is given.
- useSuperAdminUsage sums usage across team organizations only,
  fetches only the selected organizations, and requests every
  conversation for the year-to-date window.

* chore(super-admin): remove the mock and QA tooling and stale stub copy (OHE-3488) (#664)

The prototype's review tooling was still in the app. The UI catalog and
the setup test harness did nothing without VITE_MOCK_API, but their
routes, a persona override inside the Super Admin access checks, and an
ungated ?catalogPreview=1 bypass of the install step order all reached
production builds. The mock API also disagreed with the backend on
create-organization and provisioning, which is how OHE-3469 and OHE-3480
stayed hidden.

- Remove the /ui-catalog pages, the setup test harness panel and its
  persona override, the catalogPreview and forceOpen branches, the
  unused root-to-settings route and the sample usage data. The catalog's
  reviewer notes move to .pr/ui-catalog-review-notes.md.
- Move the Super Admin row types from super-admin-mock.ts to
  super-admin-types.ts.
- Start the mock worker in development only again, as on main.
- Drop "This UI is not wired to the API yet." from the grant dialog and
  delete the unused "stub data" hint.
- Mock create-organization like the backend: request validation, the
  owner lookup, the exact 409 message, and only the owner becomes a
  member. /me, switch and the organization list now respect membership.
- Mock provisioning like the backend: 405 when it is off, the target-org
  and personal-workspace checks, the requested password, and no
  re-enabling of suspended accounts.
- Delete the two tests whose subject is gone, and move the sample user
  rows into the one test that uses them.

* fix(super-admin): renumber the org status migration to 179 (OHE-3491) (#667)

Merging main into this branch brought in #599's
175_add_sandbox_lifecycle_columns.py. It declares revision 175 on top
of 174, the same as this branch's 175_add_org_status.py. Alembic keeps
only one file per id and then reports two heads (175 and 178), so
alembic upgrade head fails. The migration check fails on the duplicate
revision, and every backend test run stops while building the template
database.

- Rename 175_add_org_status.py to 179_add_org_status.py and chain it
  after 178. The chain is now 174 -> 175 (main's sandbox lifecycle
  columns) -> 176 -> 177 -> 178 -> 179.
- Move only this migration. 176-178 don't use org.status, and main's
  175 can't change because deployed databases have already applied it.
- Update the docstring's Revision ID and Revises to match.

* fix(super-admin): wait for sign-in before showing the setup guide (OHE-3497) (#668)

With ENABLE_SUPER_ADMIN on, a first-time user who accepted the Terms of
Service landed back on /login and could never finish signing up. The
setup guide widget is mounted around every root-layout page, including
/accept-tos, and its query reads GET /api/admin/setup-state whenever the
flag is on. On /accept-tos the session cookie still says
accepted_tos=false, so the auth middleware refuses the call with
TosNotAcceptedError. That is an AuthError, so the middleware also ends
the Keycloak session and deletes the keycloak_auth cookie. The
POST /api/accept_tos that follows has no cookie and gets a 401, the page
falls back to /, and the user is sent to /login. Acceptance is never
saved, so every retry loops.

- Mount the widget only when the user is signed in and not on an
  intermediate page (/accept-tos, /information-request, /install). The
  layout already skips the auth check on those pages for the same
  reason.
- Add root-layout tests: /accept-tos makes no setup-state call, and a
  signed-in page still loads the guide. The config is seeded into the
  query cache as PostHogWrapper does in the app, and the file uses the
  real intermediate-page hook instead of the global mock.

* fix(super-admin): open the automation templates after the starter modal saves the LLM (OHE-3499) (#669)

After the first Super Admin saved an LLM in the starter modal on
/settings/org-defaults, the modal closed and left them on that page. The
setup guide's next step, choosing an automation template, then needed
another click in the guide. saveLlm marked the LLM step done and cleared
the modal, but never navigated.

- After a successful save, navigate to the automation step's destination,
  read from SUPER_ADMIN_SETUP_STEPS (/automations/templates). The
  /automations/* route hands off to /canvas/automations/templates.
- Skip and a failed save stay on the page, as before.
- Render the modal tests through a router stub, and check that saving
  opens the templates page while skipping or failing does not.

* fix(super-admin): refresh the setup guide after adding an MCP server or inviting someone (OHE-3500) (#670)

After adding an MCP server, "Add an integration" stayed unchecked in the
setup guide until the page was reloaded, and "Invite users" did the same
after an invitation. The server already counts both at once. The guide
re-reads its progress only when the route changes or when
SUPER_ADMIN_SETUP_STEP_EVENT fires, and the query is cached for five
minutes. Both actions stay on the same page, and only the LLM saves fired
the event.

- Fire notifySuperAdminSetupStep("add-integration") when adding an MCP
  server succeeds on /settings/mcp.
- Fire notifySuperAdminSetupStep("invite-users") when an invitation
  succeeds. The invite modal is shared by Members settings and the Super
  Admin dashboard.
- Notify from the callers, as the LLM paths do, so the mutation hooks
  stay free of guide code.
- Test both events, and that the floating guide re-reads its progress on
  the event without a route change.

* fix(super-admin): show personal workspaces as Personal Workspace in the organizations table (OHE-3501) (#671)

The Super Admin Organizations table showed a personal workspace by its
stored name, user_<id>_org. Personal workspaces are created with that
name, and the admin API already marks them with is_personal. The rest of
the app shows ORG$PERSONAL_WORKSPACE when it is set (the org selector,
the suspended-workspace modal and the API key pages), but the table
copied org.name as is.

- Use ORG$PERSONAL_WORKSPACE for rows with is_personal. Team
  organizations keep their names, and the stored name does not change.
- The search and the confirmation text use the same label. The contact
  email column still tells personal workspaces apart.
- Add a test, and update the personal-workspace test that looked for
  user_7_org.

* fix(super-admin): show personal workspaces as Personal Workspace in the users table (OHE-3502) (#672)

The Super Admin Users table listed a user's personal workspace by its
stored name, user_<id>_org, in the Organizations column. OHE-3501 fixed
the Organizations table, but the users mapping copied each membership's
org_name as is. Membership rows carry no is_personal flag; a personal
workspace shares its owner's id, which is the rule the server and the
other Super Admin views already use.

- Use ORG$PERSONAL_WORKSPACE for a membership whose org_id equals the
  user's id. Team organizations keep their names, and the stored name and
  the API do not change.
- The users search and the open-organization prompt use the same label.
- Add a test, and update the personal-workspace test that looked for
  user_7_org.

* fix(super-admin): open Agent Canvas's MCP page from the setup guide's integration step (OHE-3516) (#685)

The Agent Canvas setup guide's "Add an integration" step now opens Canvas's
own MCP page (OpenHands/OpenHands#18066). The enterprise guide still sent
the admin to /settings/mcp, so the two guides opened different pages for
the same step. Canvas's MCP page saves to the same member settings the
mcp_server signal checks.

The guide opens steps with React Router's navigate. A /canvas/... URL
opened that way goes through routes/cross-app-redirect.tsx, which shows an
error page when the same URL is opened twice in a session. That is why
the automation step points at /automations/....

- Point "Add an integration" at /canvas/mcp.
- Open setup steps with navigateOrHardRedirect from Start, the floating
  guide and the setup page. A /canvas/... step gets a page load, and the
  other steps navigate as before.
- Remove the step's tour stop and its unused nav selector. The tour cannot
  follow into Canvas, the same as for the automation template step.
- Test that Start, the setup page row and the floating guide row open
  /canvas/mcp with a page load.

* feat(super-admin): open the next setup guide step when one is done (OHE-3525) (#702)

Finishing a setup step ticked its checkbox but left the Super Admin where
they were: the next step and its tour opened only from a click. The
completion event only made the floating guide re-read its progress, and an
open LLM tour carried on through its own stops to the invite tip, skipping
the two steps that live in Agent Canvas.

- When the guide's next step is reported done and the server confirms it,
  the floating guide opens the step after it the way Start does: its tour
  here, or its page in Agent Canvas. A step finished out of order or again,
  and the last required step, open nothing.
- Start and the hand-off show one step's tour, so the LLM tour ends when
  the LLM is saved.
- The tour engine ignores delayed callbacks from a tour that was stopped or
  replaced. driver.js keeps its state at module level, so they would have
  torn down the current tour.
- Links into Agent Canvas name the step in setup_tour, and a page opened
  with setup_tour starts that step's tour here.
- The starter modal leaves the next step to the guide.

* fix(super-admin): keep the dashboard's organization and time window after navigating away (OHE-3528)

Filtering the Super Admin Dashboard to one organization, opening another
page and coming back showed all organizations again, and the time window
went back to 30 days. Both were state inside the dashboard component, which
the /super-admin index route unmounts on navigation. The nav, user menu and
org selector all link to a bare /super-admin, so the URL alone could not
carry them.

- Keep the selected organizations and the time window in a zustand store
  saved to sessionStorage, so they survive leaving the dashboard and
  reloading; a new browser tab starts from all organizations and 30 days.
- Once the organization list loads, drop saved ids that no longer match a
  team organization. A saved time window that is no longer offered falls
  back to 30 days.

* chore: Remove PR-only artifacts [automated]

---------

Co-authored-by: FraterCCCLXIII <panentheum@gmail.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: allhands-bot <allhands-bot@users.noreply.github.com>
hieptl added a commit that referenced this pull request Oct 9, 2026
…s (OHE-3529) (#706)

* feat(frontend): add OpenHands-Neo theme tokens and scoped UI root

Wire agent-canvas-style --oh-* / cool-grey tokens, AgentServerUIRoot, and neo palette application so the SaaS shell can share the same theme foundation.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(frontend): add shared settings and form layout class helpers

Port agent-canvas layout utilities so settings-like pages can reuse the same form, list, and sidebar spacing classes.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(frontend): restyle settings navigation for OpenHands-Neo

Match agent-canvas settings chrome with tokenized nav links, logo header, bottom user menu, and settings-owned gutters.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(frontend): tokenize organization settings pages for neo theme

Restyle org management, members list, and git org rows with shared settings list/form tokens and updated mocks/tests.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(frontend): tokenize budgets and usage dashboard for neo theme

Replace hardcoded greys with base/surface/muted/primary tokens so budgets and usage monitoring match agent-canvas.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(frontend): tokenize shared chrome components for neo theme

Update spinners, badges, chips, context menus, and related shell controls to use --oh-* / muted tokens instead of hardcoded greys.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(frontend): align toast handlers with agent-canvas

Use neo toast tokens, custom CircleX error layout, loading helper, and route call sites through the shared handlers.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(openhands-ui): restyle toasterMessages for neo theme

Replace the pill toast chrome with agent-canvas-aligned surface, border, radius, and status icon colors.

Co-authored-by: Cursor <cursoragent@cursor.com>

* docs: add neo theme component audit notes

Track remaining hardcoded hex surfaces for follow-up tokenization work.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(frontend): align settings shell and neo theme chrome

Restyle the settings rail (sidebar, drawer, white brand mark), forms, integrations, and related surfaces to match OpenHands-Neo tokens and agent-canvas patterns.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(frontend): polish settings nav scope and continue neo UI work

Clarify Personal settings as org-scoped (This org chip), fold Integrations
and Skills into that section, and move User/Application to the bottom.
Continue settings shell, credits, MCP, and chrome alignment.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(frontend): refine neo skeletons and select-style dropdown toggle

Improve loading skeleton fidelity and stagger, and let non-searchable
dropdowns click-open/click-close like other selects.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(frontend): stop LLM profile rows clipping on mobile

Override the shared fixed list-row height and keep the Default badge
inline with the profile name so stacked mobile content no longer
overflows the overflow-hidden profiles list.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(frontend): align settings tests with neo UI behavior

Update frontend tests for neo chrome (toasts, dropdowns, budgets, git settings) and show the org-wide badge on budgets/credits.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(frontend): rename settings nav brand label to Account

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(frontend): reorder org settings nav and add create-org action

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(frontend): add Super Admin shell and polish usage dashboards

Introduce the Super Admin routes and layout with settings-aligned gutters, put Super Admin atop the account menu, and improve dashboard charts with hover tooltips plus a one-line filter toolbar.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat: gate Super Admin dashboard behind ENABLE_SUPER_ADMIN

Add an env/web-client feature flag so Super Admin entry points and /super-admin routes stay off until explicitly enabled (true/1), while mock SaaS and instance Super Admins can use the existing dashboard UI.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat: wire Super Admin live APIs with org suspend usage blocks

Replace Super Admin directory mocks with /api/admin endpoints, add org.status suspend/resume that blocks product and resolver traffic at effective-org resolution, and let instance Super Admins still open and administer suspended orgs.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat: wire Super Admin conversation list and stop actions

Fetch live org conversations into the Super Admin usage dashboard and call the org stop API instead of a local UI-only timeout.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix: tighten Super Admin access and show provision credentials

Gate Super Admin UI on manage_super_admins only, and surface one-time password plus API key after provisioning a user.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat: add the first-install Super Admin onboarding flow

Walk a fresh install through welcome, terms, and account creation, then into the setup guide, so the first Super Admin can finish setup without the settings chrome.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat: start mock API in preview builds

Let VITE_MOCK_API turn on the mock worker outside local dev so a static preview can walk through onboarding without a backend.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat: let Super Admins change membership in specific organizations

A user can be suspended, resumed, removed, or added in one or more groups, and the first-run setup guide stays closed on the setup page.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(frontend): put the resolver list on personal Integrations

Show Git and project-management providers on /settings/integrations with the configure modals from the resolver design, and send old Integrations Hub resolver URLs there.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(frontend): give Super Admin row menus a solid panel

The popover menu style was missing, so organization, user, and admin row actions drew as loose text over the table.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(frontend): require Super Admins to join an org before opening it

Opening an organization they are not an active member of asks them to grant themselves access, defaulting to the admin role.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(frontend): rebuild Super Admin manage user around org access

The dialog now shows the person, their org roles, and an add-to-org step, and a Super Admin can change a membership role in place.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(frontend): pick a role per org when provisioning a user

Each organization is added from a role menu and can be removed before submit, and that role is sent with the provision request.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(frontend): guide first install through company, org, and LLM setup

Super Admins name their company and first organization, then land on LLM setup with a starter prompt. The install screens share a progress bar, footer, and an optional instance logo.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(frontend): open Super Admin from the organization menu

The organization switcher now includes Super Admin Dashboard and stays on that screen, and the first-run starter modal can pick models before setup continues.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(frontend): keep the active setup step open while previewing another

The starter modal now holds the pinned accordion open, and the header, trial note, and last step read as part of the same first-run flow.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(frontend): pin the Super Admin dashboard link in the org menu

Super Admins get a distinct dashboard link above Create organization so it stays visible apart from the workspace list.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(frontend): restyle MCP servers and pin Super Admin in the org menu

Show MCP servers as integration-style rows with display names and known logos, and keep the Super Admin link at the top of the org menu with its shield in the closed field.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(frontend): add a mock catalog of the Super Admin screens

Give reviewers one page that opens each install, guide, and dashboard screen, and switch that page's own copy between English and Chinese.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix: make the Python, frontend test, and lint checks pass

- Extract the org suspension lookup used by require_permission into
  is_org_suspended and default it in the route-test conftest the same way
  the super-role lookup is defaulted. Stub the lifecycle gate and the
  membership lookup in the other unit tests that now reach the database,
  which has no sqlite fallback on main.
- Keep ContextMenuContainer open for clicks inside portalled children, so
  picking an organization in the dropdown no longer closes the user menu.
- Resolve the ESLint and prettier findings in the Super Admin files.

* fix(super-admin): stop redirecting /super-admin into the install wizard (OHE-3462) (#636)

The dashboard layout sent a Super Admin to /install unless this
browser's localStorage (oh-sa-nux) said the install wizard was
finished. The wizard's last step creates an organization, so opening
the dashboard on a new browser meant creating another one, and there
the default name was already taken.

- super-admin-layout: remove the wizard redirect, the oh-sa-nux
  subscription, and the catalogPreview check that only existed to skip
  it. Access still depends on ENABLE_SUPER_ADMIN and
  manage_super_admins, and everyone else is still sent to /settings.
- Stop seeding all five wizard steps in the layout test, and add a
  test that the dashboard opens with no wizard progress.

The floating setup guide and the starter modal keep their own
conditions. The starter modal opens from a one-shot flag set by the
wizard's last step, on /settings/org-defaults, which any org admin can
reach.

* fix(onboarding): flag-gate /install and remove the persona checklist (OHE-3471) (#637)

Three onboarding surfaces were not behind ENABLE_SUPER_ADMIN: the
/install wizard, the "Setup guide" card in the Settings sidebar, and
the floating "Product tour" button. With the flag off, every SaaS-mode
user still got the card. Members and personal-workspace owners could
never finish or dismiss it: nothing marked "Start first conversation"
done, "Invite teammates" is impossible in a personal workspace, and
"Finish" stays disabled until required steps are done.

- super-admin-install-layout: add a clientLoader that redirects /install
  to / when enable_super_admin is off.
- Remove the persona checklist (sidebar card and
  /settings/getting-started) and the product tour, per D5 in OHE-3461.
  Neither is in OHE-3384's scope. The Super Admin setup guide, already
  behind the flag and dismissible, is now the only checklist.
- Remove what only they used: setup-readiness, use-org-setup, their
  route and tests, 62 SETUP$/PRODUCT_TOUR$ i18n keys
  (PRODUCT_TOUR$DONE stays, the user groups modal uses it), and their
  entries in the mock-only setup test panel and UI catalog.
- Add tests that /install redirects away with the flag off and shows
  the wizard with it on.

* feat(super-admin): create organizations with an initial owner (OHE-3476) (#638)

The create-organization dialog labeled its fields "Owner name" and
"Owner email", but POST /api/organizations only stored them as contact
fields and created no membership, so every new organization started
with zero members. The frontend then switched the Super Admin into it,
which the Super Admin bypass in switch_org allows.

- OrgCreate takes an optional owner_user_id: the caller or an existing
  user. When set, the route checks that the user exists (404 if not)
  and creates the org through create_org_with_owner with
  add_creator_as_owner=True, the same path the default-org bootstrap
  uses: the owner joins the LiteLLM team, gets a key, and the owner
  membership is persisted with the org. Without the field, the call is
  unchanged.
- The dialog gets an Owner picker that defaults to the current user and
  lists the other users from /api/admin/users. The contact fields are
  labeled as contact fields again, the description and required-fields
  message go back to the main wording, and the unused ORG$OWNER_* keys
  are removed.
- useCreateOrganization no longer switches into an organization owned
  by someone else. With no owner (the /install wizard), it still
  switches as before.
- The mock create handler honors owner_user_id for another user; the
  no-owner case is left to OHE-3469.
- Add route tests for the caller, another existing user, and an unknown
  owner, and modal tests for the default owner and choosing another
  user.

* fix(super-admin): hide Provision User when provisioning is off (OHE-3480) (#639)

The Users page always offered "Provision User", but
POST /api/organizations/provision-user is only registered when
USER_PROVISIONING_ENABLED is set. That is an OEM option and is off by
default, so on a normal install the form ended in a 404. The mock
always answered, so the demo hid it.

- The web-client config gets a top-level user_provisioning_enabled
  field. It reads server.constants.USER_PROVISIONING_ENABLED, the same
  value saas_server uses to register the route, so the two cannot
  disagree.
- The Users page shows the button only when the field is true. When it
  is false, the subtitle reads "Review users across all organizations."
  instead of "Provision and review users across all organizations."
- The mock config reports provisioning on in mock SaaS mode, so the
  demo flow still works.
- Add a config test for both values of the switch, and Users page
  tests for the button and subtitle with provisioning on and off.

* fix(super-admin): confirm before destructive dashboard actions (OHE-3484) (#640)

Deleting or suspending an organization, revoking a Super Admin, and
removing a user from organizations all ran on a single click. The row
menu calls an item's handler as soon as it is clicked, and these
handlers called the API directly. Only "Delete user" asked first.

- Organizations page: Remove opens the same confirmation as the delete
  in organization settings, naming the organization. Suspend opens a
  confirmation that names the organization and says its members cannot
  use it until it is resumed.
- Admins page: Revoke opens a confirmation naming the Super Admin.
- Manage User modal: bulk and per-row membership Remove show an inline
  confirmation naming the user and the organizations, like the existing
  "Delete user" step in the same modal.
- Cancel closes the confirmation without calling the API.
- Add Organizations and Admins page tests and extend the Manage User
  modal tests. The existing remove assertions now confirm first.

* fix(super-admin): protect personal workspaces and the acting admin (OHE-3485) (#641)

The dashboard treated personal workspaces like team organizations and
let a Super Admin act on their own account. Removing the admin's own
personal workspace deleted their user record, and the Super Admin role
with it, which got around the rule that the last Super Admin cannot be
removed. "Grant yourself access" could add the admin to another user's
personal workspace, because the backend only rejected the target
user's own workspace. Removing a user from their personal workspace
was skipped silently while the UI reported success.

- Admin API: reject suspending or deleting a personal workspace, adding
  anyone to a personal workspace, and removing a user from their own
  personal workspace instead of skipping it. Reject suspending your own
  account and removing yourself from every team organization. Each
  returns 403.
- Organizations page: another user's personal workspace has no open
  link and no actions menu. Your own personal workspace offers only
  View.
- Users page: another user's personal workspace is not a link.
- Manage User modal: the user's own personal workspace is no longer
  listed as a group. Suspend account and Delete user are disabled when
  you manage yourself.
- Add a backend test for each rejected case and frontend tests for the
  hidden and disabled actions. Three existing route tests now patch the
  personal-workspace lookup.

* fix(super-admin): run the standard cleanup on dashboard removals (OHE-3486) (#642)

Removing a user from an organization in the Super Admin dashboard
deleted the membership row and nothing else. The Members page removal
also resets the user's current organization when it pointed at that
organization, and removes the user from the organization's LiteLLM
team. The dashboard skipped both, so a removed user could be left with
a current organization they no longer belong to and keep their LiteLLM
team membership. The dashboard could not reuse remove_org_member,
which requires the caller to be a member who outranks the target.

- Move the row delete, current-org reset and LiteLLM team removal out
  of OrgMemberService.remove_org_member, unchanged, into
  remove_member_with_cleanup. remove_org_member keeps its checks and
  calls it.
- Both dashboard removals, DELETE /api/admin/users/{id} and the
  "remove" action on /groups, call it instead of deleting the row
  directly. Their own checks are unchanged.
- Add a route test for each that asserts the current-org reset and the
  LiteLLM team removal.

* fix(super-admin): show real instance values and link the SSO docs (OHE-3482) (#643)

The Instance page had no link to the SSO documentation, which the
dashboard ticket asks for. Its "Allow users to have personal workspace"
switch was hard-coded off whatever the deployment said, and the page
still called its controls "local stubs" although the email switch
already read the real config. The setup guide's optional SAML stop also
highlighted the "Show Setup guide" switch, because that selector came
first in its anchor list.

- Instance page: add a "Single sign-on (SAML)" entry that links to the
  SAML SSO guide on docs.openhands.dev in a new tab.
- The personal-workspace switch now reads hide_personal_workspaces from
  the web-client config (HIDE_PERSONAL_WORKSPACES). It stays read-only.
- Remove the "These controls are local stubs" hint and its i18n key.
- Setup guide: the tour's optional SAML stop highlights the new SSO
  entry.
- Add Instance page tests for the docs link and for the switch with
  personal workspaces shown and hidden.

* feat(super-admin): store the company name and logo on the server (OHE-3467) (#644)

The company name and logo set in the first-install wizard and on the
Super Admin Instance page lived only in the localStorage of the browser
that set them. Other users, and the same admin on another browser,
never saw the logo, and clearing site data lost it. The backend had no
instance-level settings to keep them in.

- Add a single-row instance_settings table (migration 176) for the
  company name and the logo, stored as the client-resized data URL.
- GET /api/admin/instance-settings returns them to any signed-in user.
  PATCH requires MANAGE_SUPER_ADMINS, changes only the fields it is
  sent (null clears one), and accepts only a PNG, JPEG or WebP data
  URL of at most 512 KB.
- The Instance page and the logo beside the product mark read and
  write through the API. The read runs only when ENABLE_SUPER_ADMIN is
  on, so other deployments make no extra request. The localStorage
  logo store is removed.
- The wizard's company step saves the name and any newly chosen logo
  on Continue, shows the saved logo when the admin comes back to the
  step, and stays on the step if saving fails.
- Add mock handlers for both endpoints, and update the UI catalog copy
  that said the logo is never uploaded.
- Add route tests for sign-in, permission, partial updates, visibility
  to other users and invalid values, and frontend tests for the
  Instance page, the settings navigation logo and the company step.

* fix(super-admin): gate the admin directory and require org membership (OHE-3483) (#645)

ENABLE_SUPER_ADMIN only hid the UI. The /api/admin directory routes
were always mounted, and authorization changed on every deployment,
flag on or off: an instance Super Admin passed every permission the
organization owner role has, in any organization, without being a
member. That covered organization secrets, API keys, billing and LLM
settings. /me returned a made-up owner record for them, and they could
switch into organizations they did not belong to. This contradicted the
model documented in authorization.py and OHE-2605, and the service
layer still required membership, so the access only half worked. The
dashboard already asks the admin to grant themselves access before
opening an organization, so explicit join is the model kept here.

- Mount the /api/admin directory router (organizations, users,
  instance-settings) only when ENABLE_SUPER_ADMIN is on. The
  super-admins API, create-organization and provision-user stay
  mounted.
- Remove the owner-level fallback from require_permission and
  authorize_permission. A Super Admin who is not a member gets only
  the explicit super-role permissions.
- Remove the made-up /me record (MeResponse.for_instance_super_admin).
  get_me raises not-found for non-members again.
- switch_org requires membership for everyone again. The suspended-org
  and inactive-membership rules are unchanged.
- Return the superadmin permission set to main's. VIEW_ORG_CONVERSATIONS,
  which the dashboard overview needs to read usage across
  organizations, is granted only while the flag is on.
  DELETE_ORGANIZATION and VIEW_ORG_SETTINGS are dropped: the dashboard
  deletes through /api/admin, and the regular delete still requires an
  owner, so the extra permission only showed a Delete button that
  failed.
- Tests state the model: a non-member Super Admin is refused org
  secrets, API keys, billing and org settings edits, /me raises
  not-found, switch_org refuses them, the dashboard permission follows
  the flag, and the directory routes are served only with the flag on.

* docs(super-admin): name both variables that turn the flag on (OHE-3487) (#646)

The comment on enable_super_admin told operators to set
ENABLE_SUPER_ADMIN=true. That only works when no
OH_WEB_CLIENT_FEATURE_FLAGS_* variable is set. Replicated and every
saas-deploy environment set several, and then the web-client flags are
built from those alone, so the bare variable never reaches
enable_super_admin and the dashboard stays hidden. The server still reads
only the bare variable to mount the /api/admin directory, so a
deployment needs both.

- web_client_models.py: name both variables and say what each one
  drives. Comment only.

* feat(super-admin): store first-install and setup-guide state on the server (OHE-3463) (#647)

The first-install wizard and the Super Admin setup guide kept their
state only in browser localStorage. The server could not tell whether
an instance still needed setup, who should do it, whether they had
finished, which organization the guide belonged to, or whether it was
dismissed, and Agent Canvas could not read any of it. The per-user
onboarding_completed flag cannot answer this: OHE never clears it, and
its self-hosted first-owner check matches every personal workspace.

- Add setup_user_id, wizard_completed, guide_org_id and
  guide_dismissed to instance_settings (migration 177). guide_org_id
  is cleared when its organization is deleted.
- create_user records the first user, the one it makes Super Admin,
  as setup_user_id while ENABLE_SUPER_ADMIN is on. Upgraded instances
  and instances first used with the flag off record no one.
- GET /api/admin/setup-state returns the wizard and guide state for
  the caller. Only the first Super Admin gets real values; everyone
  else gets the defaults. PATCH changes only the fields it is sent,
  is limited to the first Super Admin, and returns 404 for an unknown
  organization.
- Add the frontend service methods, useSetupState (runs only with
  enable_super_admin), useUpdateSetupState and mock handlers.
- Add route tests for sign-in, an instance with no recorded setup
  user, the first Super Admin, a later admin, a completed wizard,
  guide org and dismissal, the 403 and 404 cases and org deletion;
  user store tests for recording the first user with the flag on and
  off; and hook tests for reading, the flag-off case and updating.

* fix(super-admin): drop the install account step and require sign-in (OHE-3465) (#648)

The first-install wizard asked for a name, an email and a password to
"create your Super Admin account", but created nothing: the name and
email went to localStorage and the password was dropped. The server
has no way to create that account either. It has no password login,
and the Keycloak realm turns off registration and password sign-in.
The first user already becomes Super Admin when they first sign in
through the identity provider, and #647 records them as the setup
user at that point. So the wizard now runs after sign-in, as that
user, instead of pretending to create one.

- Remove the account step: its route, its place in the NUX state and
  the step bar, its intermediate-page entry, the mock harness jump and
  the 15 i18n keys only it used. Terms now continues to company.
- The org step took the new org's contact name and email from the
  account step. It now reads them from the signed-in user's personal
  workspace, which holds the name and email from sign-in. Without
  that, its admin@localhost fallback fails the backend's email check.
- The install layout's loader sends a signed-out visitor to
  /login?returnTo=<path>, the same URL the root layout uses. Only a
  401 counts as signed out; other errors still surface.
- Update the UI catalog entries and their zh-CN/zh-TW copy that
  listed the account step, and the two tests that referenced it.

* fix(super-admin): drop the install terms step and rely on /accept-tos (OHE-3466) (#649)

The first-install wizard showed twelve paragraphs of placeholder terms
labelled "Placeholder draft" and kept acceptance only in localStorage.
It was also a second acceptance. Both login callbacks send a user who
has not accepted the terms to /accept-tos, which records them with
POST /api/accept_tos. Until then the auth middleware rejects every API
call except that one, including the /api/authenticate check the
install layout has run since #648. So the wizard cannot load before
the real terms are accepted, and its own terms step could only ask
again.

- Remove the terms step: its route, its place in the NUX state and the
  step bar, its intermediate-page entry, the mock harness jump and the
  3 i18n keys only it used. Welcome now continues to company, and the
  step bar has five steps.
- Update the UI catalog entries and their zh-CN/zh-TW copy that listed
  the terms step, and the two tests that referenced it.

* feat(super-admin): route the first Super Admin into /install and guard it (OHE-3464) (#650)

A fresh install had no way into the first-install wizard. Sign-in only
knew about the /onboarding survey, and on OHE that page bounces straight
back out because enable_onboarding is off. /install itself only checked
that the flag was on and the visitor was signed in, so anyone could
open it at any time, and its last step never told the server the wizard
was done. #647 stored that state on the server, but nothing used it yet.

- Sign-in: _get_post_auth_redirect sends the first Super Admin to
  /install while the wizard is unfinished. New users reach it through
  /accept-tos on both the Keycloak and the OAuth v2 path. The Keycloak
  callback does the same for a returning first Super Admin, in the
  branch that already checks for onboarding.
- The wizard replaces the onboarding survey for that user (D3 in
  OHE-3461): _should_redirect_to_onboarding returns false for them, so
  /api/onboarding_status no longer sends them to /onboarding either.
- With ENABLE_SUPER_ADMIN off the setup row is never read, and instances
  with no recorded first Super Admin behave as before.
- /install: the loader fetches the setup state and redirects to / unless
  the wizard is pending for the caller. If this browser holds finished
  progress the server doesn't (an earlier install on the same host), it
  clears it so the wizard can run.
- The org step, the wizard's last, records wizard_completed after it
  creates the organization, so the wizard doesn't come back on another
  browser. If that fails, the admin stays on the step with an error.
- The mock setup state starts pending, like a fresh install.
- Tests: the post-auth redirect for a pending, a finished and another
  user and with the flag off, against Postgres; the Keycloak callback
  for a returning first Super Admin; the /install guard; the org step
  recording completion and failing to.

* fix(super-admin): make the Super Admin the owner of the first organization (OHE-3469) (#651)

The wizard's org step created the first organization without an owner.
Since #638, POST /api/organizations adds an owner membership only when
owner_user_id is sent, so the new org had no members. The create hook
then called /switch, which the server refuses for non-members, ignored
the error and selected the org in the browser anyway. The Super Admin
landed on org LLM defaults for an org they weren't in: reads and saves
returned 404 and the org was missing from their switcher. The mock hid
this by making the creator the owner.

The default-org bootstrap (D4 in OHE-3461) only runs from the Keycloak
callback, and that path is going away (OHE-3293), so the fix lives in
the wizard and works whatever the sign-in path.

- Org step: on submit it reads the org list. If the Super Admin already
  belongs to a team org (the default-org bootstrap's, or one an earlier
  attempt created before recording completion failed), it renames that
  org. Otherwise it creates one with owner_user_id set to the Super
  Admin, whose id is their personal workspace's id. It never creates a
  second org.
- It then switches into the org and only then records wizard_completed.
  If the server refuses the switch, the admin stays on the step with
  the error and can retry. One submitting flag covers the whole step.
- useCreateOrganization selects the new org locally only after /switch
  succeeds.
- Mock: POST /api/organizations adds the current user only when
  owner_user_id is theirs, and no longer switches into the new org,
  like the real endpoint.
- Tests: the org step creating an org owned by the Super Admin, renaming
  an org they already belong to, and staying put when the switch is
  refused; the create dialog staying in the current org when the switch
  is refused.

* fix(super-admin): drop the install license-key box and its trial copy (OHE-3468) (#652)

The company step of the first-install wizard had a license-key box
that did nothing. Connect kept the typed key in component state, and
Continue saved only a hasLicenseKey boolean to localStorage that
nothing reads. The key was never validated, sent or stored, yet the
screen promised "a 30-day trial" or "the evaluation trial". Its
Register and Login buttons opened two hard-coded external URLs, one
of them the Replicated customer portal.

The enterprise backend has no license endpoint, and Replicated
installs already require a license: every image is pulled through the
license's proxy registry path. So this removes the box, as D6 in
OHE-3461 recommended, instead of building a check.

- Company step: remove the license-key input and Connect button, both
  trial messages, the Register and Login buttons, and the two URL
  constants. Saving the company name and logo is unchanged.
- NUX state: remove hasLicenseKey from the company entry, its setter
  and the mock harness presets.
- i18n: remove the 7 keys only the box used, and reword
  SA_NUX$COMPANY_BODY and SA_NUX$STEP_COMPANY_DETAIL, which still
  mentioned licensing.
- Update the UI catalog's company entry and its zh-CN/zh-TW copy, and
  the one NUX test that passed hasLicenseKey.

* feat(super-admin): save the starter modal's LLM to the org profile (OHE-3470) (#653)

The starter modal on org LLM defaults let the Super Admin pick a
provider, models and an API key, but the lists were hard-coded and
"Get started" only cleared the local starterModalPending flag. Nothing
was saved, so the organization kept its previous LLM.

The modal now uses the same model catalogue and the same three calls as
the org LLM form. Saving a profile with an explicit llm and activating
it would only change the caller's member settings, so the org defaults
are saved first, as the form does.

- Starter fields: providers and models come from the config search API,
  with hidden aliases left out and verified models first. The model menu
  keeps its look but picks one model: each row is a radio and the All
  action is gone, since a provider can list more models than an org can
  hold profiles. The list scrolls past a fixed height.
- The API key field follows the form's rule: hidden for OpenHands
  models and when allow_user_llm_configuration is off. Changing the
  provider clears the model and the key.
- Get started saves the org settings with the model, a null base_url
  and the typed key, saves a profile that copies them, activates it,
  marks the guide's add-llm step and closes. It stays disabled until a
  model is chosen and the org is known. A failure shows the server's
  message in the modal and keeps it open. Skip still saves nothing.
- Catalog: the starter card no longer says models are checkboxes with
  All.
- Tests: the list comes from the server, Get started waits for a model,
  saving runs the three calls and closes, a failed save stays open with
  the error, Skip saves nothing, and no key is asked for when user LLM
  configuration is off.

* feat(super-admin): derive setup-guide progress from server data (OHE-3472) (#654)

The Super Admin setup guide kept its progress and visibility in one
localStorage key, so it was per browser and not tied to an
organization. Only "create organization" and "add an LLM" were ticked
by real actions, and the LLM tick fired for any organization. The other
steps were checkboxes the admin ticked by hand. The floating widget
also waited on this browser's own wizard key, so it never showed on
another browser. #647 stored the guide's organization and dismissal on
the server, but nothing set the organization and the guide still read
only localStorage.

- setup-state: GET and PATCH return guide_steps for the first Super
  Admin while the guide has an organization and is not dismissed. Each
  step is read from what that organization really has:
  - org_llm: a saved LLM profile other than the Default one every org
    is seeded with.
  - mcp_server: the first Super Admin has an MCP server in the org. MCP
    servers belong to each member.
  - invite: a second member, or a pending invitation that has not
    expired.
  - automation: the automation service lists one for the org.
    Automations live in that service's own database, so the caller's
    cookie or Authorization header is forwarded with X-Org-Id. If the
    service is not configured or the call fails, the step stays undone.
- The wizard's org step saves guide_org_id with wizard_completed, so the
  guide belongs to the organization the Super Admin owns.
- The guide page, its sidebar card and the floating widget read that
  state instead of localStorage. The widget no longer waits on the
  local oh-sa-nux key, and it re-reads progress on navigation and after
  an LLM save. The manual checkboxes are gone; each row shows a status
  circle with the same look.
- Remove setup guide and the Instance page switch save guide_dismissed
  on the server. The switch is disabled for Super Admins without a
  guide, since only the first Super Admin can change it.
- "Add an integration" now opens /settings/mcp and is checked by the
  MCP signal, matching the ticket's "connect MCP integrations" step.
  Its tour stop and hint follow. Optional SAML stays a link and does
  not count toward progress.
- Remove the oh-super-admin-setup store and the unused mark
  complete/incomplete strings. The tour still advances on the step
  event. Update the mock, the QA panel and the catalog copy.
- Tests: route tests against Postgres for each step, an expired
  invitation, the headers sent to the automation service and a failing
  service; frontend tests for the derived progress, SAML not counting,
  no guide for other users or after dismissal, removing and toggling
  the guide on the server, and the widget re-reading progress on the
  next page.

* fix(super-admin): align the setup guide's steps with the ticket (OHE-3473) (#655)

OHE-3384 asks the setup guide for four steps: configure the org LLM,
choose an automation template, connect MCP integrations and invite
users. The guide had six. "Create an organization" was always checked,
because the guide only exists once the install wizard has given it an
organization (OHE-3469). "Create first automation" opened the
automations list instead of the templates. Its tour stop went to "/",
which hard-redirects into Agent Canvas, so the tour ended there on an
anchor no page renders.

- The steps are now: add an LLM, choose an automation template, add an
  MCP integration, invite users, then the optional SAML link. Progress
  counts four steps.
- The automation step is "Choose an automation template". It opens
  /automations/templates, which lands on the Agent Canvas templates
  page. The link goes through the automations redirect rather than
  /canvas/..., because the cross-app redirect shows an error on a
  second in-app visit to the same /canvas URL.
- The tour drops the create-org stops and the cross-app automation
  stop. Starting the guide on a step that has no tour stop opens that
  step's page instead of restarting the tour at the LLM step.
- The create-organization modal no longer signals a guide step.
- Remove the organization step's strings. Update the setup subtitle
  and the UI catalog copy.

* fix(super-admin): make Delete user remove the account and its data (OHE-3477) (#656)

The dashboard's Delete user only removed the user from their team
organizations. The user row, the personal workspace, API keys, git and
Keycloak tokens, the LiteLLM user and the Keycloak account all stayed,
so the person could sign in again and every API key kept working. The
user row could not simply be deleted either: conversation, quota,
budget, Git claim and invitation rows hold foreign keys to it, and a
leftover legacy user_settings row re-creates the user on the next
lookup.

- Add UserStore.delete_user. In one transaction it deletes the user's
  conversations in every organization, API keys, git and Keycloak
  tokens, device codes, personal secrets, quota and budget rows,
  legacy settings and memberships, then the user row. Git claims and
  invitations the user made in a team organization pass to another
  owner of that organization, and the setup-user pointer is cleared.
- DELETE /api/admin/users/{id} now deletes the user. It still refuses
  self-deletion and the last owner of a team organization, and now
  refuses the last Super Admin through revoke_super_admin's locked
  check. Once the account is gone it removes the personal workspace,
  the LiteLLM user and the Keycloak account best effort, logging any
  failure.
- Manage User: the hint, confirmation and toasts describe a permanent
  delete, a successful delete also refreshes the Admins list, and the
  mock API drops the user.
- Replace the route tests for the old behaviour. Add route tests for
  the refusals and the cleanup order, Postgres tests for the cleanup
  steps, and a hook test for the Admins refresh.

* fix(super-admin): make Suspend account block sign-in and API keys (OHE-3478) (#657)

The dashboard's Suspend account only marked each of the user's
memberships inactive. The user could still sign in and use their API
keys, any new active membership un-suspended them, a user with no
memberships could not be suspended, and suspending a Super Admin did
nothing because Super Admins skip the membership check.

- Add user.is_disabled (migration 178). Migration 162 dropped the
  column of the same name when #181 was reverted.
- PATCH /api/admin/users/{id} now sets the flag instead of every
  membership status. It still refuses suspending yourself, and now
  refuses the last enabled Super Admin with a 409, checked under a
  FOR UPDATE lock. The directory reads the user's status from the flag.
- revoke_super_admin, which delete also uses, now requires another
  enabled Super Admin, so the instance cannot be left with only
  disabled ones.
- SaasUserAuth.get_instance rejects a disabled user, so API keys, the
  legacy cookie and the OAuth v2 cookie all get a 401 and the cookies
  are cleared.
- Sign-in refuses a disabled user with 401 account_disabled: the
  Keycloak path in DefaultUserAuthorizer, like blocked domains, and the
  OAuth v2 login callback before tokens are stored. Without this,
  auto-login would send them back to the identity provider in a loop.
- Manage User: a user suspended in every organization no longer shows
  as an inactive account, the account hint describes the new effect,
  and the mock API matches the server.
- Update the route tests for the old behaviour. Add Postgres tests for
  the flag and the Super Admin guards, and tests for get_instance, both
  sign-in paths and the Users page.

* fix(super-admin): explain a suspension to the affected user (OHE-3479) (#659)

A Super Admin can suspend an organization, a user's membership in one,
or the whole account, and the server enforces all three, but the
affected user was never told why. A refused sign-in showed the raw
callback JSON {"detail":"account_disabled"}. Requests in a suspended
organization failed with a 403 the frontend ignored, so /settings sat
on a loading skeleton and other calls showed raw toasts.

- Sign-in: both callbacks send a disabled user to
  /login?account_disabled=true instead of a 401 JSON, the way
  recaptcha_blocked already works, and the login page explains it. No
  tokens are stored and no cookie is set, as before.
- Suspended organization or membership: the response interceptor
  records a 403 "Organization is suspended" or "User membership is
  suspended" against the selected organization. A failed switch is
  left alone and stays a toast. The root layout then shows only a
  blocking modal that says what is suspended and who to contact, and
  lists the user's other organizations. Switching lifts it.
- Add the five strings in all 15 languages.
- Update the two callback tests for the redirect. Add tests for the
  login message, the block and the switch, the membership message, and
  the 403s the interceptor must ignore.

* feat(super-admin): invite a person into any organization from the dashboard (OHE-3481) (#661)

The PRD lets a Super Admin add someone to any organization by
invitation. The dashboard could only add people who already had an
account: "Add to org" in Manage user needs an existing user, and
"Provision User" is hidden unless USER_PROVISIONING_ENABLED is set. The
invitation API already lets a Super Admin who is not a member invite
into any organization, including as owner, and returns a link to copy.
Nothing on the dashboard called it.

- Reuse the Add Members modal. When the dashboard passes it a list of
  organizations, it shows an organization picker and offers the owner
  role. Settings > Members is unchanged.
- useInviteMembersBatch and usePendingInvitations take an optional org
  id and fall back to the selected org, as before.
- The Users page gets an "Invite by email" button. Each team
  organization's row menu on the Organizations page gets an "Invite by
  email" item with that organization preselected. Personal workspaces
  are not offered.
- With email delivery off, the modal shows each invite link to copy,
  as it already did in settings.
- Add the "Invite by email" string, mention inviting in both Users page
  subtitles, and add the dialog to the UI catalog.
- Add tests for the organization picker, the owner role, both entry
  points, the links shown when email delivery is off, and personal
  workspaces.

* test(super-admin): cover the untested admin actions, API client and usage hook (OHE-3489) (#663)

OHE-3489 asks for a test behind every Super Admin screen and admin
action. Its list of gaps predates the sub-PRs that dropped the account,
terms and license steps and added tests for most screens. What was
still untested: the add, set_role and resume membership actions, org
resume and account re-enable, two personal-workspace cases, the
structured feature-flag variable, the Admins page grant flow, Resume on
the Organizations page, the usage hook and the API client. Every
frontend test mocked the client, so a wrong URL, method or body could
not fail any of them.

Backend:
- add: creates a missing membership at the chosen role with the
  LiteLLM key, and reactivates a suspended one instead of adding a
  second row.
- set_role: changes the role on an existing membership and refuses to
  demote the last owner.
- resume: the existing suspend tests for memberships, organizations
  and accounts now also cover resume and re-enable.
- Deleting a user is not blocked by owning their personal workspace.
- The personal-workspace check runs against the database for a
  personal workspace and for a team organization.
- OH_WEB_CLIENT_FEATURE_FLAGS_ENABLE_SUPER_ADMIN turns the web-client
  flag on.

Frontend:
- superAdminService: each of the 15 calls sends the method, path, body
  and headers of its backend route, and the list calls unwrap their
  response envelopes.
- Admins: granting Super Admin by email closes the dialog and lists
  the new admin.
- Organizations: Resume runs without a confirmation dialog.
- useUpdateSuperAdminUserGroups and useUpdateSuperAdminUserStatus call
  the client and refresh the user list. useProvisionUserToGroups
  provisions each organization in order and leaves the password out
  when none is given.
- useSuperAdminUsage sums usage across team organizations only,
  fetches only the selected organizations, and requests every
  conversation for the year-to-date window.

* chore(super-admin): remove the mock and QA tooling and stale stub copy (OHE-3488) (#664)

The prototype's review tooling was still in the app. The UI catalog and
the setup test harness did nothing without VITE_MOCK_API, but their
routes, a persona override inside the Super Admin access checks, and an
ungated ?catalogPreview=1 bypass of the install step order all reached
production builds. The mock API also disagreed with the backend on
create-organization and provisioning, which is how OHE-3469 and OHE-3480
stayed hidden.

- Remove the /ui-catalog pages, the setup test harness panel and its
  persona override, the catalogPreview and forceOpen branches, the
  unused root-to-settings route and the sample usage data. The catalog's
  reviewer notes move to .pr/ui-catalog-review-notes.md.
- Move the Super Admin row types from super-admin-mock.ts to
  super-admin-types.ts.
- Start the mock worker in development only again, as on main.
- Drop "This UI is not wired to the API yet." from the grant dialog and
  delete the unused "stub data" hint.
- Mock create-organization like the backend: request validation, the
  owner lookup, the exact 409 message, and only the owner becomes a
  member. /me, switch and the organization list now respect membership.
- Mock provisioning like the backend: 405 when it is off, the target-org
  and personal-workspace checks, the requested password, and no
  re-enabling of suspended accounts.
- Delete the two tests whose subject is gone, and move the sample user
  rows into the one test that uses them.

* fix(super-admin): renumber the org status migration to 179 (OHE-3491) (#667)

Merging main into this branch brought in #599's
175_add_sandbox_lifecycle_columns.py. It declares revision 175 on top
of 174, the same as this branch's 175_add_org_status.py. Alembic keeps
only one file per id and then reports two heads (175 and 178), so
alembic upgrade head fails. The migration check fails on the duplicate
revision, and every backend test run stops while building the template
database.

- Rename 175_add_org_status.py to 179_add_org_status.py and chain it
  after 178. The chain is now 174 -> 175 (main's sandbox lifecycle
  columns) -> 176 -> 177 -> 178 -> 179.
- Move only this migration. 176-178 don't use org.status, and main's
  175 can't change because deployed databases have already applied it.
- Update the docstring's Revision ID and Revises to match.

* fix(super-admin): wait for sign-in before showing the setup guide (OHE-3497) (#668)

With ENABLE_SUPER_ADMIN on, a first-time user who accepted the Terms of
Service landed back on /login and could never finish signing up. The
setup guide widget is mounted around every root-layout page, including
/accept-tos, and its query reads GET /api/admin/setup-state whenever the
flag is on. On /accept-tos the session cookie still says
accepted_tos=false, so the auth middleware refuses the call with
TosNotAcceptedError. That is an AuthError, so the middleware also ends
the Keycloak session and deletes the keycloak_auth cookie. The
POST /api/accept_tos that follows has no cookie and gets a 401, the page
falls back to /, and the user is sent to /login. Acceptance is never
saved, so every retry loops.

- Mount the widget only when the user is signed in and not on an
  intermediate page (/accept-tos, /information-request, /install). The
  layout already skips the auth check on those pages for the same
  reason.
- Add root-layout tests: /accept-tos makes no setup-state call, and a
  signed-in page still loads the guide. The config is seeded into the
  query cache as PostHogWrapper does in the app, and the file uses the
  real intermediate-page hook instead of the global mock.

* fix(super-admin): open the automation templates after the starter modal saves the LLM (OHE-3499) (#669)

After the first Super Admin saved an LLM in the starter modal on
/settings/org-defaults, the modal closed and left them on that page. The
setup guide's next step, choosing an automation template, then needed
another click in the guide. saveLlm marked the LLM step done and cleared
the modal, but never navigated.

- After a successful save, navigate to the automation step's destination,
  read from SUPER_ADMIN_SETUP_STEPS (/automations/templates). The
  /automations/* route hands off to /canvas/automations/templates.
- Skip and a failed save stay on the page, as before.
- Render the modal tests through a router stub, and check that saving
  opens the templates page while skipping or failing does not.

* fix(super-admin): refresh the setup guide after adding an MCP server or inviting someone (OHE-3500) (#670)

After adding an MCP server, "Add an integration" stayed unchecked in the
setup guide until the page was reloaded, and "Invite users" did the same
after an invitation. The server already counts both at once. The guide
re-reads its progress only when the route changes or when
SUPER_ADMIN_SETUP_STEP_EVENT fires, and the query is cached for five
minutes. Both actions stay on the same page, and only the LLM saves fired
the event.

- Fire notifySuperAdminSetupStep("add-integration") when adding an MCP
  server succeeds on /settings/mcp.
- Fire notifySuperAdminSetupStep("invite-users") when an invitation
  succeeds. The invite modal is shared by Members settings and the Super
  Admin dashboard.
- Notify from the callers, as the LLM paths do, so the mutation hooks
  stay free of guide code.
- Test both events, and that the floating guide re-reads its progress on
  the event without a route change.

* fix(super-admin): show personal workspaces as Personal Workspace in the organizations table (OHE-3501) (#671)

The Super Admin Organizations table showed a personal workspace by its
stored name, user_<id>_org. Personal workspaces are created with that
name, and the admin API already marks them with is_personal. The rest of
the app shows ORG$PERSONAL_WORKSPACE when it is set (the org selector,
the suspended-workspace modal and the API key pages), but the table
copied org.name as is.

- Use ORG$PERSONAL_WORKSPACE for rows with is_personal. Team
  organizations keep their names, and the stored name does not change.
- The search and the confirmation text use the same label. The contact
  email column still tells personal workspaces apart.
- Add a test, and update the personal-workspace test that looked for
  user_7_org.

* fix(super-admin): show personal workspaces as Personal Workspace in the users table (OHE-3502) (#672)

The Super Admin Users table listed a user's personal workspace by its
stored name, user_<id>_org, in the Organizations column. OHE-3501 fixed
the Organizations table, but the users mapping copied each membership's
org_name as is. Membership rows carry no is_personal flag; a personal
workspace shares its owner's id, which is the rule the server and the
other Super Admin views already use.

- Use ORG$PERSONAL_WORKSPACE for a membership whose org_id equals the
  user's id. Team organizations keep their names, and the stored name and
  the API do not change.
- The users search and the open-organization prompt use the same label.
- Add a test, and update the personal-workspace test that looked for
  user_7_org.

* fix(super-admin): open Agent Canvas's MCP page from the setup guide's integration step (OHE-3516) (#685)

The Agent Canvas setup guide's "Add an integration" step now opens Canvas's
own MCP page (OpenHands/OpenHands#18066). The enterprise guide still sent
the admin to /settings/mcp, so the two guides opened different pages for
the same step. Canvas's MCP page saves to the same member settings the
mcp_server signal checks.

The guide opens steps with React Router's navigate. A /canvas/... URL
opened that way goes through routes/cross-app-redirect.tsx, which shows an
error page when the same URL is opened twice in a session. That is why
the automation step points at /automations/....

- Point "Add an integration" at /canvas/mcp.
- Open setup steps with navigateOrHardRedirect from Start, the floating
  guide and the setup page. A /canvas/... step gets a page load, and the
  other steps navigate as before.
- Remove the step's tour stop and its unused nav selector. The tour cannot
  follow into Canvas, the same as for the automation template step.
- Test that Start, the setup page row and the floating guide row open
  /canvas/mcp with a page load.

* feat(super-admin): open the next setup guide step when one is done (OHE-3525) (#702)

Finishing a setup step ticked its checkbox but left the Super Admin where
they were: the next step and its tour opened only from a click. The
completion event only made the floating guide re-read its progress, and an
open LLM tour carried on through its own stops to the invite tip, skipping
the two steps that live in Agent Canvas.

- When the guide's next step is reported done and the server confirms it,
  the floating guide opens the step after it the way Start does: its tour
  here, or its page in Agent Canvas. A step finished out of order or again,
  and the last required step, open nothing.
- Start and the hand-off show one step's tour, so the LLM tour ends when
  the LLM is saved.
- The tour engine ignores delayed callbacks from a tour that was stopped or
  replaced. driver.js keeps its state at module level, so they would have
  torn down the current tour.
- Links into Agent Canvas name the step in setup_tour, and a page opened
  with setup_tour starts that step's tour here.
- The starter modal leaves the next step to the guide.

* fix(super-admin): explain why provisioning a user failed (OHE-3529)

Provisioning a user with a password shorter than 8 characters showed a
toast reading "Request failed with status code 422". The server rejected
the password with a FastAPI validation error, which lists the failing
fields under `detail`. retrieveAxiosErrorMessage only read a string
`detail` or a `detail.message`, so it fell back to the Axios message.

- The Provision User modal checks the password length before sending. A
  password that is set but shorter than 8 characters shows "Password must
  be at least 8 characters long" under the field, the same message as
  user settings, and nothing is sent. Editing the field clears it.
- For any other FastAPI validation error, the toast names the first
  failing field and the server's reason, for example "Password: String
  should have at least 8 characters".

* fix: keep only the toast change; OHE-3540 removes the Provision modal (OHE-3529)

OHE-3540 (#718) removes the Provision User modal from the Super Admin
Users page, and with it the place this PR checked the password length.
Keeping that check here would conflict with #718 in super-admin-pages.tsx.

- Drops the modal's password-length check and its test.
- Keeps the app-wide change: retrieveAxiosErrorMessage shows a FastAPI
  validation error's field and reason instead of "Request failed with
  status code 422".

* chore: Remove PR-only artifacts [automated]

---------

Co-authored-by: FraterCCCLXIII <panentheum@gmail.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: allhands-bot <allhands-bot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

released: 1.69.0 Shipped in 1.69.0 type: feat A new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants