anomalyco / anomalyco/opencode

web: notifications fail in Android PWA

Open
#49,961 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
PR merge metrics
PR metrics pending

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in packages/app/src/runtime/platform/web.ts, then trace service-worker registration and the generated service worker mentioned in the issue. Reproduce the Android PWA flow after resolving or accounting for the reported service-worker installation failure. Done means background session completion and failure notifications appear, and selecting one returns to the corresponding session.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend, web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
65/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.