Skip to Content

← All archived runs

Run: fix-onboarding-skip

run.md

Run: fix-onboarding-skip

  • lane: bug
  • branch: claude/pipeline-tenant-signup-onboarding-h62fei
  • pr: #791

lane/output/notes.md

Bug: fix-onboarding-skip

  • observed: a fresh tenant's admin is redirected to /onboarding, the concierge's first turn fails with a red "Message failed — Free tier users do not have access to this model. Upgrade to paid credits at https://vercel.com/d?to=… " alert, and there is no way off the page — every other route redirects back to it · expected: the assistant answers; and if it can't, the operator can still get into the platform.
  • cause: two defects, one environment fault.
    • environment (not fixable in code): the Sustentus Vercel team has no AI Gateway credits, so the gateway resolves the deployment's OIDC identity to the free tier and 403s anthropic/claude-haiku-4.5 (RestrictedModelsError). Confirmed on prod runtime errors, dpl_Gzyvyqrrhd6pDmWtR18Yk45fN6Mk, route /api/onboarding/chat, 2026-08-12 11:25Z.
    • code (1): /onboarding was an unconditional gate — proxy.ts bounced every other route back to it until tenant.onboarding.status === "completed", and the only route to completed ran through the AI. Any concierge outage therefore locked every admin and vendor out of the whole platform, with no escape.
    • code (2): concierge-chat.tsx rendered the raw provider error verbatim, leaking the upstream provider name, our account tier and a Vercel billing top-up link into a tenant's setup screen.
  • fix:
    • models/tenant.ts: new skipped onboarding status — a lifecycle marker whose only consumer is the first-run redirect.
    • lib/first-run-onboarding.ts + proxy.ts: gate reads the status rather than a completed-boolean. completed or skipped releases the redirect; only completed bounces a return visit away from /onboarding, so a skipped tenant can come back and finish setup.
    • app/(app)/onboarding/actions.ts: skipOnboardingAction — status flip only, idempotent, and a no-op once genuinely completed so a stale tab can't demote a launched workspace.
    • components/onboarding/skip-onboarding-button.tsx (new) + onboarding/page.tsx: a small "Skip setup" ghost button top-right of the wizard header, hidden once the blueprint is committed. Navigates hard so the proxy re-resolves the destination.
    • components/onboarding/concierge-chat.tsx: fixed house error copy; the real error goes to the console, never the DOM.
    • turbo.json: AI_GATEWAY_API_KEY added to the environment catalogue with the failure mode written down.
  • permissions: unchanged by design. tenant.onboarding.status has exactly one consumer — the proxy.ts redirect (verified by grep: nothing in route-policies.ts, nav.ts, (app)/layout.tsx or the permission resolver reads it). A skipped tenant keeps every role, permission, route and nav entry a completed one has; it just starts with an empty workspace.
  • changelog: entry added (apps/help/app/changelog/2026-08-12-fix-onboarding-skip/).

Still needed outside this PR

The gateway 403 is an account state, not code. Someone with Vercel access must either top up AI Gateway credits on the Sustentus team, or set AI_GATEWAY_API_KEY on the web project to a key from a funded account. Until then the concierge cannot answer — but the workspace is now reachable without it, and the error no longer advertises our billing status to customers.