GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(mobile): iOS Agent Activity widget shows your agents instead of a blank tile by shivamhwp · Pull Request #21163 · pingdotgg/t3code

fix(mobile): iOS Agent Activity widget shows your agents instead of a blank tile #21163

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Sign up for GitHub

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
juliusmarminge merged 17 commits into main from fix/ios-agent-activity-widget
Nov 9, 2026

Uh oh!

There was an error while loading. Please reload this page.

Merged

fix(mobile): iOS Agent Activity widget shows your agents instead of a blank tile #21163

Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
5a1c6d9
fix(mobile): iOS Agent Activity widget renders instead of a blank tile
Oct 18, 2026
25247c6
fix(mobile): reconcile Live Activities before the widget's relay read
Oct 19, 2026
f7773cf
fix(mobile): a slow older widget read no longer overwrites newer rows
Oct 19, 2026
31c97b0
fix(mobile): widget hides the previous account's agents on account sw…
Oct 19, 2026
f3ddbac
Merge main into fix/ios-agent-activity-widget
shivamhwp Oct 21, 2026
1ba2c18
fix(mobile): widget keeps its rows across a cold start and never re-p…
shivamhwp Oct 21, 2026
9a71d10
fix(mobile): a failed read after a cold start never leaves a stale wi…
shivamhwp Oct 21, 2026
49a8baa
fix(mobile): widget rows keep their owner across a provider release
shivamhwp Oct 21, 2026
a736547
fix(mobile): only the newest widget read may prime a Live Activity
shivamhwp Oct 21, 2026
217c694
Merge remote-tracking branch 'github/main' into fix/ios-agent-activit…
maria-rcks Oct 26, 2026
9644c16
fix(mobile): preserve account widget rows across cold starts
maria-rcks Oct 26, 2026
ca9b8d5
fix(mobile): omit absent widget owners from native storage
maria-rcks Oct 26, 2026
13aef01
chore: merge main into ios agent activity widget
maria-rcks Oct 30, 2026
c27c70e
fix(mobile): keep widget checks compatible with main
maria-rcks Oct 30, 2026
e34eaaf
Merge remote-tracking branch 'origin/main' into prbatch/21163
shivamhwp Nov 7, 2026
f070681
fix(mobile): drop the widget's account cache and guard reads by regis…
shivamhwp Nov 7, 2026
9e1694d
test(mobile): cover a sign-out and re-sign-in during a widget read
shivamhwp Nov 7, 2026
File filter
Filter by extension

Clear filters
Conversations
Failed to load comments.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Jump to
Jump to file
Failed to load files.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Diff view
Diff view
Prev Previous commit
Next Next commit
fix(mobile): widget keeps its rows across a cold start and never re-p…
…rimes after sign-out

- Recheck the account after the preference read so a sign-out during it
  can't prime a Live Activity with the old account's rows.
- Track whether the widget is showing a non-account state instead of
  whether this process painted rows, so a failed read after a cold start
  keeps the persisted rows, and the real deactivate-then-activate account
  switch shows loading instead of the sign-in prompt.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
  • Loading branch information

Uh oh!

There was an error while loading. Please reload this page.

@shivamhwp @claude
shivamhwp and claude committed Oct 21, 2026
commit 1ba2c18973d1b0a66f6e0dcfe17f44ca2cab1629

Some comments aren't visible on the classic Files Changed page.

There are no files selected for viewing

40 changes: 38 additions & 2 deletions 40 apps/mobile/src/features/agent-awareness/remoteRegistration.test.ts
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -858,7 +858,7 @@ describe("makeRelayDeviceRegistrationRequest", () => {
}).pipe(Effect.provide(relay));
});

it.effect("keeps the last rows when a later read fails, but never the signed-out state", () => {
it.effect("a failed read keeps the shown rows, but never the signed-out state", () => {
const relayDown = new ManagedRelay.ManagedRelayRequestFailedError({
action: "read relay agent activity snapshot",
transportFailed: true,
Expand All @@ -871,6 +871,12 @@ describe("makeRelayDeviceRegistrationRequest", () => {
setAgentAwarenessRelayTokenProvider(() => Promise.resolve("clerk-token"), "user-a");

return Effect.gen(function* () {
// A cold start keeps the rows the widget persisted before the app quit.
yield* refreshActiveLiveActivityRemoteRegistration();
expect(publishWidgetMock).not.toHaveBeenCalled();

setAgentAwarenessRelayTokenProvider(null);
setAgentAwarenessRelayTokenProvider(() => Promise.resolve("clerk-token"), "user-a");
yield* refreshActiveLiveActivityRemoteRegistration();
expect(publishWidgetMock).toHaveBeenLastCalledWith({ kind: "unavailable" });

Expand Down Expand Up @@ -938,10 +944,12 @@ describe("makeRelayDeviceRegistrationRequest", () => {
}),
);

it("hides the previous account's rows as soon as another account signs in", () => {
it("shows loading, not the sign-in prompt, while a switched account's first read runs", () => {
setAgentAwarenessRelayTokenProvider(() => Promise.resolve("clerk-token-a"), "user-a");
expect(publishWidgetMock).not.toHaveBeenCalled();

// CloudAuthBridge deactivates the old account before activating the new one.
setAgentAwarenessRelayTokenProvider(null);
setAgentAwarenessRelayTokenProvider(() => Promise.resolve("clerk-token-b"), "user-b");

expect(publishWidgetMock).toHaveBeenLastCalledWith({ kind: "loading" });
Expand Down Expand Up @@ -975,5 +983,33 @@ describe("makeRelayDeviceRegistrationRequest", () => {
expect(publishWidgetMock).not.toHaveBeenCalledWith({ kind: "snapshot", aggregate });
}),
);

it.effect("does not prime a Live Activity after sign-out during the preference read", () =>
Effect.gen(function* () {
let markRequested = () => {};
const requested = new Promise<void>((resolve) => {
markRequested = resolve;
});
let resolvePreferences = (_preferences: Preferences) => {};
vi.mocked(loadPreferences).mockImplementationOnce(() => {
markRequested();
return new Promise((resolve) => {
resolvePreferences = resolve;
});
});
const relay = fakeRelay(() => Effect.succeed({ aggregate }));
setAgentAwarenessRelayTokenProvider(() => Promise.resolve("clerk-token"), "user-a");

const refresh = yield* Effect.forkChild(
refreshActiveLiveActivityRemoteRegistration().pipe(Effect.provide(relay)),
);
yield* Effect.promise(() => requested);
setAgentAwarenessRelayTokenProvider(null);
resolvePreferences({ liveActivitiesEnabled: true } as Preferences);
yield* Fiber.join(refresh);

expect(widgetMocks.start).not.toHaveBeenCalled();
}),
);
});
});
32 changes: 18 additions & 14 deletions 32 apps/mobile/src/features/agent-awareness/remoteRegistration.ts
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,10 @@ const ACTIVITY_TOKEN_REREGISTER_INTERVAL_MS = 60_000;
const LIVE_ACTIVITY_STALE_AFTER_MS = 10 * 60_000;
const liveActivityStaleDate = () => new Date(Date.now() + LIVE_ACTIVITY_STALE_AFTER_MS);
const registeredActivityPushTokens = new Map<string, number>();
// A failed read keeps the current account's last rows, but must not leave the
// widget claiming the user is signed out or showing a previous account.
let widgetShowsCurrentAccount = false;
// Set while the widget shows the signed-out or loading state instead of the
// active account's rows. A failed read replaces only those; otherwise it keeps
// the rows on screen, including ones persisted from before a cold start.
let widgetAwaitsAccountRead = false;
// Refreshes can overlap (sign-in, foreground, retry); only the newest read may
// repaint, so a slow older response never overwrites newer rows.
let widgetSnapshotReads = 0;
Expand Down Expand Up @@ -195,21 +196,18 @@ export function setAgentAwarenessRelayTokenProvider(
if (relayTokenProviderIdentity && identity !== relayTokenProviderIdentity) {
clearAndroidAgentNotifications();
}
// Hide the previous account's rows while the new account's first read runs.
if (
provider &&
identity &&
relayTokenProviderIdentity &&
identity !== relayTokenProviderIdentity
) {
// Sign-in, including an account switch after the old account signed out,
// shows loading until the first read. A cold start keeps the persisted
// rows, which belong to the last account that was signed in.
if (provider && identity && (relayTokenProviderIdentity || widgetAwaitsAccountRead)) {
widgetAwaitsAccountRead = true;
publishWidget({ kind: "loading" });
}
androidDeviceReplayedAt = null;
deviceRegistrationGeneration++;
activeDeviceRegistration = null;
pendingDeviceRegistration = null;
registeredActivityPushTokens.clear();
widgetShowsCurrentAccount = false;
}
relayTokenProvider = provider;
relayTokenProviderIdentity = provider ? (identity ?? null) : null;
Expand All @@ -226,6 +224,7 @@ export function setAgentAwarenessRelayTokenProvider(
// Without a signed-in user the relay can no longer update or end these
// activities, so they would sit orphaned on the lock screen.
endLocalLiveActivities("live activity cleanup after cloud sign-out failed");
widgetAwaitsAccountRead = true;
publishWidget({ kind: "signed-out" });
setRegistrationStatus("unknown");
void clearAgentAwarenessRegistrationRecord().catch((error: unknown) => {
Expand Down Expand Up @@ -936,7 +935,7 @@ export function __resetAgentAwarenessRemoteRegistrationForTest(): void {
registrationStatusListeners.clear();
registeredActivityPushTokens.clear();
activityPushTokenLocks.clear();
widgetShowsCurrentAccount = false;
widgetAwaitsAccountRead = false;
widgetSnapshotReads = 0;
}

Expand Down Expand Up @@ -1090,9 +1089,9 @@ export const refreshActiveLiveActivityRemoteRegistration = Effect.fn(
return undefined;
}
if (snapshot) {
widgetShowsCurrentAccount = true;
widgetAwaitsAccountRead = false;
publishWidget({ kind: "snapshot", aggregate: snapshot.aggregate });
} else if (!widgetShowsCurrentAccount) {
} else if (widgetAwaitsAccountRead) {
Comment thread
macroscopeapp[bot] marked this conversation as resolved.
Resolved

Uh oh!

There was an error while loading. Please reload this page.

publishWidget({ kind: "unavailable" });
}
return { snapshot };
Expand Down Expand Up @@ -1145,6 +1144,11 @@ export const refreshActiveLiveActivityRemoteRegistration = Effect.fn(
cause,
}),
}).pipe(Effect.orElseSucceed(() => null));
Comment thread
macroscopeapp[bot] marked this conversation as resolved.
Resolved

Uh oh!

There was an error while loading. Please reload this page.

// A sign-out or account switch during the preference read already ended
// this account's cards; priming now would bring its rows back.
if (!relayTokenProvider || relayTokenProviderIdentity !== identity) {
return;
}
if (preferences?.liveActivitiesEnabled !== false) {
// The snapshot and preference reads yield; an arm-on-send may have
// created the card in the meantime. Re-check so two cards are never started.
Expand Down
2 changes: 2 additions & 0 deletions 2 apps/mobile/src/widgets/AgentActivityWidget.tsx
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ export function AgentActivityWidget(
? (props.subtitle ?? "No active agents")
: "Open T3 Code to load agent activity";

// Widget taps open the containing app, and every build accepts the prod
// scheme as a link prefix, so dev and preview builds route this too.
const linkRow = rows[0];
const deepLink =
linkRow && linkRow.deepLink.startsWith("/") && !linkRow.deepLink.startsWith("//")
Expand Down
Loading
Oops, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

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.
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.