Skip to content

fix(client): restore message notification fallback when push is unavailable#117

Merged
Just-Insane merged 5 commits into
integrationfrom
codex/fix-pwa-push-resume-recovery
Jun 17, 2026
Merged

fix(client): restore message notification fallback when push is unavailable#117
Just-Insane merged 5 commits into
integrationfrom
codex/fix-pwa-push-resume-recovery

Conversation

@Just-Insane

@Just-Insane Just-Insane commented Jun 17, 2026

Copy link
Copy Markdown
Collaborator

Description

Revert the fork-specific push suppression and startup reconciliation changes, and align Charm’s push/visibility behavior with upstream again.

This follow-up does three things:

  • restore upstream togglePusher(...) visibility handling instead of keeping web push permanently enabled
  • restore page-to-service-worker setAppVisible reporting instead of heartbeat / foreground probe suppression
  • remove the page-side deferral path that was making hidden or unfocused sessions go silent when the custom suppression logic drifted

The goal is to get background push working again with the same simpler contract upstream uses, while keeping the existing media/session recovery work from the broader branch.

Related to #116

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings

@github-code-quality

github-code-quality Bot commented Jun 17, 2026

Copy link
Copy Markdown

Code Coverage Overview

Languages: JavaScript

JavaScript / code-coverage/vitest

The overall coverage in the branch remains at 22%, unchanged from the branch.

Show a code coverage summary of the most impacted files.
File 303c3f4 a434f7c +/-
src/app/feature...tifications.tsx 73% 57% -16%
src/app/hooks/u...ppVisibility.ts 80% 100% +20%
src/app/state/p...Subscription.ts 0% 50% +50%

Updated June 17, 2026 02:44 UTC
Code Coverage is in Public Preview. Learn more and provide us with your feedback.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 65c1c09e16

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/app/pages/client/ClientNonUIFeatures.tsx Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8c7a080786

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/sw.ts Outdated
@github-actions

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

Status Preview URL Commit Alias Updated (UTC)
✅ Deployment successful! https://pr-117-charm.justin-tech.workers.dev a434f7c pr-117 Wed, 17 Jun 2026 02:43:35 GMT

@Just-Insane Just-Insane merged commit 1e446c6 into integration Jun 17, 2026
13 of 14 checks passed
@Just-Insane Just-Insane deleted the codex/fix-pwa-push-resume-recovery branch June 17, 2026 02:44

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a434f7cdd3

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

user_id: mx.getUserId() ?? undefined,
},
});
const noti = new window.Notification(osPayload.title, osPayload.options);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Gate background page notifications on push readiness

When web push is enabled and a desktop tab is hidden/unfocused but still syncing, this line now always creates a page-owned OS notification; useAppVisibility also enables the Matrix web pusher when the tab goes hidden, so the service worker can show the Sygnal push for the same event. This reintroduces duplicate notifications for any background tab that still has a live sync connection; the page fallback needs to be skipped when a usable push transport is active.

Useful? React with 👍 / 👎.

});
throw err;
}
navigator.serviceWorker.controller?.postMessage({

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Await a real pusher update before reporting success

On a first install or after a service-worker update, navigator.serviceWorker.ready can resolve while the current tab is still uncontrolled because sw.ts intentionally avoids clients.claim(). In that state this optional controller?.postMessage is dropped, and even when it is delivered the page never observes failures from the service worker's /pushers/set fetch, so enablePushNotifications can resolve and settings can mark background push enabled after only creating a browser subscription with no Matrix pusher registered.

Useful? React with 👍 / 👎.

lang: navigator.language || 'en',
data: {
url: clientConfig.pushNotificationDetails?.pushNotifyUrl,
format: 'event_id_only' as const,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve the declarative web-push opt-in

For deployments with pushNotificationDetails.declarativeWebPushFallback enabled, the previous pusher builder added declarative_web_push: true to the pusher data so compatible gateways would emit Declarative Web Push payloads. The new hand-built pusher data omits that flag in this registration path (and the reuse path has the same shape), so those installs silently lose the configured WebKit declarative fallback.

Useful? React with 👍 / 👎.

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