[codex] Restore T3 Connect account controls#3492
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 3 potential issues.
Bugbot Autofix prepared fixes for all 3 issues found in the latest run.
- ✅ Fixed: Error shows empty clients state
- Added a
hasErrorWithoutDataguard that renders nothing in place of EmptyMobileClients when an error is present but no cached data exists, so only the error banner is shown.
- Added a
- ✅ Fixed: Preference switch stale after update
- Added optimistic local state (
optimisticPublishActivity) that is set immediately on successful update and used as the switch's checked value until the async refresh catches up, preventing the stale display.
- Added optimistic local state (
- ✅ Fixed: False empty before relay session
- Extended the
isInitialLoadcondition to also be true whendevicesState.accountIdis falsy (relay session not yet established), showing the loading skeleton instead of the false empty state.
- Extended the
Or push these changes by commenting:
@cursor push 85a49a0654
Preview (85a49a0654)
diff --git a/apps/web/src/components/clerk/MobileClientsUserProfilePage.tsx b/apps/web/src/components/clerk/MobileClientsUserProfilePage.tsx
--- a/apps/web/src/components/clerk/MobileClientsUserProfilePage.tsx
+++ b/apps/web/src/components/clerk/MobileClientsUserProfilePage.tsx
@@ -107,7 +107,9 @@
export function MobileClientsUserProfilePage() {
const devicesState = useManagedRelayDevices();
const devices = devicesState.data ?? [];
- const isInitialLoad = devicesState.data === null && !devicesState.error;
+ const isInitialLoad =
+ !devicesState.accountId || (devicesState.data === null && !devicesState.error);
+ const hasErrorWithoutData = devicesState.error !== null && devicesState.data === null;
return (
<div className="flex min-h-[30rem] w-full flex-col bg-background text-foreground">
@@ -149,7 +151,7 @@
{isInitialLoad ? (
<MobileClientsSkeleton />
- ) : devices.length > 0 ? (
+ ) : hasErrorWithoutData ? null : devices.length > 0 ? (
<ul className="space-y-3">
{devices.map((device) => (
<MobileClientRow key={device.deviceId} device={device} />
diff --git a/apps/web/src/components/settings/ConnectionsSettings.tsx b/apps/web/src/components/settings/ConnectionsSettings.tsx
--- a/apps/web/src/components/settings/ConnectionsSettings.tsx
+++ b/apps/web/src/components/settings/ConnectionsSettings.tsx
@@ -1586,7 +1586,15 @@
const [operationError, setOperationError] = useState<string | null>(null);
const [isUpdating, setIsUpdating] = useState(false);
const [isUpdatingPreference, setIsUpdatingPreference] = useState(false);
+ const [optimisticPublishActivity, setOptimisticPublishActivity] = useState<boolean | null>(null);
+ const serverPublishActivity = primaryCloudLinkState.data?.publishAgentActivity ?? null;
+ useEffect(() => {
+ if (optimisticPublishActivity !== null && serverPublishActivity === optimisticPublishActivity) {
+ setOptimisticPublishActivity(null);
+ }
+ }, [serverPublishActivity, optimisticPublishActivity]);
+
const reportUpdateFailure = (cause: unknown) => {
const message = cause instanceof Error ? cause.message : "Could not update T3 Connect access.";
const traceId = findErrorTraceId(cause);
@@ -1689,6 +1697,7 @@
}
primaryCloudLinkState.refresh();
+ setOptimisticPublishActivity(enabled);
toastManager.add({
type: "success",
title: enabled ? "Agent activity enabled" : "Agent activity disabled",
@@ -1734,7 +1743,11 @@
control={
<Switch
aria-label="Publish agent activity to mobile clients"
- checked={primaryCloudLinkState.data?.publishAgentActivity ?? false}
+ checked={
+ optimisticPublishActivity ??
+ primaryCloudLinkState.data?.publishAgentActivity ??
+ false
+ }
disabled={
!canManageRelay ||
!isSignedIn ||You can send follow-ups to the cloud agent here.
Reviewed by Cursor Bugbot for commit 5c536c8. Configure here.
| </ul> | ||
| ) : ( | ||
| <EmptyMobileClients /> | ||
| )} |
There was a problem hiding this comment.
Error shows empty clients state
Medium Severity
When the mobile client list fails to load, the UI displays both the error banner and the "No mobile clients" empty state. This occurs because isInitialLoad is false when an error is present, causing the page to suggest there are no devices rather than indicating a loading failure.
Reviewed by Cursor Bugbot for commit 5c536c8. Configure here.
| ? "This environment can publish agent activity to your mobile clients." | ||
| : "This environment will stop publishing agent activity.", | ||
| }); | ||
| setIsUpdatingPreference(false); |
There was a problem hiding this comment.
Preference switch stale after update
Medium Severity
The "Publish agent activity" switch can display an incorrect state immediately after a successful update. The UI relies on primaryCloudLinkState which updates asynchronously, discarding the updatePrimaryEnvironmentPreferences command's immediate return value. This causes a brief mismatch between the UI and the actual state, even after a success toast.
Reviewed by Cursor Bugbot for commit 5c536c8. Configure here.
| export function MobileClientsUserProfilePage() { | ||
| const devicesState = useManagedRelayDevices(); | ||
| const devices = devicesState.data ?? []; | ||
| const isInitialLoad = devicesState.data === null && !devicesState.error; |
There was a problem hiding this comment.
False empty before relay session
Medium Severity
isInitialLoad treats only data === null as loading, but useManagedRelayDevices substitutes a successful empty array when managedRelaySessionAtom has no accountId. During Clerk sign-in or account activation, the page can show “No mobile clients” instead of the loading skeleton until the relay session is registered.
Reviewed by Cursor Bugbot for commit 5c536c8. Configure here.
ApprovabilityVerdict: Needs human review This PR introduces new user-facing features (mobile clients management page, agent activity publishing toggle) rather than simple bug fixes or refactors. Additionally, there are three unresolved review comments identifying potential UI state bugs that should be addressed before merging. You can customize Macroscope's approvability policy. Learn more. |



Summary
UserButton.UserProfilePagefor account-level mobile clientsPublish agent activityas a nested setting under the local environment's T3 Connect exposure switchRoot cause
The dedicated cloud settings page originally owned both notification-device status and the activity publication preference. The T3 Connect rebrand removed that page without moving the device view into Clerk. A later connection architecture rewrite also replaced the T3 Connect exposure row and dropped its nested publication toggle, while leaving the relay device APIs and server preference endpoint intact.
Impact
Signed-in users can inspect registered mobile clients from the Clerk account component again. Linked server environments can explicitly opt into publishing agent activity so mobile push notifications and Live Activities receive updates.
Validation
vp test run apps/web/src/components/clerk/MobileClientsUserProfilePage.logic.test.ts apps/web/src/cloud/linkEnvironment.test.tsvp checkvp run typecheckvp run --filter @t3tools/web buildNote
Restore T3 Connect account controls with mobile clients page and agent activity toggle
updatePrimaryEnvironmentPreferencesruntime command.Macroscope summarized 5c536c8.
Note
Low Risk
Mostly UI and preference wiring against existing connect APIs; no new auth paths, with modest risk if preference toggles race link state in edge cases.
Overview
Restores T3 Connect account and environment controls that were dropped during earlier UI refactors, and renames user-facing T3 Cloud copy to T3 Connect in connection settings.
A new Mobile clients tab on the Clerk
UserButtonlists relay-registered iOS devices (push/Live Activity badges, notification detail, refresh and error retry) viauseManagedRelayDevices, with presentation helpers covered by unit tests.For the local primary environment, a nested Publish agent activity switch appears when T3 Connect is linked; it POSTs
publishAgentActivitythroughupdatePrimaryCloudPreferences/updatePrimaryEnvironmentPreferences, serialized with link/unlink on the same environment scheduler.Reviewed by Cursor Bugbot for commit 5c536c8. Bugbot is set up for automated code reviews on this repo. Configure here.