Skip to content

feat(web): company brain onboarding redesign + connector entitlement#1178

Open
MaheshtheDev wants to merge 1 commit into
mainfrom
mahesh/company-brain-onboarding
Open

feat(web): company brain onboarding redesign + connector entitlement#1178
MaheshtheDev wants to merge 1 commit into
mainfrom
mahesh/company-brain-onboarding

Conversation

@MaheshtheDev

@MaheshtheDev MaheshtheDev commented Jun 28, 2026

Copy link
Copy Markdown
Member
  • onboarding: unified About step, mode-aware Sources, Slack-focused Flows step, connect feedback (toast + connected state), auto-draft company description from domain
  • brain-home: Active members stat + invite, real OneDrive icon
  • useConnectorAccess hook so company_brain unlocks pro-tier connectors across onboarding + integrations
  • fix company-brain-connections crash on empty connections

Session Details

  • Session: View Session
  • Requested by: Unknown
  • Address comments on this PR. Add (aside) to your comment to have me ignore it.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jun 28, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
supermemory-mcp 360cae0 Jun 28 2026, 09:03 PM

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jun 28, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
supermemory-app 360cae0 Commit Preview URL

Branch Preview URL
Jun 28 2026, 09:04 PM

Copy link
Copy Markdown
Member Author

How to use the Graphite Merge Queue

Add the label Main to this PR to add it to the merge queue.

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@MaheshtheDev MaheshtheDev marked this pull request as ready for review June 28, 2026 19:28
@graphite-app graphite-app Bot requested a review from Dhravya June 28, 2026 19:28
@claude

claude Bot commented Jun 28, 2026

Copy link
Copy Markdown

Claude finished @MaheshtheDev's task in 2m 13s —— View job


PR Review: feat(web): company brain onboarding redesign + connector entitlement

  • Get the PR diff and review changes
  • Check if previous review issues have been addressed
  • Verify connector entitlement gap fix
  • Post review summary

Overview: Redesigns company brain onboarding with unified About step, mode-aware Sources, Slack-focused Flows step, adds useConnectorAccess hook for connector entitlement, and fixes a crash in company-brain-connections.

Issues found: None — all previously identified issues have been addressed.

Verified Fixes:

1. Race condition in draftCompany (step-about.tsx:122-153)
Fixed. The code now uses latestDraftDomain.current to track in-flight requests and discards stale responses:

  • Line 127: captures requested domain before fetch
  • Line 137: ignores response if domain changed mid-flight
  • Line 143: re-checks before applying change

2. Invite CTA for non-admins (brain-home-view.tsx:118, 184)
Fixed. The canInvite prop is computed from currentRole and the button only renders when canInvite is true.

3. Invite deeplink gating (account.tsx:217-227)
Fixed. The effect now waits for activeMemberRoleQuery.isLoading before processing, only opens the dialog if canManageTeam is true, and always clears the param.

4. Connector entitlement gap (add-document/connections.tsx)
Fixed. Now uses useConnectorAccess hook instead of isProUser, allowing company_brain orgs to access connectors.

5. Crash on empty connections (company-brain-connections.tsx:281-282)
Fixed. Defensive Array.isArray(data.toolkits) ? data.toolkits : [] guard handles undefined/null API responses.

useConnectorAccess hook

Clean implementation that consolidates pro-tier and company_brain entitlement checks. Returns connectorAccess: hasPro || hasCompanyBrain, mirroring backend canAccessConnector logic.

Score: 9/10

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

PR Review: feat(web): company brain onboarding redesign + connector entitlement

Overview: Redesigns the company brain onboarding flow with a unified About step, mode-aware Sources, Slack-focused Flows step, adds the useConnectorAccess hook for connector entitlement gating, and fixes a crash in company-brain-connections when connections are empty.

Issues found: None — this looks good to ship.

What I reviewed:

  • use-connector-access.ts (new): Clean hook that consolidates pro tier and company_brain entitlement checks. Properly handles loading state and mirrors backend canAccessConnector logic.

  • company-brain-connections.tsx: The crash fix at line 277 (Array.isArray(data.toolkits) ? data.toolkits : []) correctly handles undefined/null responses from the API.

  • step-sources.tsx: OAuth flows are handled correctly. Toast feedback on connection success, state reconciliation from URL params (?connected=<provider>), and the useConnectorAccess integration all look solid.

  • step-about.tsx: The auto-draft company description feature properly uses refs to avoid stale closures, tracks which domain has been summarized to prevent duplicate fetches, and has appropriate error handling.

  • onboarding/page.tsx: The SHARED_TEAM_BRAIN_TAG routing for team mode is correctly gated behind allowTeam && mode === "team".

  • brain-home-view.tsx: Active members stat and invite functionality added cleanly.

Minor observation (not blocking):

In connections-board.tsx (line 42), the API response handling doesn't use the same defensive pattern as the fix in company-brain-connections.tsx:

setBrainRows(((await c.json()) as { toolkits: ConnRow[] }).toolkits)

However, this won't cause a crash because brainConnected() (line 109-111) uses optional chaining brainRows?.find(). Worth unifying the pattern in a follow-up for consistency, but not a blocker.

Score: 9/10

@vorflux vorflux Bot 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.

Reviewed - found 2 issues.


Review with Vorflux

Comment thread apps/web/components/onboarding-brain/step-about.tsx Outdated
Comment thread apps/web/components/brain-home/brain-home-view.tsx
@vorflux

vorflux Bot commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

Testing validation results

Static validation found a connector entitlement gap: Company Brain orgs without api_pro can see connectors as enabled in IntegrationsView via useConnectorAccess, but clicking Google Drive, Notion, or OneDrive routes into the Add Document connector modal, where apps/web/components/add-document/connections.tsx still gates connection actions on api_pro only. That means connector access appears enabled, but the actual connect flow still disables or sends the user to upgrade.

No screenshots or recordings were produced because automated UI/browser validation was prohibited for this review.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8623cce3bc

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread apps/web/components/settings/account.tsx Outdated
Comment thread apps/web/components/integrations-view.tsx
@MaheshtheDev MaheshtheDev force-pushed the mahesh/company-brain-onboarding branch from 8623cce to 60c09bd Compare June 28, 2026 19:44

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

PR Review: feat(web): company brain onboarding redesign + connector entitlement

Overview: Redesigns company brain onboarding with unified About step, mode-aware Sources, adds useConnectorAccess hook for connector entitlement, and fixes company-brain-connections crash.

Issues found: None new — prior review findings have been addressed.

What I verified:

Race condition in draftCompany (step-about.tsx) — Fixed. The code now uses latestDraftDomain.current to track in-flight requests and discards stale responses before applying them (lines 127, 137, 143, 149, 151).

Invite CTA for non-admins (brain-home-view.tsx) — Fixed. The canInvite prop is computed from currentRole (line 118) and passed to StatsRow, which conditionally renders the invite button only when canInvite is true (line 184).

useConnectorAccess hook — Clean implementation that consolidates pro-tier and company_brain entitlement checks. Properly mirrors backend canAccessConnector logic.

Crash fix (company-brain-connections.tsx) — The Array.isArray(data.toolkits) ? data.toolkits : [] guard correctly handles undefined/null API responses.

Remaining items (already flagged by other reviewers):

The connector entitlement gap in add-document/connections.tsx (still uses isProUser instead of useConnectorAccess) and the invite deeplink gating in account.tsx have been noted by other reviewers. These are UX inconsistencies, not blocking bugs.

Score: 9/10

- onboarding: unified About step, mode-aware Sources, Slack-focused Flows step, connect feedback (toast + connected state), auto-draft company description from domain
- brain-home: Active members stat + invite, real OneDrive icon
- useConnectorAccess hook so company_brain unlocks pro-tier connectors across onboarding + integrations
- fix company-brain-connections crash on empty connections
@MaheshtheDev MaheshtheDev force-pushed the mahesh/company-brain-onboarding branch from 60c09bd to 360cae0 Compare June 28, 2026 21:01
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