Skip to content

feat(enterprise) trial onboarding wizard#4266

Open
St0rmz1 wants to merge 15 commits into
mainfrom
feat/enterprise-trial-onboarding
Open

feat(enterprise) trial onboarding wizard#4266
St0rmz1 wants to merge 15 commits into
mainfrom
feat/enterprise-trial-onboarding

Conversation

@St0rmz1

@St0rmz1 St0rmz1 commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Summary

Replaces the organization welcome page with a guided setup wizard for new Enterprise trial organizations. The wizard guides owners and billing managers through GitHub connection, Code Reviewer enablement, and team invitations, then presents credit-aware next actions and the settings applied during organization creation.

The change also centralizes Code Reviewer defaults and integration health checks so onboarding, integration status, and Code Reviewer settings use the same persisted state.

Verification

  • Created a local Enterprise trial organization and entered the setup wizard.
  • Verified the GitHub setup flow, including the development-only installation import.
  • Verified Code Reviewer enablement and team invitation progression.
  • Verified the completion screen for an organization with no usage credits.
  • The final GitHub-only scope correction has not been manually rerun end to end.

Visual Changes

Screenshots are not included.

Reviewer Notes

  • Guided source control and Code Reviewer setup currently supports GitHub only.
  • Users who select the GitLab path skip the GitHub-specific steps, continue to team invitation, and can configure GitLab from the standard integration settings after onboarding.
  • New Enterprise organizations enable weekly recommendations at creation time. Existing organizations are not changed.
  • The completion screen offers client installation, a $10 credit purchase, organization BYOK configuration, organization access, and sales contact based on available credits and permissions.
  • The GitHub installation import shown during onboarding is restricted to local development.

@kilo-code-bot

kilo-code-bot Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (232 files)
  • .env.local.example
  • .specs/organization-sso.md
  • apps/mobile/src/app/(app)/agent-chat/new.tsx
  • apps/mobile/src/lib/agent-github-integration.test.ts
  • apps/mobile/src/lib/agent-github-integration.ts
  • apps/storybook/src/mockData/organizations.ts
  • apps/storybook/stories/OrganizationSwitcher.stories.tsx
  • apps/storybook/stories/Sidebar.stories.tsx
  • apps/storybook/stories/Table.stories.tsx
  • apps/storybook/stories/Textarea.stories.tsx
  • apps/storybook/stories/design-system/Stickersheet.stories.tsx
  • apps/web/.env.development.local.example
  • apps/web/.env.test
  • apps/web/src/app/(app)/components/OrganizationAppSidebar.tsx
  • apps/web/src/app/(app)/components/OrganizationSwitcher.tsx
  • apps/web/src/app/(app)/components/PersonalAppSidebar.tsx
  • apps/web/src/app/(app)/components/SidebarUserFooter.tsx
  • apps/web/src/app/(app)/credits/page.tsx
  • apps/web/src/app/(app)/gastown/onboarding/OnboardingStepRepo.tsx
  • apps/web/src/app/(app)/layout.tsx
  • apps/web/src/app/(app)/organizations/[id]/distribute-funds/DistributeFundsPage.tsx
  • apps/web/src/app/(app)/organizations/[id]/distribute-funds/page.tsx
  • apps/web/src/app/(app)/organizations/[id]/distribute-funds/parseDollarInput.test.ts
  • apps/web/src/app/(app)/organizations/[id]/distribute-funds/parseDollarInput.ts
  • apps/web/src/app/(app)/organizations/[id]/integrations/components/PlatformCard.tsx
  • apps/web/src/app/api/integrations/bitbucket/callback/route.test.ts
  • apps/web/src/app/api/integrations/bitbucket/connect/route.test.ts
  • apps/web/src/app/api/organizations/hooks.ts
  • apps/web/src/app/api/public/inference-provider-usage/route.ts
  • apps/web/src/app/api/public/leaderboard-model-provider-usage/route.ts
  • apps/web/src/app/collab/_components/setup-status.ts
  • apps/web/src/app/config.json/extras.ts
  • apps/web/src/app/config.json/route.ts
  • apps/web/src/app/globals.css
  • apps/web/src/app/payments/topup/success/page.test.ts
  • apps/web/src/app/payments/topup/success/page.tsx
  • apps/web/src/components/auth/BitbucketLogo.tsx
  • apps/web/src/components/cloud-agent-next/CloudAgentProvider.tsx
  • apps/web/src/components/cloud-agent-next/NewSessionPanel.tsx
  • apps/web/src/components/cloud-agent-next/model-preferences.test.ts
  • apps/web/src/components/cloud-agent-next/model-preferences.ts
  • apps/web/src/components/cloud-agent-next/utils/git-utils.test.ts
  • apps/web/src/components/cloud-agent-next/utils/git-utils.ts
  • apps/web/src/components/cloud-agent/CloudSessionsPage.tsx
  • apps/web/src/components/gastown/CreateRigDialog.tsx
  • apps/web/src/components/integrations/BitbucketConnectSetup.tsx
  • apps/web/src/components/integrations/BitbucketConnectedManagement.tsx
  • apps/web/src/components/integrations/BitbucketIntegrationControls.tsx
  • apps/web/src/components/integrations/BitbucketIntegrationDetails.test.ts
  • apps/web/src/components/integrations/BitbucketIntegrationDetails.tsx
  • apps/web/src/components/integrations/BitbucketRepositoryCacheSection.tsx
  • apps/web/src/components/integrations/IntegrationDetailPage.tsx
  • apps/web/src/components/integrations/IntegrationsHub.tsx
  • apps/web/src/components/organizations/OrganizationChildOrganizationsCard.tsx
  • apps/web/src/components/organizations/OrganizationDashboard.tsx
  • apps/web/src/components/organizations/OrganizationMembersCard.tsx
  • apps/web/src/components/payment/AutoTopUpToggle.tsx
  • apps/web/src/components/shared/MiniMaxCodingPlansBanner.tsx
  • apps/web/src/components/shared/RepositoryCombobox.tsx
  • apps/web/src/components/ui/badge-variants.ts
  • apps/web/src/components/ui/button-variants.ts
  • apps/web/src/components/ui/card.tsx
  • apps/web/src/components/ui/design-primitives.test.ts
  • apps/web/src/components/ui/dialog.tsx
  • apps/web/src/components/ui/hover-card.tsx
  • apps/web/src/components/ui/input.tsx
  • apps/web/src/components/ui/popover.tsx
  • apps/web/src/components/ui/primitive-classnames.ts
  • apps/web/src/components/ui/sheet.tsx
  • apps/web/src/components/ui/sidebar.tsx
  • apps/web/src/components/ui/table.tsx
  • apps/web/src/components/ui/textarea.tsx
  • apps/web/src/components/usage-analytics/FilterGeneratorPopover.tsx
  • apps/web/src/components/usage-analytics/UsageAnalyticsDashboard.tsx
  • apps/web/src/components/usage-analytics/UsageAnalyticsSidebar.tsx
  • apps/web/src/components/usage-analytics/hooks.ts
  • apps/web/src/components/usage-analytics/useUsageDashboardState.ts
  • apps/web/src/hooks/useRefreshRepositories.ts
  • apps/web/src/lib/ai-gateway/handleRequestLogging.ts
  • apps/web/src/lib/ai-gateway/providers/apply-provider-specific-logic.ts
  • apps/web/src/lib/ai-gateway/providers/openrouter/index.ts
  • apps/web/src/lib/ai-gateway/providers/openrouter/sync-providers.ts
  • apps/web/src/lib/ai-gateway/tool-calling.test.ts
  • apps/web/src/lib/ai-gateway/tool-calling.ts
  • apps/web/src/lib/cloud-agent-next/cloud-agent-client.ts
  • apps/web/src/lib/cloud-agent/bitbucket-integration-helpers.ts
  • apps/web/src/lib/cloud-agent/github-integration-helpers.ts
  • apps/web/src/lib/cloud-agent/gitlab-integration-helpers.ts
  • apps/web/src/lib/config.server.ts
  • apps/web/src/lib/integrations/core/constants.ts
  • apps/web/src/lib/integrations/core/types.ts
  • apps/web/src/lib/integrations/github-apps-service.ts
  • apps/web/src/lib/integrations/gitlab-service.ts
  • apps/web/src/lib/integrations/oauth/common.ts
  • apps/web/src/lib/integrations/oauth/paths.test.ts
  • apps/web/src/lib/integrations/oauth/paths.ts
  • apps/web/src/lib/integrations/oauth/platforms/bitbucket-callback.ts
  • apps/web/src/lib/integrations/oauth/platforms/bitbucket-connect.ts
  • apps/web/src/lib/integrations/oauth/routes.ts
  • apps/web/src/lib/integrations/platform-definitions.test.ts
  • apps/web/src/lib/integrations/platform-definitions.ts
  • apps/web/src/lib/integrations/platform-integration-setup-status.ts
  • apps/web/src/lib/integrations/platforms/bitbucket/adapter.test.ts
  • apps/web/src/lib/integrations/platforms/bitbucket/adapter.ts
  • apps/web/src/lib/integrations/platforms/bitbucket/credentials.test.ts
  • apps/web/src/lib/integrations/platforms/bitbucket/credentials.ts
  • apps/web/src/lib/integrations/platforms/bitbucket/metadata.test.ts
  • apps/web/src/lib/integrations/platforms/bitbucket/metadata.ts
  • apps/web/src/lib/integrations/platforms/bitbucket/oauth-integration.ts
  • apps/web/src/lib/integrations/platforms/bitbucket/repository-cache.test.ts
  • apps/web/src/lib/integrations/platforms/bitbucket/repository-cache.ts
  • apps/web/src/lib/integrations/platforms/bitbucket/token-service-client.test.ts
  • apps/web/src/lib/integrations/platforms/bitbucket/token-service-client.ts
  • apps/web/src/lib/integrations/platforms/bitbucket/workspace-access-token-adapter.test.ts
  • apps/web/src/lib/integrations/platforms/bitbucket/workspace-access-token-adapter.ts
  • apps/web/src/lib/integrations/platforms/bitbucket/workspace-access-token-credentials.test.ts
  • apps/web/src/lib/integrations/platforms/bitbucket/workspace-access-token-credentials.ts
  • apps/web/src/lib/integrations/platforms/bitbucket/workspace-access-token-organization-authorization.ts
  • apps/web/src/lib/integrations/platforms/bitbucket/workspace-access-token-repository-cache.test.ts
  • apps/web/src/lib/integrations/platforms/bitbucket/workspace-access-token-repository-cache.ts
  • apps/web/src/lib/integrations/platforms/github/webhook-handlers/installation-repositories-handler.ts
  • apps/web/src/lib/integrations/validate-return-path.test.ts
  • apps/web/src/lib/integrations/validate-return-path.ts
  • apps/web/src/lib/organizations/constants.ts
  • apps/web/src/lib/organizations/organization-types.ts
  • apps/web/src/lib/organizations/organizations.test.ts
  • apps/web/src/lib/organizations/organizations.ts
  • apps/web/src/lib/public-inference-provider.ts
  • apps/web/src/lib/public-snowflake-report.ts
  • apps/web/src/lib/redis-keys.ts
  • apps/web/src/lib/security-agent/router/shared-handlers.ts
  • apps/web/src/lib/slack-bot/github-repository-context.ts
  • apps/web/src/lib/slack-bot/gitlab-repository-context.ts
  • apps/web/src/lib/token.test.ts
  • apps/web/src/lib/tokens.ts
  • apps/web/src/lib/user/index.test.ts
  • apps/web/src/lib/user/index.ts
  • apps/web/src/routers/bitbucket-router.test.ts
  • apps/web/src/routers/bitbucket-router.ts
  • apps/web/src/routers/cloud-agent-next-router.test.ts
  • apps/web/src/routers/cloud-agent-next-router.ts
  • apps/web/src/routers/cloud-agent-next-schemas.test.ts
  • apps/web/src/routers/cloud-agent-next-schemas.ts
  • apps/web/src/routers/github-apps-router.ts
  • apps/web/src/routers/gitlab-router.ts
  • apps/web/src/routers/organizations/organization-admin-router.test.ts
  • apps/web/src/routers/organizations/organization-admin-router.ts
  • apps/web/src/routers/organizations/organization-bitbucket-router.test.ts
  • apps/web/src/routers/organizations/organization-bitbucket-router.ts
  • apps/web/src/routers/organizations/organization-cloud-agent-next-router.test.ts
  • apps/web/src/routers/organizations/organization-cloud-agent-next-router.ts
  • apps/web/src/routers/organizations/organization-funds-router.test.ts
  • apps/web/src/routers/organizations/organization-funds-router.ts
  • apps/web/src/routers/organizations/organization-members-router.test.ts
  • apps/web/src/routers/organizations/organization-members-router.ts
  • apps/web/src/routers/organizations/organization-router.test.ts
  • apps/web/src/routers/organizations/organization-router.ts
  • apps/web/src/routers/organizations/utils.ts
  • apps/web/src/routers/platform-integrations-router.test.ts
  • apps/web/src/routers/platform-integrations-router.ts
  • apps/web/src/routers/root-router.test.ts
  • apps/web/src/routers/usage-analytics-router.test.ts
  • apps/web/src/routers/usage-analytics-router.ts
  • apps/web/src/routers/usage-analytics-schemas.ts
  • apps/web/src/routers/user-router.test.ts
  • apps/web/src/routers/user-router.ts
  • apps/web/src/tests/cli-config-schema.test.ts
  • dev/local/services.test.ts
  • dev/local/services.ts
  • packages/db/src/migrations/0173_lowly_venom.sql
  • packages/db/src/migrations/meta/0173_snapshot.json
  • packages/db/src/migrations/meta/_journal.json
  • packages/db/src/schema-types.ts
  • packages/db/src/schema.test.ts
  • packages/db/src/schema.ts
  • packages/worker-utils/package.json
  • packages/worker-utils/src/bitbucket-workspace-access-token.test.ts
  • packages/worker-utils/src/bitbucket-workspace-access-token.ts
  • packages/worker-utils/src/index.ts
  • packages/worker-utils/src/internal-service-token-audiences.ts
  • packages/worker-utils/src/kilo-token.test.ts
  • packages/worker-utils/src/kilo-token.ts
  • services/cloud-agent-next/src/persistence/CloudAgentSession.ts
  • services/cloud-agent-next/src/persistence/session-metadata.test.ts
  • services/cloud-agent-next/src/persistence/session-metadata.ts
  • services/cloud-agent-next/src/router/handlers/session-management.ts
  • services/cloud-agent-next/src/router/handlers/session-prepare.ts
  • services/cloud-agent-next/src/router/handlers/session-start.ts
  • services/cloud-agent-next/src/router/schemas.test.ts
  • services/cloud-agent-next/src/router/schemas.ts
  • services/cloud-agent-next/src/services/git-token-service-client.test.ts
  • services/cloud-agent-next/src/services/git-token-service-client.ts
  • services/cloud-agent-next/src/session-service.test.ts
  • services/cloud-agent-next/src/session-service.ts
  • services/cloud-agent-next/src/session/session-requests.ts
  • services/cloud-agent-next/src/session/validate-repository-access.test.ts
  • services/cloud-agent-next/src/session/validate-repository-access.ts
  • services/cloud-agent-next/src/shared/wrapper-bootstrap.ts
  • services/cloud-agent-next/src/types.ts
  • services/cloud-agent-next/src/workspace.test.ts
  • services/cloud-agent-next/src/workspace.ts
  • services/cloud-agent-next/test/unit/wrapper/reconnection.test.ts
  • services/cloud-agent-next/wrapper/src/connection.ts
  • services/cloud-agent-next/wrapper/src/session-bootstrap.test.ts
  • services/cloud-agent-next/wrapper/src/session-bootstrap.ts
  • services/git-token-service/.dev.vars.example
  • services/git-token-service/src/bitbucket-api.test.ts
  • services/git-token-service/src/bitbucket-api.ts
  • services/git-token-service/src/bitbucket-authorization-service.test.ts
  • services/git-token-service/src/bitbucket-authorization-service.ts
  • services/git-token-service/src/bitbucket-runtime-token-resolver.test.ts
  • services/git-token-service/src/bitbucket-runtime-token-resolver.ts
  • services/git-token-service/src/bitbucket-url.test.ts
  • services/git-token-service/src/bitbucket-url.ts
  • services/git-token-service/src/bitbucket-workspace-access-token-authorization-service.test.ts
  • services/git-token-service/src/bitbucket-workspace-access-token-authorization-service.ts
  • services/git-token-service/src/github-user-authorization-entrypoint.test.ts
  • services/git-token-service/src/index.test.ts
  • services/git-token-service/src/index.ts
  • services/git-token-service/worker-configuration.d.ts
  • services/git-token-service/wrangler.jsonc
  • services/o11y/src/alerting/evaluate.ts
  • services/o11y/src/alerting/gastown-health-evaluate.ts
  • services/o11y/src/alerting/gastown-health-query.ts
  • services/o11y/src/alerting/gastown-health-state.ts
  • services/o11y/src/alerting/notify.ts
  • services/o11y/test/gastown-health-evaluate.spec.ts
  • services/o11y/test/gastown-health-query.spec.ts
  • services/o11y/test/notify.spec.ts
  • services/o11y/test/queue-backlog-integration.spec.ts
  • services/o11y/wrangler.jsonc
  • services/security-sync/src/sync.ts
Previous Review Summary (commit 4933196)

Current summary above is authoritative. Previous snapshots are kept for context only.

Previous review (commit 4933196)

Status: No Issues Found | Recommendation: Merge

Files Reviewed (37 files)
  • apps/storybook/stories/OrganizationWelcomePage.stories.tsx
  • apps/web/src/app/(app)/components/AppSidebar.tsx
  • apps/web/src/app/(app)/organizations/[id]/code-reviews/ReviewAgentPageClient.tsx
  • apps/web/src/app/(app)/organizations/[id]/code-reviews/page.tsx
  • apps/web/src/app/(app)/organizations/[id]/welcome/layout.tsx
  • apps/web/src/app/(app)/organizations/[id]/welcome/page.tsx
  • apps/web/src/components/integrations/DevAddGitHubInstallationCard.tsx
  • apps/web/src/components/integrations/GitHubIntegrationDetails.tsx
  • apps/web/src/components/integrations/IntegrationDetailPage.tsx
  • apps/web/src/components/organizations/OrganizationContext.tsx
  • apps/web/src/components/organizations/members/InviteMemberDialog.tsx
  • apps/web/src/components/organizations/new/CreateOrganizationPage.tsx
  • apps/web/src/components/organizations/welcome/OrganizationSetupWizard.tsx
  • apps/web/src/components/organizations/welcome/OrganizationWelcomeCards.tsx
  • apps/web/src/components/organizations/welcome/organization-setup-path.test.ts
  • apps/web/src/components/organizations/welcome/organization-setup-path.ts
  • apps/web/src/lib/code-reviews/analytics/settings.ts
  • apps/web/src/lib/code-reviews/core/default-config.test.ts
  • apps/web/src/lib/code-reviews/core/default-config.ts
  • apps/web/src/lib/integrations/core/health.test.ts
  • apps/web/src/lib/integrations/core/health.ts
  • apps/web/src/lib/integrations/db/platform-integrations.ts
  • apps/web/src/lib/integrations/github-apps-service.test.ts
  • apps/web/src/lib/integrations/github-apps-service.ts
  • apps/web/src/lib/organizations/onboarding-checklist.db.test.ts
  • apps/web/src/lib/organizations/onboarding-checklist.test.ts
  • apps/web/src/lib/organizations/onboarding-checklist.ts
  • apps/web/src/lib/organizations/onboarding-steps.ts
  • apps/web/src/lib/organizations/organizations.test.ts
  • apps/web/src/lib/organizations/organizations.ts
  • apps/web/src/routers/github-apps-router.ts
  • apps/web/src/routers/gitlab-router.test.ts
  • apps/web/src/routers/gitlab-router.ts
  • apps/web/src/routers/organizations/organization-code-reviews-router.ts
  • apps/web/src/routers/organizations/organization-onboarding-router.test.ts
  • apps/web/src/routers/organizations/organization-router.ts
  • apps/web/src/routers/organizations/organization-settings-router.test.ts

Reviewed by gpt-5.4-2026-03-05 · Input: 154.9K · Output: 23K · Cached: 1.3M

Review guidance: REVIEW.md from base branch main

@marius-kilocode

Copy link
Copy Markdown
Contributor

High: Degraded GitHub installations lose recovery controls. github-apps-router.ts:107 now defines installed as fully healthy. Suspended or auth-invalid installations render as “Not installed,” hiding Refresh Permissions and Uninstall. Installation presence and health should be separate states.

High: Display and mutation paths can select different installations. github-apps-service.ts:58 prefers the newest healthy row, while refresh and uninstall still use unordered lookups. With multiple GitHub rows, the UI may display one installation but mutate another, then delete all local rows.

export async function getOrganizationOnboardingState(
organizationId: string
): Promise<OrganizationOnboardingState> {
const result = await db.execute(sql`

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.

The SQL is massive. Isn't that really fragile?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

ya. good call. Good reason to revisit the complexity

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants