Skip to content

feat(search): connect multiple accounts per integration - #9716

Merged
waleedlatif1 merged 11 commits into
stagingfrom
feat/search-multiple-accounts-per-provider
Nov 6, 2026
Merged

waleedlatif1 merged 11 commits into
stagingfrom
feat/search-multiple-accounts-per-provider

Conversation

@waleedlatif1

@waleedlatif1 waleedlatif1 commented Nov 5, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Members can connect several accounts of one OAuth integration, e.g. Google Drive in two tenants, up to 5 live accounts per provider. This applies to every OAuth integration, including Slack and GitHub, and to the MCP connectors that can identify an account
  • One migration, 0453: credentials are now unique per provider subject and tenant, for both OAuth and managed MCP. It builds the new indexes concurrently, then drops the old ones. Nothing used the old indexes as conflict targets, and the new ones are supersets, so the build can't fail on existing data
  • Connecting: Add account creates a new credential, an already connected identity is refused, and reconnect stays pinned to its account. Disconnecting frees the slot, so a member can switch accounts; the same identity returning restores its credential. Invitation links only refresh the existing account
  • GitHub setup lists installations across a member's accounts and verifies through whichever one administers the installation. One failing account doesn't block the others. Slack sender resolution accepts any linked account and still refuses an unlinked sender or one linked to another person
  • Credential block Find operations keep returning the person's first connected account, so a workflow's account doesn't change when someone adds another. List reaches the rest
  • People list groups MCP connections per server, so several accounts can't exceed its summary limit
  • Viewer connector status and the enrollment page no longer assume one row per option. Docs and READMEs updated
  • Integrations UI: accounts are called accounts, an account needing reconnect gets a Reconnect button, the disconnect dialog names only that account, and Add account stays out of a single account's view
  • Connecting from any surface refreshes what Search can reach

Managed MCP

  • Reads the signed-in account through each connector's identity tool during OAuth completion: notion-get-self, get_account_info (Granola), fireflies_get_user, whoami (Coda), get_user_details (HubSpot). Connections are now named for the account
  • OAuth and MCP share resolveAccountWrite, so add, reconnect, and limit rules can't drift
  • Existing connections keep working as before: a lone account reconnects even if the identity tool fails, and a disconnected connection comes back with the same id, so workflows pinned to it survive
  • The MCP attempt version moves to 4, so an old instance rejects a new attempt during the deploy rather than overwriting the wrong account's tokens. An attempt in flight at deploy asks the person to connect again
  • Anything unexpected from a provider yields no identity rather than a guess. An unidentified connection keeps working
  • Existing connections are identified from their stored tokens when someone adds an account. If those tokens no longer work, the add is refused with a prompt to reconnect first
  • Zoom, Lucid, and Databricks stay at one connection: I found no documented way to identify the account

Existing users

  • Nothing changes until someone adds an account. The migration doesn't touch rows, confirmed by upgrading a database with existing rows, replaying it, and recovering an interrupted index build
  • After an add, List operations return each account, and a connector's member count counts accounts

Rollout

  • Rollback: old code reads one row per option or server, so once a member has two accounts it picks one arbitrarily and reconnect can fail. Old MCP code could also overwrite one of them. Have those members disconnect the extra account. Restoring the old indexes needs a dedupe first
  • credential_added fires for each added account, so subscribed workflows run for it

Type of Change

  • New feature

Testing

  • New multiple-provider-accounts.integration.ts on real Postgres: add, duplicate, per-provider limit, concurrent completion, reconnect pinning, disconnect then switch or restore, invitation links, Slack sender resolution, and the same for managed MCP including pre-existing connections. Ran on both the push and the SQL migration provisioning paths
  • Extended github-installations.integration.ts, github-installations.test.ts, and tool-permissions.integration.ts (an approval stays on the disconnected account when a different one is added); new member-integrations.test.ts and mcp-account-identity.test.ts. Saw the new behavior tests fail before the fix
  • Ran the affected unit suites, the MCP integration suites, biome on changed files, check:migrations, check:api-validation:strict, check:explicit-any, check:boundaries, check:client-boundary, check:comment-hygiene, check:utils, check:test-patterns, check:schema-mock, check:source-conventions, check:file-names
  • New org-redesign browser check with two accounts, one needing reconnect, including screenshots and the account chooser on Add account
  • Type-check on pre-push; check:audits and the full suite run in CI, not locally
  • Not yet tried with real provider accounts. MCP identity parsing follows vendor docs only: Notion's shape is documented, Granola and Fireflies document the fields but not the format, Coda comes from a catalog on its docs site, and HubSpot's user field is unconfirmed, so it can fall back to the account

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing (new tests pass the test-audit authoring gate)
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

Key managed OAuth credentials on the provider's subject and tenant instead of
one row per enrollment and option, so a member can connect several accounts of
any OAuth integration. Reconnect stays pinned to its account, disconnecting
frees the slot, and invitation links only refresh the existing account.
@vercel

vercel Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
docs Ready Ready Preview Nov 6, 2026 12:56am UTC

Request Review

@cubic-dev-ai cubic-dev-ai 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.

All reported issues were addressed across 32 files

Turn on auto-fix | Re-trigger cubic

Comment thread apps/sim/lib/credential-groups/oauth.ts Resolved
Comment thread apps/sim/lib/credential-groups/oauth.ts Resolved
@greptile-apps

greptile-apps Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[High impact] The PR appears safe to merge; no new actionable issues were found.

Findings

  1. P1 Account addresses lose leading underscores ▶

Summary

Adds multiple accounts per integration, with shared rules for adding, reconnecting, and restoring OAuth and managed MCP accounts.

  • Members can connect several accounts for one OAuth provider.
  • Supported managed MCP connectors can keep several accounts distinct.
  • Search setup can use connected accounts across providers.
  • Integrations shows each connected account and its own actions.
  • Credential Find returns the first connected account for a provider.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[OAuth completes] --> B[Read account identity]
  B --> C[Apply shared account rules]
  C --> D{Requested action}
  D -->|Add| E[Check duplicate and live-account limit]
  D -->|Reconnect| F[Check selected credential]
  D -->|Invitation| G[Refresh an existing account]
  E --> H[Create or restore credential]
  F --> I[Update the same credential]
  G --> I
  H --> J[Refresh account lists and Search]
  I --> J
Loading

Reviews (6) · Last reviewed commit: "fix(search): add the count to the People..." · Reviewed by Greptile

Comment thread apps/sim/lib/credential-groups/oauth.ts Resolved
…ector

Read the signed-in account through each connector's documented identity tool
during OAuth completion and key connections on it, sharing one set of account
rules with OAuth providers. Notion, Granola, Fireflies, Coda, and HubSpot now
allow several accounts; connectors with no identity tool stay at one.
Enforce the account limit when reconnecting a disconnected account, keep GitHub
setup working when one linked account fails, and surface reconnect prompts over
disconnected accounts. Identify existing managed MCP connections from their
stored tokens so adding an account does not first require reconnecting.
…connect

Show accounts as accounts, surface Reconnect beside an account that needs it,
keep each disconnect clear about which account it removes, and hide Add account
in a single account's view. Connecting from any surface now refreshes what Search
can reach. Add browser coverage for several accounts and tighten the tests.
The design system Button dropped aria-label, so several Reconnect buttons on one
page read the same. Restore the browser check for an app with connections
unavailable and shrink the test-types baseline after removing a duplicate test.
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai 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.

All reported issues were addressed across 63 files

Reply with feedback, questions, or to request a fix.

Turn on auto-fix | Re-trigger cubic

Comment thread apps/sim/lib/credentials/managed-mcp.ts Resolved
…iew gaps

Replace the managed MCP check in one atomic statement so an interrupted migration
can retry. Refuse to adopt an identity another connection holds, write the Search
receipt only for flows that read it, keep expired accounts labeled as such, and
refresh Search's account list on disconnect.
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai 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.

All reported issues were addressed across 63 files

Reply with feedback, questions, or to request a fix.

Turn on auto-fix | Re-trigger cubic

An address in a non-JSON identity response now needs a label naming it as the
signed-in account, so an unrelated address is never stored as the identity, and
markdown, punctuation, and punycode domains no longer distort it.
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai 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.

All reported issues were addressed across 63 files

Reply with feedback, questions, or to request a fix.

Turn on auto-fix | Re-trigger cubic

…migration

Combine the account migrations into one. Reuse a disconnected connection's id, let
a lone account reconnect when its identity tool fails, keep Find on the first
connected account, and refresh an expired account added again. Group People list
MCP summaries, tell same-email accounts apart, and version MCP attempts so an old
instance can't overwrite tokens during a deploy.
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai 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.

No issues found across 63 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

You've manually re-run cubic several times on this PR. Each manual re-review checks the full PR again and counts toward your usage quota. To preserve your usage limits, we recommend letting cubic automatically review new commits.

Turn on auto-fix | Re-trigger cubic

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai 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.

No issues found across 65 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

You've manually re-run cubic several times on this PR. Each manual re-review checks the full PR again and counts toward your usage quota. To preserve your usage limits, we recommend letting cubic automatically review new commits.

Turn on auto-fix | Re-trigger cubic

…le-accounts-per-provider

# Conflicts:
#	apps/sim/lib/assistant-actions/tool-permissions.integration.ts
@waleedlatif1
waleedlatif1 merged commit 6d8c34f into staging Nov 6, 2026
89 checks passed
@waleedlatif1
waleedlatif1 deleted the feat/search-multiple-accounts-per-provider branch November 6, 2026 02:37

This branch was successfully deployed

1 active deployment
Preview — b57d3c1f Deployed Nov 6, 2026 by vercel[bot]
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