You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(mobile): live activity toggle no longer re-links saved environments - #32779
Turning Live Activity Updates (iOS) or Ongoing Agent Activity (Android) on in Settings → Notifications fails on every device with:
Ongoing activity unavailable
Could not obtain environment link proof: Invalid managed endpoint origin.
The toggle re-linked every saved environment that grants relay:write through the host's POST /api/connect/link-proof. Since #19271, that endpoint signs a proof only when the request arrives on the loopback origin it names (the WSL desktop-bootstrap session is the sole exception). A phone reaches the host over the LAN, Tailscale, or the T3 Connect tunnel, so the proof is always refused and the whole toggle rolls back.
Reproduced on this machine with the Android app: the host logged two POST http://192.168.0.196:3773/api/connect/link-proof requests from the phone (okhttp, 400) at 02:30:57 and 02:31:51, each failing in environment.cloud.makeLinkProof with CloudLinkOriginInvalidError: Invalid managed endpoint origin. The desktop app on the host succeeded over 127.0.0.1:3773 in the same window.
Change
The toggle now only updates this device's relay registration preference and no longer links environments from the phone:
The relay already decides Live Activity and ongoing-activity delivery per device from that preference.
Every desktop, web, and CLI link already enables activity updates for the environment (liveActivitiesEnabled: true), so the phone relink was redundant.
Removed the mobile environment-link module and its tests, the liveActivityPreferences wrapper, refreshManagedRelayEnvironments, and the Clerk token / relay:write plumbing in the settings screen.
Android registrations now apply the new native activity configuration before the relay write and restore the stored configuration if the permission lookup, preference update, or relay write fails, unless a newer registration has configured the device since.
The server's loopback-only link-proof check is unchanged. This follows the direction in #27412 and is the mobile counterpart to #32426's clearer message for remote desktop clients.
This is @juliusmarminge's #27432 rebased onto current main after it went conflicting (DIRTY). The only substantive adjustment is a typing fix for the newer Effect version on main (Effect.onError cleanup inference in remoteRegistration.ts). If you would rather land the original branch, close this and rebase #27432 instead.
Verification
pnpm --filter @t3tools/mobile typecheck: exits 0. Only the pre-existing effect(schemaClassMissingBrand) suggestions remain.
Mobile unit suite: 281 test files, 3309 tests pass.
vp test run src/features/agent-awareness/remoteRegistration.test.ts: 17 passed.
vp fmt --check and vp lint on the changed files pass.
Not checked on a physical device: enabling still needs a signed-in T3 Connect account, which this machine does not have. The dialog text changes were not captured, and the pre-commit knip task could not run here because only the mobile dependency graph is installed (it fails resolving untouched apps/web and apps/marketing configs); CI covers it.
AI-assisted: diagnosed from the host's server trace for the real failing request, then rebased and re-verified locally.
Turning Live Activity updates (Android ongoing activity) on or off re-linked
every saved environment through the host's link-proof endpoint, which only
accepts loopback hosts. A real phone reaches the host over LAN, Tailscale or
the tunnel, so the toggle always failed with "Invalid managed endpoint origin."
The relay already gates Live Activity delivery on each device's registration
preference, and desktop, web and CLI links enable activities at the link
level. The toggle now only updates this device's registration preference. The
unused mobile environment-link module and its Clerk token plumbing are gone.
Android registrations restore the stored native activity configuration when
the permission lookup, preference update, or relay write fails, unless a
newer registration has configured the device since.
Fixespingdotgg#27412
Rebased from pingdotgg#27432 onto current main.
Macroscope's review found this PR approvable — The activity toggle now changes only this device's preference instead of re-linking saved environments. Android failure recovery restores prior native settings, keeping the change bounded without altering product defaults or access permissions.
You can add or adjust custom eligibility rules. Learn more.
The reason will be displayed to describe this comment to others. Learn more.
Restore legacy environment opt-ins when enabling
When an upgraded device has a relay link whose liveActivitiesEnabled was set to false by an older mobile version, this path updates only the device registration. The relay still filters out activities for that environment in AgentActivityRows.listForUser, so the toggle can report success while no activities arrive until the link is re-enabled elsewhere. Preserve a reset or migration path for those legacy link preferences.
Reviewing files that changed from the base of the PR and between 30747bd and 64bc52a.
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
No actionable comments were generated in the recent review.
Walkthrough
The mobile Live Activity toggle now updates device registration preferences without relinking saved environments. Android registration configures notification preferences before push-token lookup and conditionally restores prior preferences after errors.
Changes: Live Activity preference flow
Layer / File(s)
Summary
Direct device preference updates apps/mobile/src/features/settings/SettingsNotificationsRouteScreen.tsx, apps/mobile/src/features/agent-awareness/liveActivityPreferences.ts, apps/mobile/src/features/agent-awareness/liveActivityPreferences.test.ts, apps/mobile/src/features/cloud/linkEnvironment.ts, apps/mobile/src/features/cloud/linkEnvironment.test.ts, apps/mobile/src/features/cloud/managedRelayState.ts
The settings screen updates the device registration preference when enabling or disabling Live Activity updates. It uses updating status in place of linking. The previous environment-linking workflow, related tests, and managed-relay refresh helper are removed.
Android notification preferences are configured before push-token lookup. Errors restore stored preferences only when the registration generation and configuration-write counter are still current. Tests cover relay and permission failures, plus a newer update following an older failed request.
Issue 31534 — Reports a mobile Live Activity toggle failure during environment linking. This change removes that relinking step from the toggle flow.
Issue 31753 — Reports the preference reverting after disabling. This change updates the device registration preference without relinking environments.
Possibly related PRs
pingdotgg/t3code#32469 — Both changes address mobile agent-awareness preference updates and registration sequencing.
pingdotgg/t3code#27432 — Both changes remove phone-side environment relinking and update the device preference directly.
pingdotgg/t3code#32592 — Both changes modify the mobile notification settings flow and Live Activity update operation.
Suggested reviewers:juliusmarminge, pixpmusic
Merge Risk: Minimal · previous review 30747
The Live Activity toggle now updates the device registration preference directly instead of relinking saved environments. No actionable merge-blocking risk was found, though the change was not verified on a physical device.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title is concise, uses the required conventional format, and clearly describes the main change: the mobile Live Activity toggle no longer re-links saved environments.
Description check
The description includes complete Problem, Change, Scope and approval, and Verification sections. It explains the failure, implementation, linked issue, test results, and known verification limits. It…
Linked Issues check
Issue [#27412] requires the mobile Live Activities toggle to work without obtaining a new environment link proof. The settings screen now updates only the device relay registration preference. It no l…
Out of Scope Changes check
The changes stay within issue [#27412]. The deleted link modules, tests, managed-relay refresh, and settings authentication plumbing remove the phone-side relinking that caused the failure. The settin…
Full details: Description check
Explanation
The description includes complete Problem, Change, Scope and approval, and Verification sections. It explains the failure, implementation, linked issue, test results, and known verification limits. It also states that physical-device testing and UI screenshots were not completed.
Full details: Linked Issues check
Explanation
Issue [#27412] requires the mobile Live Activities toggle to work without obtaining a new environment link proof. The settings screen now updates only the device relay registration preference. It no longer reads a Clerk token or calls the mobile environment-link flow. The removed flow included the phone-side link-proof request. The server loopback-only check remains unchanged because no server file changed. Android registration now applies activity configuration before the relay write and restores the stored configuration on failure. New tests cover relay failure, permission lookup failure, and stale concurrent registration. The reported typecheck and mobile test suite pass. The relay implementation is outside this repository, so end-to-end delivery cannot be independently verified here, but the required mobile code path is implemented.
Full details: Out of Scope Changes check
Explanation
The changes stay within issue [#27412]. The deleted link modules, tests, managed-relay refresh, and settings authentication plumbing remove the phone-side relinking that caused the failure. The settings screen changes update the device preference directly. The Android registration ordering and rollback changes support the same toggle and include focused tests. The Effect typing adjustment supports the changed registration code on the current main branch. No unrelated feature or server security change is demonstrated.
Finishing Touches
Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
size:L100-499 changed lines (additions + deletions).takeover:needs-juliusTakeover done; route gate says Julius decidesvouch:unvouchedAuthor is not yet trusted in the VOUCHED list.
2 participants
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Turning Live Activity Updates (iOS) or Ongoing Agent Activity (Android) on in Settings → Notifications fails on every device with:
The toggle re-linked every saved environment that grants
relay:writethrough the host'sPOST /api/connect/link-proof. Since #19271, that endpoint signs a proof only when the request arrives on the loopback origin it names (the WSL desktop-bootstrap session is the sole exception). A phone reaches the host over the LAN, Tailscale, or the T3 Connect tunnel, so the proof is always refused and the whole toggle rolls back.Reproduced on this machine with the Android app: the host logged two
POST http://192.168.0.196:3773/api/connect/link-proofrequests from the phone (okhttp, 400) at 02:30:57 and 02:31:51, each failing inenvironment.cloud.makeLinkProofwithCloudLinkOriginInvalidError: Invalid managed endpoint origin.The desktop app on the host succeeded over127.0.0.1:3773in the same window.Change
The toggle now only updates this device's relay registration preference and no longer links environments from the phone:
liveActivitiesEnabled: true), so the phone relink was redundant.liveActivityPreferenceswrapper,refreshManagedRelayEnvironments, and the Clerk token /relay:writeplumbing in the settings screen.The server's loopback-only link-proof check is unchanged. This follows the direction in #27412 and is the mobile counterpart to #32426's clearer message for remote desktop clients.
Scope and approval
Fixes #27412
This is @juliusmarminge's #27432 rebased onto current
mainafter it went conflicting (DIRTY). The only substantive adjustment is a typing fix for the newer Effect version onmain(Effect.onErrorcleanup inference inremoteRegistration.ts). If you would rather land the original branch, close this and rebase #27432 instead.Verification
pnpm --filter @t3tools/mobile typecheck: exits 0. Only the pre-existingeffect(schemaClassMissingBrand)suggestions remain.vp test run src/features/agent-awareness/remoteRegistration.test.ts: 17 passed.vp fmt --checkandvp linton the changed files pass.kniptask could not run here because only the mobile dependency graph is installed (it fails resolving untouchedapps/webandapps/marketingconfigs); CI covers it.AI-assisted: diagnosed from the host's server trace for the real failing request, then rebased and re-verified locally.