Skip to content

fix(tinyplace): switch active handle across multiple purchased identities#4216

Merged
senamakel merged 2 commits into
tinyhumansai:mainfrom
M3gA-Mind:fix/tinyplace-switch-active-handle-4198
Jun 29, 2026
Merged

fix(tinyplace): switch active handle across multiple purchased identities#4216
senamakel merged 2 commits into
tinyhumansai:mainfrom
M3gA-Mind:fix/tinyplace-switch-active-handle-4198

Conversation

@M3gA-Mind

Copy link
Copy Markdown
Collaborator

Summary

Users who own more than one purchased handle could only ever see the first identity as their active handle, with no way to switch (#4198). Two root causes:

  1. The profile header read profile.identities[0].username on the GraphQL path (ProfilesSection.tsx) instead of the primary-flagged identity.
  2. No RPC existed to change which handle is primary.

Fix

The tiny.place SDK already exposes registry.assign_primary(name) (one primary per wallet, signer-authenticated — clears the flag on the wallet's other names). This PR:

  • Core: adds openhuman.tinyplace_registry_assign_primary (manifest.rs handler + schemas.rs registration). Anti-spoof: the owning wallet is proven by the signer-attached signature, never from params.
  • Frontend API: adds registry.assignPrimary(name) to the invoke client.
  • UI (ProfilesSection.tsx): renders the header from pickPrimary(identities) (not [0]), and adds a Make active control to every non-primary handle in the owned-handles list that promotes it and refetches, so the new active handle is reflected across feed / profile / directory.

Tests

  • Rust: registry_assign_primary_rejects_blank_name (param validation before any client work).
  • invokeApiClient.test.ts: assignPrimary marshals the correct RPC.
  • ProfilesSection.test.tsx: header shows the primary (not [0]) handle with multiple identities; clicking Make active calls assignPrimary and refetches.

Closes #4198

…ties

Users who own more than one purchased handle could only ever see the first
one as their active handle, with no way to switch. Two causes:
- The profile header read identities[0] on the GraphQL path instead of the
  primary-flagged identity.
- No RPC existed to change which handle is primary.

The tiny.place SDK already exposes registry.assign_primary (one primary per
wallet, signer-authenticated). Expose it as openhuman.tinyplace_registry_assign_primary,
fix the header to render the primary identity (pickPrimary, not [0]), and add
a 'Make active' control to each non-primary handle in the owned-handles list
that promotes it and refetches so the change is reflected across the app.

Closes tinyhumansai#4198
@M3gA-Mind M3gA-Mind requested a review from a team June 26, 2026 16:10
@coderabbitai

coderabbitai Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@M3gA-Mind, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 43 minutes and 33 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: d0589b86-8042-4c4b-9fd9-9a66596d4862

📥 Commits

Reviewing files that changed from the base of the PR and between 56af7ec and 72417c7.

📒 Files selected for processing (6)
  • app/src/agentworld/pages/ProfilesSection.test.tsx
  • app/src/agentworld/pages/ProfilesSection.tsx
  • app/src/lib/agentworld/invokeApiClient.test.ts
  • app/src/lib/agentworld/invokeApiClient.ts
  • src/openhuman/tinyplace/manifest.rs
  • src/openhuman/tinyplace/schemas.rs

Comment @coderabbitai help to get the list of available commands.

…te test mock

ProfilesSection passed a GqlProfile `Identity[]` to `pickPrimary`, which was
typed for the directory `OwnedIdentity[]` (index-signature shape) — TS2345.
`pickPrimary` only reads `primary`/`[0]`, so make it generic over
`{ primary?: boolean }` to accept both. Also complete the `assignPrimary` mock
identity (was missing required Identity fields — TS2740) by spreading
`minimalIdentity` like the sibling mocks.

@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: 9d0d618664

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +362 to +366
<Button
variant="secondary"
size="sm"
disabled={switchingHandle !== null}
onClick={() => void handleSetActive(id.username)}>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve fallback identities for active switching

When graphql.user returns null or a non-402 error, useMyIdentity intentionally falls back to directory.reverse, which can return multiple owned handles, but that path stores only the selected identity and AgentProfileCard derives ownedIdentities as an empty array for source: 'directory'. As a result, users who own multiple purchased identities but have no GraphQL profile (or hit the documented GraphQL fallback) never see this newly added "Make active" control and still cannot switch their active handle.

Useful? React with 👍 / 👎.

@senamakel senamakel merged commit 51aeefd into tinyhumansai:main Jun 29, 2026
15 checks passed
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.

bug: users with multiple purchased identities cannot switch active handle — only first shown

2 participants