Skip to content

fix: admin_create_organization writes full auth flags - #5819

Open
Christian-Sidak wants to merge 1 commit into
Agenta-AI:mainfrom
Christian-Sidak:fix/issue-5791
Open

fix: admin_create_organization writes full auth flags#5819
Christian-Sidak wants to merge 1 commit into
Agenta-AI:mainfrom
Christian-Sidak:fix/issue-5791

Conversation

@Christian-Sidak

@Christian-Sidak Christian-Sidak commented Aug 9, 2026

Copy link
Copy Markdown

Summary

  • admin_create_organization() in api/oss/src/services/db_manager.py wrote flags={"is_demo": False} -- omitting allow_email, allow_social, and all other flag keys.
  • The frontend's filterOrgsByAuthMethod requires allow_email to be present and truthy before it will offer the email login path. An org with only is_demo set matches zero auth methods, leaving the user with no_compatible_orgs.
  • Fix: mirror the same flags dict that create_organization() writes (including allow_email: env.auth.email_enabled, allow_social: env.auth.oidc_enabled, and the remaining boolean flags).

Fixes #5791

Demo

Before the fix, admin_create_organization produced:

flags = {"is_demo": False}

After the fix, it produces the full set of auth flags (matching create_organization):

flags = {
    "is_demo": False,
    "allow_email": True,   # email auth enabled
    "allow_social": False,
    "allow_sso": False,
    "allow_root": False,
    "domains_only": False,
    "auto_join": False,
}

test-output

The two new unit tests confirm this:

PASSED api/oss/tests/pytest/unit/services/test_db_manager.py::test_admin_create_organization_includes_allow_email_flag
PASSED api/oss/tests/pytest/unit/services/test_db_manager.py::test_admin_create_organization_flags_mirror_create_organization

Test plan

  • Added test_admin_create_organization_includes_allow_email_flag -- asserts allow_email is present and True when email auth is enabled.
  • Added test_admin_create_organization_flags_mirror_create_organization -- asserts the flags dict contains exactly the same keys as the normal signup path (create_organization).
  • Both tests pass locally with the fix applied; both would have failed against the old code.
  • ruff format and ruff check pass on all touched files.

The admin mint endpoint wrote only {is_demo: False} as the org flags,
omitting allow_email/allow_social and all other keys. The frontend's
filterOrgsByAuthMethod requires allow_email to offer the email login
path, so admin-minted accounts could not log in via the web UI
(no_compatible_orgs). Mirror the same flags dict that create_organization
uses, reading allow_email/allow_social from env.auth just like the
normal signup path.

Fixes Agenta-AI#5791

Signed-off-by: Christian Sidak <christian@sentineltech.eu>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Christian-Sidak <61099993+Christian-Sidak@users.noreply.github.com>
@dosubot dosubot Bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Aug 9, 2026
@vercel

vercel Bot commented Aug 9, 2026

Copy link
Copy Markdown

@Christian-Sidak is attempting to deploy a commit to the agenta projects Team on Vercel.

A member of the Team first needs to authorize it.

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@dosubot dosubot Bot added python Pull requests that update Python code tests labels Aug 9, 2026
@github-actions

github-actions Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

✅ Thanks @Christian-Sidak! This PR now meets the contribution requirements and has been reopened. A maintainer will review it soon.

@coderabbitai

coderabbitai Bot commented Aug 9, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: d25279f6-a4f6-4859-9d55-73f804634caa

📥 Commits

Reviewing files that changed from the base of the PR and between e73fb2e and bb55892.

📒 Files selected for processing (2)
  • api/oss/src/services/db_manager.py
  • api/oss/tests/pytest/unit/services/test_db_manager.py

Disabled knowledge base sources:

  • Linear integration is disabled

You can enable these sources in your CodeRabbit configuration.


📝 Walkthrough

Summary by CodeRabbit

  • New Features

    • Newly created organizations now include authentication settings and the standard set of default feature flags.
    • Email authentication is enabled by default when configured.
  • Bug Fixes

    • Corrected organization creation so required default flags are initialized consistently.

Walkthrough

admin_create_organization now sets authentication, SSO, access, domain, and auto-join flags. Unit tests add persistence and authentication stubs, then verify email authentication behavior and the complete default flag set.

Changes

Admin organization flags

Layer / File(s) Summary
Initialize and validate organization flags
api/oss/src/services/db_manager.py, api/oss/tests/pytest/unit/services/test_db_manager.py
admin_create_organization now includes email, OIDC, SSO, root access, domain-only, and auto-join defaults. Tests capture the created organization, control authentication settings, and verify the resulting flags.

Estimated code review effort: 2 (Simple) | ~10 minutes

✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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

Labels

python Pull requests that update Python code size:S This PR changes 10-29 lines, ignoring generated files. tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

(bug) Accounts minted via the admin endpoint cannot log into the web UI (no_compatible_orgs)

2 participants