Skip to content

fix(mobile): keep agent widgets updated in the background - #14848

Closed
jakeleventhal wants to merge 7 commits into
pingdotgg:mainfrom
jakeleventhal:t3code/agent-widget-background-refresh
Closed

jakeleventhal wants to merge 7 commits into
pingdotgg:mainfrom
jakeleventhal:t3code/agent-widget-background-refresh

Conversation

@jakeleventhal

Copy link
Copy Markdown
Contributor

The iOS Agent Activity widget could render blank and keep showing an old “Working” snapshot after T3 closed. This change embeds the native layouts and lets the widget extension fetch current linked agent activity directly from the relay, independently of the app’s JavaScript runtime.

The relay registers an install/account-scoped read capability, stores its hash, and queues WidgetKit refresh pushes when agent activity changes. On iOS 26+, the extension registers its WidgetKit push token and receives quiet refresh requests. Scheduled native reads request another refresh after five minutes; iOS controls the actual timing and budgets both mechanisms. Successful reads renew freshness, including unchanged results. After an hour without a confirmed relay read, unfinished rows become out of date; Done and Failed outcomes stay intact. Direct-only observations retain their ten-minute deadline.

Foreground reconciliation preserves live environment precedence, handles older relay responses with an unavailable count when needed, and clears previous-account content. The native configuration survives app suspension and is cleared on sign-out. The change includes the relay migration, generated extension entitlements, and native fingerprint inputs. It requires a compatible native rebuild and relay deployment.

Continues #14608 and replaces the closed draft #14830. Rebased onto current main without conflicts.

Validation

  • 296 focused tests passed across 15 files covering mobile registration/reconciliation/layouts/timelines, relay refresh/registration/publication/APNs delivery, HTTP handlers, client requests, and contracts.
  • Native Swift behavior checks passed for unchanged-result renewal, source reconciliation, expiration, terminal preservation, and property-list storage.
  • Scoped formatting/lint and mobile, relay, client-runtime, and contracts typechecks passed.
  • A fresh compatible native build succeeded on iPhone 18 Pro Max, iOS 27.0. With T3 terminated and Metro stopped, real native scheduled reads changed isolated test agents from Working → Approval → Done. Reads at 17:16:39 and 17:21:59 UTC fetched the new states; the widget stayed fresh beyond the app’s original ten-minute deadline.
  • Native evidence was captured before the final rebase. Range-diff confirms all five implementation commits are unchanged; post-rebase focused tests and typechecks ran on the published branch.
  • The recording uses synthetic agent states and the production native widget/relay refresh service with isolated persistence. It does not exercise real agent approval or input workflows. APNs request construction, routing, token revocation, and queue handling are tested; real WidgetKit push delivery and the requested two-thread push sequence remain unverified. This draft does not claim push-path recording proof.

Native evidence

Baseline before: the original native client had no Agent Activity layout before publication.

Before: missing widget layout

Current build: Working while T3 is closed.

Working

After a native background read:

Approval

After the next native background read:

Done

40-second recording, accelerated 12× · Full uninterrupted seven-minute recording · Timestamped native relay reads

Implementation and validation by GPT-6.1-sol through the Codex harness in T3 Code.

jakeleventhal and others added 5 commits October 2, 2026 13:37
…kground error

expo-widgets stopped applying containerBackground for us, and the
home-screen widget never got a createWidget layout. iOS 17 then showed
"Please adopt containerBackground API" instead of agent activity.

Adopt the modifier on the home-screen views, register the widget layout,
and publish snapshots from the Live Activity refresh path. While the app
is foregrounded, regular widgets follow complete live environment shells
and reconcile them with relay snapshots scoped to the remaining
environments.

Rebased onto main as a single commit. Widget publishing goes through the
platform-split agentLiveActivity module so non-iOS builds never import
the widget, the Live Activity banner keeps the system glass tint and
hierarchical foregrounds, and environments switched off in Settings no
longer own widget rows.

Co-authored-by: Julius Marminge <51714798+juliusmarminge@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:XXL 1,000+ changed lines (additions + deletions). labels Oct 2, 2026
@jakeleventhal
jakeleventhal marked this pull request as ready for review October 2, 2026 17:44
Comment thread apps/mobile/modules/t3-native-controls/ios/T3AgentWidgetConfiguration.swift Outdated
Comment thread apps/mobile/src/features/agent-awareness/agentWidgetRefresh.ios.ts
Comment thread infra/relay/src/agentActivity/AgentActivityPublisher.ts Outdated

Copy link
Copy Markdown
Member

Note

This comment is posted by Julius' dot

Could a maintainer confirm whether the approved widget scope includes native background relay reads, WidgetKit refresh pushes, and the one-hour freshness window? The earlier review requested scheduled expiration; this adds a persistent read capability and background updates. The supplied recording shows scheduled Working → Approval → Done updates, while the description explicitly leaves real push delivery unverified. Please link the approval for this broader direction or confirm it here so the scope assessment can proceed.

@coderabbitai

coderabbitai Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


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

Comment thread apps/mobile/src/features/agent-awareness/remoteRegistration.ts
@macroscopeapp

macroscopeapp Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Not approved

Macroscope's review found this PR not approvable — This 45-file change adds a new background iOS WidgetKit capability with native extension code, authenticated relay access, database state, APNs delivery, and altered account lifecycle behavior. Its production-wide scope and bearer-token handling, alongside unresolved security and stale-state concerns, require human review.

Adjust the Minimum Blocking Severity for this repo — including turning it Off — in Settings. You can add or adjust custom eligibility rules. Learn more.

@juliusmarminge

Copy link
Copy Markdown
Member

lets just continue on the old PR. i added the label there so the dot wont close it

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

Labels

size:XXL 1,000+ changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants