Skip to content

fix(client): harden PWA push and resume recovery#120

Merged
Just-Insane merged 1 commit into
integrationfrom
codex/fix-pwa-push-resume-audit
Jun 17, 2026
Merged

fix(client): harden PWA push and resume recovery#120
Just-Insane merged 1 commit into
integrationfrom
codex/fix-pwa-push-resume-audit

Conversation

@Just-Insane

Copy link
Copy Markdown
Collaborator

Description

Harden Charm's PWA push and resume recovery flow so notification-driven restores, cold launches, and long-idle resumes follow a single reliable path.

This PR:

  • restores lazy service-worker reclaim and session refresh on foreground return
  • re-arms web push on startup and when the SW controller is missing
  • routes room notification restores through the canonical /to/... deep-link path for both warm and cold flows
  • adds restore telemetry for /to entry, jump start/completion, resume triggers, and cold launch from notification clicks
  • adds a manual QA matrix for PWA push/resume scenarios

Related to #91.
Builds on the earlier merged push/resume follow-ups in #68, #116, and #117.

Fixes #

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

AI disclosure:

  • Partially AI assisted (clarify which code was AI assisted and briefly explain what it does).
  • Fully AI generated (explain what all the generated code does in moderate detail).
    This PR was AI assisted for the implementation and test updates around PWA push/resume recovery. The changes restore lazy SW claiming on foreground resume, reconcile web push registration at startup, route room notification restores through /to/:user/:room/:event?, add end-to-end restore telemetry, persist a notification-click launch marker for cold-launch classification, and add a manual QA matrix for warm resume, BFCache restore, long-idle reopen, and cold launch from notification taps.

@github-actions

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

Status Preview URL Commit Alias Updated (UTC)
✅ Deployment successful! https://pr-120-charm.justin-tech.workers.dev bf507e4 pr-120 Wed, 17 Jun 2026 04:08:07 GMT

@github-code-quality

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 287d31f bf507e4 +/-
src/app/hooks/u...ppVisibility.ts 100% 98% -2%
src/serviceWorkerBootstrap.ts 45% 44% -1%
src/app/pages/pathUtils.ts 69% 70% +1%
src/app/feature...tifications.tsx 57% 66% +9%
src/launch-cont...-persistence.ts 0% 44% +44%

Code Coverage is in Public Preview. Learn more and provide us with your feedback.

@Just-Insane Just-Insane merged commit 110a218 into integration Jun 17, 2026
14 checks passed
@Just-Insane Just-Insane deleted the codex/fix-pwa-push-resume-audit branch June 17, 2026 04:09

@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: bf507e49e6

ℹ️ 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

event.waitUntil(
(async () => {
await persistLaunchContext({

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 Persist launch context only for cold opens

This writes the launch marker before checking whether an existing window client will handle the click. For a warm notification tap, the existing client is navigated/focused below, but this cached marker is still consumed on the resulting or next bootstrap and records sable.app.launch_context as if the open was a cold notification launch. Persist it only when falling through to openWindow, or clear it when reusing an existing client.

Useful? React with 👍 / 👎.

Comment thread src/sw.ts
console.debug('[SW notificationclick] postMessage to existing client:', wc.url);
try {
if (pushNavigate && !pushRoomId && typeof wc.navigate === 'function') {
if (typeof wc.navigate === 'function') {

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 Keep invite clicks on the account-switching path

With this unconditional navigate, invite notifications with an existing window no longer post notificationClick to HandleNotificationClick, which is the path that calls setActiveSessionId(userId) before opening invites. The target URL only carries the user as ?uid=, and the inbox routes do not consume that parameter, so tapping an invite for a background account opens the currently active account's invite inbox instead of the notified account.

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