fix(mobile): iOS home screen widgets render instead of a containerBackground error - #6464
fix(mobile): iOS home screen widgets render instead of a containerBackground error#6464jakeleventhal wants to merge 19 commits into
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 Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
ApprovabilityVerdict: Not approved Macroscope's review found this PR not approvable — This change adds a substantial iOS widget renderer and wires snapshot refreshes into sign-in, foreground reconciliation, local work, token registration, and sign-out. The shared renderer and asynchronous lifecycle changes affect production UI behavior beyond a narrowly scoped bug fix. You can add or adjust custom eligibility rules. Learn more. |
3d9dc9b to
e1af19f
Compare
e1af19f to
24c9279
Compare
24c9279 to
12d9fdf
Compare
4513981 to
b0f9719
Compare
aeb5395 to
40f7459
Compare
98db62f to
654c616
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 654c616. Configure here.
…kground error expo-widgets 56 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 view, register the widget layout, and publish snapshots from the existing Live Activity refresh path. Made-with: Grok 4.6 (T3 Code)
Use the compact banner for accessoryRectangular so lock-screen widgets are not clipped.
…ss/remoteRegistration.ts Publish the home-screen widget from the relay aggregate outside Live Activity priming.
The Check typecheck job failed because the snapshot fixture used a plain string threadId, which is not assignable to Brand<"ThreadId">. Made-with: Grok 4.6 (T3 Code)
Accessory circular/inline/rectangular layouts returned before widgetURL was applied, so taps on those families did not open the thread. Made-with: Grok 4.6 (T3 Code)
1b0baf5 to
c124f08
Compare

Before
After
What Changed
iOS home-screen Agent Activity widgets now render instead of Apple's "Please adopt containerBackground API" placeholder.
containerBackground("clear", "widget")on the home-screen view (small, medium, lock-screen rectangular).createWidget, not onlycreateLiveActivity.Live Activity / Dynamic Island layouts are unchanged.
Why
expo-widgets 56 stopped applying
containerBackgroundfor us, and the home-screen widget never received acreateWidgetlayout (that API writes a different App Group key than Live Activities). iOS 17+ then refused to render the widget.UI Changes
Before: adding the Agent Activity widget showed a white card with a stop icon and "Please adopt containerBackground API".
After: not captured on a device in this change (needs a native iOS rebuild and adding the widget). After opening the updated app once, the widget should show agent rows or "No active agents" on the system widget chrome.
Checklist
Made-with: Grok 4.6 (T3 Code)
Maintainer verification, September 5
Related report: #6641. Jake Leventhal's original branch and work are preserved.
The current-main widget code at f8b4c464 leaves the regular widget layout and timeline uninitialized. Adding the medium widget, opening the app and returning Home leaves a red placeholder in the Debug extension. The candidate renders the normal empty state on that same widget after loading the app. The app itself writes the regular layout and timeline; no widget preferences were manually seeded.
Before, current-main-equivalent widget source:
After, candidate production source:
Both captures use the same iPhone 17 Pro Max simulator, iOS 26.5, installed Debug app, home-screen placement and empty activity state. The compatible installed widget extension, Expo Widgets 57.0.15, app configuration and relevant native sources were checked against main. This is not a full current-main native build or a pixel-identical reproduction of the report's black release widget on iOS 26.3.1(a). The screenshots verify real WidgetKit rendering, not a React mock. No live relay account, paid provider turn, active-agent push, physical device, Android or watch/CarPlay check is claimed.
Review found a separate race in this PR: local work could wait for preferences, sign out or switch accounts, then republish the previous account's thread and project. The follow-up ee7365cf rejects that stale callback using the existing account generation. Two deterministic regression cases fail before the fix; both pass after it, while the same-account token-refresh control remains valid. The next test-only commit replaces the four timer waits introduced by this PR with preference-continuation completion receipts.
The orchestrator independently reran both complete focused test files at 845ed3d2: 61 passed. Targeted lint, formatting and diff checks pass. The final test-only commit has identical production bytes to the native-tested candidate. The latest CI results and the additional local-start finding are recorded below.
Human review is still required for the widget presentation and app-driven refresh semantics. Regular widget updates are not continuous background Live Activity pushes. The shared renderer also changes glyph scaling, empty Live Activity labels and compact-layout deep links, so the earlier claim of entirely unchanged Live Activity layouts is too broad. Leave this PR unmerged until those choices are accepted.
Fix first: local task start can leave the widget idle
Further review at 845ed3d2 confirmed the two local-start ordering findings filtered from the latest Macroscope output. The blank-widget rendering fix above works, but the current PR does not reliably show newly started work.
NewTaskDraftScreen arms the activity before creating the thread. Attachment preparation and turn submission can therefore finish after the PR's widget snapshot read. With Live Activities off, the widget receives idle. With them on, token registration can replace the Connecting seed with idle. Later activity arriving at the relay does not itself trigger another regular-widget update.
An independent orchestrator run executed the unchanged production arming, token-registration finalizer and foreground callbacks against controlled relay responses. Both delayed-activity cases failed the expected active-count assertion. Both already-active controls passed, and the actual foreground callback recovered Working in the delayed cases. Four cases ran in 2.07 seconds, with two failures and two passes. This proves the module's ordering behavior, not a real provider turn, relay transport or native active-task rendering.
Moving the read after thread creation is not sufficient: turn submission does not acknowledge relay publication. Early native Live Activity arming must also remain before the app can background. A reliable dynamic-widget fix needs an explicit choice of authoritative activity state and reconciliation across connected and relay-only environments. A narrower rendering-only change with clearly last-observed activity is another scope choice.
Leave this PR unmerged. It needs that scope decision and a verified correction before it is ready, not just presentation approval. CI is terminal at this head: 15 checks succeeded, eight skipped and Approvability is neutral with a human-review requirement. Those results do not resolve this finding.
Maintainer audit, follow-up fixes and native verification by GPT 6 Astra via Codex in T3 Code. Original contributor attribution above is preserved.
Note
Render iOS home-screen widgets for
AgentActivityand publish activity snapshotssystem-small,system-medium, and accessory widget layouts with T3 branding, project names, and phase icons. Retains the banner layout for Live Activity environments.AgentActivityWidgetandpublishAgentActivityWidgetto register the widget and forward snapshot updates.setAgentAwarenessRelayTokenProvidernow publishes an idle widget state; foreground reconciliation refreshes the widget before priming Live Activities.Macroscope summarized 845ed3d.
Note
Medium Risk
Adds async widget publishing on sign-out, foreground refresh, and local arming with generation guards—wrong ordering could briefly show stale agent state, but changes are scoped to iOS widget/Live Activity registration, not auth or data storage.
Overview
Fixes iOS home-screen Agent Activity widgets that showed Apple’s “adopt containerBackground” placeholder by registering a
createWidgetlayout (alongside the existing Live Activity) withcontainerBackground("clear", "widget"), dedicated small/medium/accessory UI, and safer handling of empty first-paint props (“No active agents”).publishAgentActivityWidgetpushes relay/local snapshots viaupdateSnapshot.remoteRegistrationnow refreshes the widget whenever Live Activity reconciliation runs (including when Live Activities are off or a card is already armed), seeds a “Connecting” snapshot when local work starts, clears to idle on cloud sign-out, and useswidgetRefreshGenerationso slower relay reads cannot overwrite newer local seeds or post–sign-out idle state.Live Activity / Dynamic Island layouts are intentionally unchanged; tests cover refresh timing, races, and sign-out guards.
Reviewed by Cursor Bugbot for commit 0f5ebc8. Bugbot is set up for automated code reviews on this repo. Configure here.