Skip to content

make onboarding skippable and gate sidekick until setup is complete#30

Merged
ArjunCodess merged 14 commits into
mainfrom
arjuncodess/skippable-onboarding-sidekick-readiness
May 22, 2026
Merged

make onboarding skippable and gate sidekick until setup is complete#30
ArjunCodess merged 14 commits into
mainfrom
arjuncodess/skippable-onboarding-sidekick-readiness

Conversation

@ArjunCodess
Copy link
Copy Markdown
Member

@ArjunCodess ArjunCodess commented May 20, 2026

Greptile Summary

This PR makes both the initial onboarding (Instagram connection) and the Sidekick setup flow skippable, and gates Sidekick features (chat API, DM webhook replies, dashboard UI) behind a new getSidekickSetupStatusByUserId readiness check. It also migrates Inngest from v3 to v4, updating all function definitions to the new triggers array syntax.

  • getSidekickSetupStatusByUserId consolidates five DB queries into a single status check, auto-persists the completion flag, and returns a consistent result-object so callers can distinguish DB errors from genuine "not ready" states.
  • The chat route and Instagram webhook now return 503 on DB failure rather than silently blocking all users, and the dashboard layout renders an amber banner with a step count and resume link when setup is incomplete.
  • The step URL parsing in sidekick-onboarding/page.tsx has a Number(null) === 0 bug that makes the status.resumeStep fallback dead code, landing users at step 0 whenever they navigate to the page without an explicit ?step= param.

Confidence Score: 4/5

Safe to merge with one fix: the step resume logic in the sidekick onboarding page silently drops the resume position for any entry without a ?step= param.

The DB-error handling in the chat route and DM webhook was correctly redesigned to distinguish transient failures from genuine "not ready" states. The one concrete defect is in sidekick-onboarding/page.tsx: Number(null) evaluates to 0, so users who navigate directly to /sidekick-onboarding always land on step 0 rather than their actual resume step — the status.resumeStep fallback introduced in this PR is dead code. The fix is a one-liner and does not affect any other changed surface.

apps/app/src/app/(onboarding)/sidekick-onboarding/page.tsx — the URL step-parsing logic at lines 569-578.

Important Files Changed

Filename Overview
apps/app/src/app/(onboarding)/sidekick-onboarding/page.tsx Adds "Skip for now" button and URL-based step resume; resume logic has a Number(null) === 0 bug that makes status.resumeStep dead code.
packages/core/src/sidekick/personalization.ts Introduces getSidekickSetupStatusByUserId with consistent result-object contract and auto-persists completion flag; resumeStep defaults to 0 when all steps are complete.
apps/app/src/app/api/chat/route.ts Adds setup readiness gate; correctly returns 503 on DB error and 403 only when genuinely not ready, separating the two failure cases.
packages/core/src/workflows/instagram-webhook.ts Adds sidekick setup gate in DM path; on DB error it logs and falls through to generateReply (fail-open, correct), blocking only when setup is genuinely incomplete.
apps/app/src/app/(dashboard)/layout.tsx Adds amber setup banner and gates the SidekickToggle behind setup readiness; error path correctly leaves banner hidden without blocking the page.
apps/app/src/app/(onboarding)/onboarding/page.tsx Makes Instagram connection optional with a skip flow; initial step validation defaults and skip handler are consistent with each other.
apps/app/src/lib/inngest/functions.ts Migrates all Inngest functions to v4 triggers array syntax inside the config object.
apps/app/src/app/(dashboard)/(workspace)/page.tsx Replaces hard redirect to sidekick onboarding with in-page locked/ready states gated on both Instagram connection and setup readiness.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[User visits dashboard] --> B[DashboardLayout checks setup status]
    B -->|isReady false| C[Show amber setup banner]
    B -->|isReady true| D[Show SidekickToggle]
    B -->|DB error| E[Hide banner and toggle]

    C --> F[User clicks Resume setup]
    F --> G[sidekick-onboarding with step param]
    G --> H{step param present?}
    H -->|Yes| I[Navigate to correct step]
    H -->|No - BUG: Number null = 0| J[Always lands on step 0]

    D --> K[Sidekick page]
    K --> L{Instagram connected AND isReady?}
    L -->|Both true| M[Full SidekickLayout]
    L -->|Instagram missing| N[InstagramLockedSidekick]
    L -->|Not ready| O[SidekickUnavailable]

    P[POST api/chat] --> Q[getSidekickSetupStatusByUserId]
    Q -->|success false| R[503 Unable to verify]
    Q -->|isReady false| S[403 Complete setup]
    Q -->|isReady true| T[Continue to chat]

    U[Instagram DM webhook] --> V[getSidekickSetupStatusByUserId]
    V -->|success false| W[Log error then fall through to generateReply]
    V -->|isReady false| X[Block with sidekickBlocked true]
    V -->|isReady true| Y[generateReply]
Loading

Fix All in Codex

Reviews (3): Last reviewed commit: "fix errors" | Re-trigger Greptile

Greptile also left 1 inline comment on this PR.

@ArjunCodess ArjunCodess self-assigned this May 20, 2026
@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented May 20, 2026

Unable to deploy a commit from a private repository on your GitHub organization to the arjuncodess' projects team on Vercel, which is currently on the Hobby plan. In order to deploy, you can:

  • Make your repository public or
  • Upgrade to Pro. A Pro subscription is required to deploy from a private organization repository.

To read more about collaboration on Vercel, click here.

Comment thread packages/core/src/sidekick/personalization.ts Outdated
Comment thread packages/core/src/sidekick/personalization.ts Outdated
@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented May 22, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
pilot-app Ready Ready Preview, Comment May 22, 2026 1:15pm
pilot-web Ready Ready Preview, Comment May 22, 2026 1:15pm

Comment thread apps/app/src/app/api/chat/route.ts
Comment thread packages/core/src/workflows/instagram-webhook.ts
Comment thread apps/app/src/app/(onboarding)/sidekick-onboarding/page.tsx Outdated
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
@ArjunCodess ArjunCodess merged commit d1ee499 into main May 22, 2026
5 checks passed
@ArjunCodess ArjunCodess deleted the arjuncodess/skippable-onboarding-sidekick-readiness branch May 22, 2026 14:47
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.

1 participant