Skip to content

Honor configured tenancy for Desktop MCP credentials - #408

Open
agent-relay-code[bot] wants to merge 2 commits into
mainfrom
fix/desktop-mcp-tenancy
Open

agent-relay-code[bot] wants to merge 2 commits into
mainfrom
fix/desktop-mcp-tenancy

Conversation

@agent-relay-code

@agent-relay-code agent-relay-code Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

A synthetic verified Desktop sign-in in multi-tenant mode reproduced the reported Cursor registration failure on main: adding a second organization caused POST to answer 403 workspace_access_changed. Both registration and child-token resolution required the entire database to contain exactly one organization.

Pass the store's configured tenancy mode into both DesktopMcpCredentials instances. The global singleton condition still applies in single mode. The multi-mode SQL retains the exact workspace/organization/user membership joins, parent proof, locks, revocation and lease checks.

The HTTP regression covers registration, MCP authentication, renewal, a different organization's workspace, and loss of the original membership. A single-mode fixture also checks refusal after a second organization appears. Existing tests cover parent revocation and token-class restrictions. No Alpha environment access or deployment was used.


Run Proof
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.


Summary by cubic

Fixes Desktop MCP credential registration and child-token resolution failing in multi-tenant mode. The credential store enforced a whole-database single-organization invariant regardless of configured tenancy, so adding a second organization caused MCP authentication to return 403 workspace_access_changed.

  • Threads the store's configured tenancy mode into both DesktopMcpCredentials instances; single-tenant mode keeps the global single-organization check, multi-tenant mode scopes to the verified workspace and live membership.
  • Adds regression coverage for multi-tenant registration, MCP authentication, token renewal, rejection of a different organization's workspace, and loss of the original membership.
  • Adds a single-tenant test asserting refusal after a second organization appears.
  • Hardens the Replicas verifier test so a corrupted signature always fails verification instead of accidentally passing.

Written for commit 248f351. Summary will update on new commits.

View guided diff Turn on auto-fix

@agent-relay-code agent-relay-code Bot added the merge-train:hold Do not merge until the owner gives the go label Dec 1, 2026
@coderabbitai

coderabbitai Bot commented Dec 1, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 6073bb11-bb70-4978-ae07-3fd2b73359ec

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@agent-relay-code

Copy link
Copy Markdown
Contributor Author

@willwashburn, could you take the independent source review of 047039291aa98bcacbca5c4cfb2eb3659718182b? Control authored this fix. GitHub already requests both code owners. Please confirm acceptance here and attach your findings to that SHA.

Please trace the configured tenancy mode through both credential management and MCP token resolution. Check that a verified Desktop parent stays bound to its original user, organization and workspace even when the user belongs to two organizations. Check membership removal, parent revocation, child lease expiry, and single-mode refusal when a second organization exists. The writer reproduced the original 403 with a synthetic fixture and passed the local typecheck and 13 credential tests.

The PR remains held for the merge decision after review and CI. This request covers source review only.

@agent-relay-code

Copy link
Copy Markdown
Contributor Author

Successor 248f3517819d81d06d72b18b609c1a0a8499dcf9 addresses the sole failed assertion in job 142965717291. Typecheck passed. The Replicas negative test at line 91 replaced the last two signature characters with AA, which can already be the original suffix. The test now changes the first signature character to a guaranteed different value. The change is confined to the test. Both the Replicas identity suite and Desktop MCP credential suite passed locally under the serial host guard (21/21). Please use this successor for the existing review.

This branch has not been deployed

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

Labels

merge-train:hold Do not merge until the owner gives the go

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants