Skip to content

web: notifications fail in Android PWA #49961

Description

@AdiY00

Summary

System notifications do not appear when a session completes or fails in the Android PWA. Chrome on Android rejects the web app's use of the Notification constructor and requires ServiceWorkerRegistration.showNotification().

Environment

  • opencode version: 2.0.8
  • Device: OnePlus 15
  • OS: Android 16
  • Browser: Chrome 153.0.0.0
  • Terminal: Not applicable (standalone PWA)
  • Shell: Not applicable (standalone PWA)
  • Install/channel: https://beta.opencode.ai, installed as a PWA

Reproduction

  1. Install https://beta.opencode.ai as an Android PWA.
  2. Grant notification permission and enable opencode session notifications.
  3. Open the PWA from its home-screen icon.
  4. Start a session and switch to another Android app before it completes.
  5. Wait for the session to complete.

Expected Behavior

An Android system notification should appear when the session completes or fails. Selecting it should return to the corresponding opencode session.

Actual Behavior

No system notification appears.

The following values were confirmed through remote DevTools:

  • Notification.permission: granted
  • Standalone display mode: true
  • Service-worker registration: null

Calling the same notification API used by the web platform produces:

TypeError: Failed to construct 'Notification': Illegal constructor. Use ServiceWorkerRegistration.showNotification() instead.

The failure also reproduced during a controlled session-completion test while the PWA was in the background.

Additional Context

packages/app/src/runtime/platform/web.ts creates notifications with new Notification(...). Chrome on Android does not support this constructor and requires ServiceWorkerRegistration.showNotification().

The generated service worker also has no notificationclick handler, which is required to implement notification click behavior.

There is a separate service-worker installation failure on the current beta deployment:

Fetch API cannot load https://beta.opencode.ai/_assets/__vite-browser-external-2447137e-BvRk9kiK.js. SRI's integrity checks failed.
sw.js:1 Uncaught (in promise) TypeError: Failed to fetch. SRI's integrity checks failed.

The browser reported the resource's computed SHA-256 integrity as:

8swVqH0fwc8XDDvPqJf6xzG3/DAwdGgKhA+t9mMRYQQ=

Because the service worker is not currently registered, showNotification() could not be tested on this deployment.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions