Skip to content

fix(idp): land sign-up link invitees in their org and hide personal workspaces on Compose (OHE-3902) - #1181

Merged
hieptl merged 1 commit into
mainfrom
hiep/ohe-3902-invites-invited-users-land-in-a-personal-workspace-instead
Nov 5, 2026
Merged

hieptl merged 1 commit into
mainfrom
hiep/ohe-3902-invites-invited-users-land-in-a-personal-workspace-instead

Conversation

@hieptl

@hieptl hieptl commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

HUMAN:

  • A human has tested these changes.

AGENT:


Why

On a Docker Compose install, a super admin invites people with an org-scoped sign-up link (POST /api/idp/signup-links): with the integrated IDP on, the Org Members page offers super admins only "Create Sign-up Link". POST /oauth/idp/invite created the account and added the membership, but left current_org_id on the personal workspace. Agent Canvas picks the backend's current org on first load, so the invitee landed in "Personal Workspace" instead of the org they were invited to. Only invitation-minted links (#1082, OHE-3825) moved the user. The OHE 2.0 testing feedback also asked for personal workspaces to be hidden on Compose installs, and docker-compose.yml did not set the existing HIDE_PERSONAL_WORKSPACES flags.

Summary

  • _ensure_org_membership now returns whether it added the membership, and idp_invite_accept moves a newly added member off their personal workspace into the link's org and refreshes the user before completing the login, the same rule as _accept_invitation_for_new_user. A user who already sits in a team org, or who was already a member, stays where they are.
  • docker-compose.yml sets HIDE_PERSONAL_WORKSPACES (backend org listing, which Canvas honours through is_visible) and OH_WEB_CLIENT_FEATURE_FLAGS_HIDE_PERSONAL_WORKSPACES (settings pages; required because the file already sets other structured feature flags).
  • Three tests in tests/unit/server/routes/test_idp.py cover the landing step and the two cases that must not move the user.

Issue Number

OHE-3902

How to Test

uv run pytest tests/unit/server/routes/test_idp.py -q
pre-commit run --config ./dev_config/python/.pre-commit-config.yaml --files server/routes/idp.py tests/unit/server/routes/test_idp.py
docker compose -f docker-compose.yml config --quiet

On the Compose stack:

  1. Sign in as the super admin, open Settings → Org Members for the org, click "Create Sign-up Link" for an email that has no account, and copy the link.
  2. Open the link in a fresh browser and set a password: /canvas opens with that org active, and the org switcher does not list "Personal Workspace".
  3. Settings → Org Members lists the new member with the chosen role.
  4. As a non-super-admin org admin, invite a new email through "Invite members": the invitee still lands in the org (the OHE-3825 path is unchanged).

The unit tests, pre-commit and docker compose config pass. Steps 1–4 have not been run against a live Compose stack yet.

Video/Screenshots

None. Backend and Compose configuration change; the set-password page is unchanged.

Type

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

Notes

  • Users invited before this change who are still parked on a hidden personal workspace are not moved server-side on Compose; that only happens when the default org is enabled. Canvas repairs its selection from the visible org list, and opening Settings from Canvas passes the active org and switches it on the backend.
  • A user whose only workspace is personal still sees it, by design of HIDE_PERSONAL_WORKSPACES.
  • Existing Compose installs pick up the two flags on their next docker compose up with the updated file.

Enterprise server image for this PR:

ghcr.io/openhands/enterprise-server:sha-3ac68cb

…orkspaces on Compose (OHE-3902)

On a Docker Compose install a super admin invites people through an
org-scoped sign-up link (POST /api/idp/signup-links). POST /oauth/idp/invite
created the account and added the membership but left current_org_id on
the personal workspace, so Agent Canvas opened there instead of in the
org. Only invitation-minted links (OHE-3825) moved the user.

- _ensure_org_membership reports whether it added the membership, and the
  accept route moves a newly added member off their personal workspace
  into the link's org before completing the login, the same rule as
  _accept_invitation_for_new_user. A user who already sits in a team org,
  or who was already a member, stays where they are.
- docker-compose.yml sets HIDE_PERSONAL_WORKSPACES and
  OH_WEB_CLIENT_FEATURE_FLAGS_HIDE_PERSONAL_WORKSPACES so personal
  workspaces are hidden once a user belongs to an organization.
- Tests cover the landing step and the two cases that must not move the
  user.
@github-actions github-actions Bot added the type: fix A bug fix label Nov 4, 2026
@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  server/routes
  idp.py 961, 1043-1052, 1097, 1114-1132, 1153-1159
Project Total  

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

@tofarr tofarr 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.

🍰

@hieptl
hieptl merged commit 9176ecc into main Nov 5, 2026
22 checks passed
@hieptl
hieptl deleted the hiep/ohe-3902-invites-invited-users-land-in-a-personal-workspace-instead branch November 5, 2026 14:44
@openhands-release-bot openhands-release-bot Bot added the released: 1.87.0 Shipped in 1.87.0 label Nov 5, 2026
@openhands-release-bot

Copy link
Copy Markdown
Contributor

🚀 Released in 1.87.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

released: 1.87.0 Shipped in 1.87.0 type: fix A bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants