Skip to content

feat(mobile): add Android agents widget and live update - #5585

Open
iscekic wants to merge 14 commits into
audit-w8b-live-activities-3cf8-s2from
audit-w8b-live-activities-3cf8-s3
Open

feat(mobile): add Android agents widget and live update#5585
iscekic wants to merge 14 commits into
audit-w8b-live-activities-3cf8-s2from
audit-w8b-live-activities-3cf8-s3

Conversation

@iscekic

@iscekic iscekic commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Summary

  • The Android app now offers a resizable "Active agents" widget on the Home Screen. It shows the count of agents that need input, that are reconnecting, and that are running, and it adds an "Open agents" label when counts show. The smallest size shows only the top count; larger sizes show every non-zero count, with light and dark layouts.
  • The Android app now shows an ongoing "Active agents" notification with the same counts. On devices that support promoted ongoing notifications, the system promotes it to a Live Update; other devices show an ordinary ongoing notification.
  • Tapping the widget opens the active-agents view. If notifications are off and work is pending, the app offers a one-time prompt to open the device settings.

The ActiveAgentsLiveUpdate native module posts one ongoing notification under a fixed id through a dedicated active-agents channel that is silent, has no vibration, uses default importance, is public on the lock screen, and sets onlyAlertOnce. It promotes the notification to a Live Update only when SDK_INT_FULL is at least 36_001_000 and NotificationManager.canPostPromotedNotifications() is true, setting FLAG_PROMOTED_ONGOING plus a ProgressStyle; older devices fall back to an ordinary ongoing notification. The JS wrapper forwards translated copy and the promotion gate result, so no private identifier reaches the notification.

Files
  • apps/mobile/modules/active-agents-live-update/android/src/main/java/com/kilocode/activeagentsliveupdate/ActiveAgentsLiveUpdateModule.kt (added, +104) — exposes start, update, end, and isPromotionCapable; owns the fixed notification id, channel creation, and the promotion gate.
  • apps/mobile/src/glanceable-android/live-update.ts (added, +36) — the JS wrapper; passes isPromotionCapable() to the native functions and no-ops when the module is absent.
  • apps/mobile/modules/active-agents-live-update/android/build.gradle (added, +22) — new Android library module applying the Expo Modules Core plugin.
  • apps/mobile/modules/active-agents-live-update/expo-module.config.json (modified, +2/−2) — registers the module class for Android autolinking.

The androidSink implements GlanceableSink for Android: publish renders the widget from the newest snapshot and schedules one future redraw at expiresAt that zeroes the counts, while startOrUpdate starts or updates a single ongoing notification guarded by snapshot revision and a notification-permission check. A denied permission records the latest eligible snapshot as pending so a later widget tap can start it, and an epoch guard drops a concurrent start whose permission check outlived an endImmediate. endImmediate cancels the notification but keeps the widget props, so the Home widget stays truthful after the work ends.

Files
  • apps/mobile/src/glanceable-android/android-sink.ts (added, +199) — the sink implementation: widget render, expiry timer, revision guard, pending retry, epoch guard, and _resetAndroidSinkForTests.

The AndroidWidgetProps type is the only payload the widget host receives, and buildAndroidWidgetProps is its only producer; it maps the snapshot through the shared presentation layer to a translated status line, ranked non-zero count lines, a compact primary count, an "Open agents" affordance flag, and a spoken accessibility label. buildExpiredWidgetProps zeroes the counts and forces the expired status for the expiry redraw, buildGenericWidgetProps supplies the gallery placeholder, and buildOngoingNotificationText builds the single-line notification copy. None of the builders emits a title, organization name, or id.

Files
  • apps/mobile/src/glanceable-android/widget-props.ts (added, +114) — the AndroidWidgetProps and AndroidWidgetCount types and the four builders.

The ActiveAgentsWidget renders distinct light and dark layouts, showing only the primary count below 150dp wide and every non-zero count line plus the "Open agents" affordance at wider sizes, and it puts a OPEN_AGENTS click action on the surface. The widget declaration makes it resizable from 110×40dp up to 360×120dp across 2×1 target cells in both directions.

Files
  • apps/mobile/src/glanceable-android/active-agents-widget.tsx (added, +131) — renderActiveAgentsWidget, the compact threshold, the light and dark palettes, and the click-action constant.
  • apps/mobile/src/glanceable-android/widget-config.json (added, +16) — the widget declaration with name, label, description, and resize bounds.

Importing the widget module registers androidSink at module load and installs the widget task handler, which opens the agents view on the custom click action and otherwise re-renders from the last published props or an empty gallery placeholder.

Files
  • apps/mobile/src/glanceable-android/register.ts (added, +36) — sink registration and the task handler with click routing.

Notification permission is read through a lazy expo-notifications loader so the pure unit suite never pulls in React Native, and a test hook replaces the reader. A denied permission surfaces a one-time Open Settings alert only from a widget tap that cannot start the ongoing notification, never from a publisher start.

Files
  • apps/mobile/src/glanceable-android/permission.ts (added, +33) — isNotificationPermissionGranted and the test-only reader injection.
  • apps/mobile/src/glanceable-android/permission-alert.ts (added, +27) — showAndroidPermissionAlertOnce with the once-per-missing-permission latch and the Settings deep link.

The pure vitest project now includes the glanceable-android test directory, so the widget, sink, and props suites run in the node environment without React mounting and stay out of the mounted-test harness.

Files
  • apps/mobile/vitest.pure.config.ts (modified, +1) — adds src/glanceable-android/**/*.test.ts to the include list.

Test: 3 new suites added, apps/mobile/src/glanceable-android/active-agents-widget.test.ts (+150), android-sink.test.ts (+246), and widget-props.test.ts (+115).
Generated: none.


Verification

  • No E2E report was attached to this handoff. No manual test paths were recorded for this section; it ships the unit suites above.

Visual Changes

Visual Changes: N/A

Reviewer Notes

  • Human steps: none. No manual step is required before or after merge.
  • The pre-existing HIGH agent notification channel is unchanged; this level only adds the active-agents channel at default importance.
  • Notes: none.

Stacked PRs — merge bottom to top. Each level shows only its own diff.

Runtime verification (E2E, user advocacy, simplify) runs on the tip PR over every level.
Every level keeps its own checks, its own bot review, and its own threads; each one is answered on its own PR.
Each level is its own deliverable: it builds and passes its own checks alone.
A finding on a level is repaired on that level, then carried upward with stack.sh forward.

  1. audit-w8b-live-activities-3cf8feat(mobile): add glanceable agents snapshot contract #5535
  2. audit-w8b-live-activities-3cf8-s2feat(mobile): add iOS Live Activity and widgets #5553
  3. audit-w8b-live-activities-3cf8-s3feat(mobile): add Android agents widget and live update #5585 ← this PR
  4. audit-w8b-live-activities-3cf8-s4feat(mobile): deliver glanceable snapshot updates #5620 (tip)

Comment thread apps/mobile/src/glanceable-android/register.ts Outdated
Comment thread apps/mobile/src/glanceable-android/register.ts Outdated
Comment thread apps/mobile/src/glanceable-android/permission-alert.ts
Comment thread apps/mobile/src/glanceable-android/android-sink.ts
@kilo-code-bot

kilo-code-bot Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (10 files)
  • apps/mobile/modules/active-agents-live-update/android/src/main/AndroidManifest.xml
  • apps/mobile/modules/active-agents-live-update/android/src/main/java/com/kilocode/activeagentsliveupdate/ActiveAgentsDeadlineReceiver.kt
  • apps/mobile/modules/active-agents-live-update/android/src/main/java/com/kilocode/activeagentsliveupdate/ActiveAgentsLiveUpdateModule.kt
  • apps/mobile/src/glanceable-android/android-sink.test.ts
  • apps/mobile/src/glanceable-android/android-sink.ts
  • apps/mobile/src/glanceable-android/live-update.ts
  • apps/mobile/src/glanceable-android/register.test.ts
  • apps/mobile/src/glanceable-android/register.ts
  • apps/mobile/src/glanceable-android/widget-props.test.ts
  • apps/mobile/src/glanceable-android/widget-props.ts
Previous Review Summaries (5 snapshots, latest commit a26d710)

Current summary above is authoritative. Previous snapshots are kept for context only.

Previous review (commit a26d710)

Status: No Issues Found | Recommendation: Merge

Files Reviewed (9 files)
  • apps/mobile/modules/active-agents-live-update/android/src/main/java/com/kilocode/activeagentsliveupdate/ActiveAgentsLiveUpdateModule.kt
  • apps/mobile/src/glanceable-android/active-agents-widget.test.ts
  • apps/mobile/src/glanceable-android/android-sink.test.ts
  • apps/mobile/src/glanceable-android/android-sink.ts
  • apps/mobile/src/glanceable-android/live-update.ts
  • apps/mobile/src/glanceable-android/widget-props.test.ts
  • apps/mobile/src/glanceable-android/widget-props.ts
  • apps/mobile/src/lib/glanceable/presentation.test.ts
  • apps/mobile/src/lib/glanceable/presentation.ts

Previous review (commit f2a2901)

Status: No Issues Found | Recommendation: Merge

Files Reviewed (87 files)
  • apps/mobile/src/i18n/locales/af.json
  • apps/mobile/src/i18n/locales/am.json
  • apps/mobile/src/i18n/locales/ar.json
  • apps/mobile/src/i18n/locales/az.json
  • apps/mobile/src/i18n/locales/be.json
  • apps/mobile/src/i18n/locales/bg.json
  • apps/mobile/src/i18n/locales/bn.json
  • apps/mobile/src/i18n/locales/bs.json
  • apps/mobile/src/i18n/locales/ca.json
  • apps/mobile/src/i18n/locales/ckb.json
  • apps/mobile/src/i18n/locales/cs.json
  • apps/mobile/src/i18n/locales/cy.json
  • apps/mobile/src/i18n/locales/da.json
  • apps/mobile/src/i18n/locales/de.json
  • apps/mobile/src/i18n/locales/el.json
  • apps/mobile/src/i18n/locales/en.json
  • apps/mobile/src/i18n/locales/es.json
  • apps/mobile/src/i18n/locales/et.json
  • apps/mobile/src/i18n/locales/eu.json
  • apps/mobile/src/i18n/locales/fa.json
  • apps/mobile/src/i18n/locales/fi.json
  • apps/mobile/src/i18n/locales/fil.json
  • apps/mobile/src/i18n/locales/fr.json
  • apps/mobile/src/i18n/locales/ga.json
  • apps/mobile/src/i18n/locales/gl.json
  • apps/mobile/src/i18n/locales/gu.json
  • apps/mobile/src/i18n/locales/ha.json
  • apps/mobile/src/i18n/locales/he.json
  • apps/mobile/src/i18n/locales/hi.json
  • apps/mobile/src/i18n/locales/hr.json
  • apps/mobile/src/i18n/locales/ht.json
  • apps/mobile/src/i18n/locales/hu.json
  • apps/mobile/src/i18n/locales/hy.json
  • apps/mobile/src/i18n/locales/id.json
  • apps/mobile/src/i18n/locales/ig.json
  • apps/mobile/src/i18n/locales/is.json
  • apps/mobile/src/i18n/locales/it.json
  • apps/mobile/src/i18n/locales/ja.json
  • apps/mobile/src/i18n/locales/ka.json
  • apps/mobile/src/i18n/locales/kk.json
  • apps/mobile/src/i18n/locales/km.json
  • apps/mobile/src/i18n/locales/kn.json
  • apps/mobile/src/i18n/locales/ko.json
  • apps/mobile/src/i18n/locales/lo.json
  • apps/mobile/src/i18n/locales/lt.json
  • apps/mobile/src/i18n/locales/lv.json
  • apps/mobile/src/i18n/locales/mg.json
  • apps/mobile/src/i18n/locales/mi.json
  • apps/mobile/src/i18n/locales/mk.json
  • apps/mobile/src/i18n/locales/ml.json
  • apps/mobile/src/i18n/locales/mn.json
  • apps/mobile/src/i18n/locales/mr.json
  • apps/mobile/src/i18n/locales/ms.json
  • apps/mobile/src/i18n/locales/mt.json
  • apps/mobile/src/i18n/locales/my.json
  • apps/mobile/src/i18n/locales/nb.json
  • apps/mobile/src/i18n/locales/ne.json
  • apps/mobile/src/i18n/locales/nl.json
  • apps/mobile/src/i18n/locales/om.json
  • apps/mobile/src/i18n/locales/or.json
  • apps/mobile/src/i18n/locales/pa.json
  • apps/mobile/src/i18n/locales/pl.json
  • apps/mobile/src/i18n/locales/ps.json
  • apps/mobile/src/i18n/locales/pt-BR.json
  • apps/mobile/src/i18n/locales/pt.json
  • apps/mobile/src/i18n/locales/ro.json
  • apps/mobile/src/i18n/locales/ru.json
  • apps/mobile/src/i18n/locales/si.json
  • apps/mobile/src/i18n/locales/sk.json
  • apps/mobile/src/i18n/locales/sl.json
  • apps/mobile/src/i18n/locales/so.json
  • apps/mobile/src/i18n/locales/sq.json
  • apps/mobile/src/i18n/locales/sr.json
  • apps/mobile/src/i18n/locales/sv.json
  • apps/mobile/src/i18n/locales/sw.json
  • apps/mobile/src/i18n/locales/ta.json
  • apps/mobile/src/i18n/locales/te.json
  • apps/mobile/src/i18n/locales/th.json
  • apps/mobile/src/i18n/locales/tr.json
  • apps/mobile/src/i18n/locales/uk.json
  • apps/mobile/src/i18n/locales/ur.json
  • apps/mobile/src/i18n/locales/uz.json
  • apps/mobile/src/i18n/locales/vi.json
  • apps/mobile/src/i18n/locales/yo.json
  • apps/mobile/src/i18n/locales/zh-Hans.json
  • apps/mobile/src/i18n/locales/zh-Hant.json
  • apps/mobile/src/i18n/locales/zu.json

Previous review (commit 87a9643)

Status: No Issues Found | Recommendation: Merge

Files Reviewed (4 files)
  • apps/mobile/knip.json
  • apps/mobile/modules/active-agents-live-update/android/src/main/java/com/kilocode/activeagentsliveupdate/ActiveAgentsLiveUpdateModule.kt
  • apps/mobile/src/glanceable-android/register.test.ts
  • apps/mobile/src/glanceable-android/register.ts

Previous review (commit 6b17fcd)

Status: 3 Issues Found | Recommendation: Address before merge

Fix these issues in Kilo Cloud

Overview

Severity Count
CRITICAL 0
WARNING 3
SUGGESTION 0
Issue Details (click to expand)

WARNING

File Line Issue
apps/mobile/modules/active-agents-live-update/android/src/main/java/com/kilocode/activeagentsliveupdate/ActiveAgentsLiveUpdateModule.kt 91 Hidden setFlag will not request a Live Update
apps/mobile/modules/active-agents-live-update/android/src/main/java/com/kilocode/activeagentsliveupdate/ActiveAgentsLiveUpdateModule.kt 94 Ongoing notification has no tap intent
apps/mobile/src/glanceable-android/register.ts 35 Headless widget redraws wipe the last snapshot
Files Reviewed (10 files)
  • apps/mobile/knip.json - 0 issues
  • apps/mobile/modules/active-agents-live-update/android/src/main/java/com/kilocode/activeagentsliveupdate/ActiveAgentsLiveUpdateModule.kt - 2 issues
  • apps/mobile/modules/active-agents-live-update/expo-module.config.json - 0 issues
  • apps/mobile/src/glanceable-android/active-agents-widget.test.ts - 0 issues
  • apps/mobile/src/glanceable-android/active-agents-widget.tsx - 0 issues
  • apps/mobile/src/glanceable-android/android-sink.test.ts - 0 issues
  • apps/mobile/src/glanceable-android/android-sink.ts - 0 issues
  • apps/mobile/src/glanceable-android/live-update.ts - 0 issues
  • apps/mobile/src/glanceable-android/register.ts - 1 issue
  • apps/mobile/src/glanceable-android/widget-props.ts - 0 issues

Previous review (commit 464e031)

Status: 7 Issues Found | Recommendation: Address before merge

Fix these issues in Kilo Cloud

Overview

Severity Count
CRITICAL 2
WARNING 5
SUGGESTION 0
Issue Details (click to expand)

CRITICAL

File Line Issue
apps/mobile/modules/active-agents-live-update/android/src/main/java/com/kilocode/activeagentsliveupdate/ActiveAgentsLiveUpdateModule.kt 49 Unguarded SDK_INT_FULL crashes below API 36
apps/mobile/src/glanceable-android/register.ts 28 Widget tap does not bring the app to the foreground

WARNING

File Line Issue
apps/mobile/modules/active-agents-live-update/android/src/main/java/com/kilocode/activeagentsliveupdate/ActiveAgentsLiveUpdateModule.kt 89 Hidden setFlag will not request a Live Update
apps/mobile/modules/active-agents-live-update/android/src/main/java/com/kilocode/activeagentsliveupdate/ActiveAgentsLiveUpdateModule.kt 93 Ongoing notification has no tap intent
apps/mobile/src/glanceable-android/register.ts 34 Headless widget redraws wipe the last snapshot
apps/mobile/src/glanceable-android/permission-alert.ts 18 Alert.alert cannot show from a widget tap
apps/mobile/src/glanceable-android/android-sink.ts 167 JS restart cannot dismiss a leftover ongoing notification
Files Reviewed (15 files)
  • apps/mobile/modules/active-agents-live-update/android/build.gradle - 0 issues
  • apps/mobile/modules/active-agents-live-update/android/src/main/java/com/kilocode/activeagentsliveupdate/ActiveAgentsLiveUpdateModule.kt - 3 issues
  • apps/mobile/modules/active-agents-live-update/expo-module.config.json - 0 issues
  • apps/mobile/src/glanceable-android/active-agents-widget.test.ts - 0 issues
  • apps/mobile/src/glanceable-android/active-agents-widget.tsx - 0 issues
  • apps/mobile/src/glanceable-android/android-sink.test.ts - 0 issues
  • apps/mobile/src/glanceable-android/android-sink.ts - 1 issue
  • apps/mobile/src/glanceable-android/live-update.ts - 0 issues
  • apps/mobile/src/glanceable-android/permission-alert.ts - 1 issue
  • apps/mobile/src/glanceable-android/permission.ts - 0 issues
  • apps/mobile/src/glanceable-android/register.ts - 2 issues
  • apps/mobile/src/glanceable-android/widget-config.json - 0 issues
  • apps/mobile/src/glanceable-android/widget-props.test.ts - 0 issues
  • apps/mobile/src/glanceable-android/widget-props.ts - 0 issues
  • apps/mobile/vitest.pure.config.ts - 0 issues

Reviewed by grok-4.6 · Input: 228K · Output: 26.9K · Cached: 858.9K

Review guidance: REVIEW.md from base branch audit-w8b-live-activities-3cf8-s2

iscekic added 13 commits August 28, 2026 00:08
Gate the promoted-ongoing check behind SDK_INT >= 36 before reading
SDK_INT_FULL. Replace the custom widget click action with an OPEN_URI
deep link to the agents tab. Show the notification permission alert on
app foreground and retry a pending start when permission is granted.
Dismiss a leftover ongoing notification for an ineligible snapshot.
Drop four dead exports and register the Android widget task entry with
knip.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant