Skip to content

Ask APNs for actions only on eligible approval alerts - #384

Merged
n0rpan merged 3 commits into
mainfrom
mobile/apns-action-host-main
Dec 3, 2026
Merged

n0rpan merged 3 commits into
mainfrom
mobile/apns-action-host-main

Conversation

@n0rpan

@n0rpan n0rpan commented Dec 3, 2026

Copy link
Copy Markdown
Collaborator

Part of #95. Builds on the signed phone opt-in from #367 and the fixed APNs category in #366. For a live approval with a validated allow-once/deny pair, ask the stateless APNs worker for its fixed category only when the paired phone has opted in and the reference and pairing hint are canonical. Only a boolean is added to that request. Other providers, questions and session alerts keep the existing delivery format.

Recheck eligibility before retrying. If an older APNs worker rejects the unsupported field before dispatch, fall back once to the ordinary tap-through alert without spending a delivery attempt. Ambiguous delivery errors retain the existing retry policy.

Based on 370fc50. All 220 ox-host-web tests passed with the server and client features enabled, including preference changes during retry, legacy worker refusal and wire compatibility. Six fixture-only tests were ignored by the unit runner. Formatting and git diff --check passed. A real lock-screen action on a signed iPhone remains to be verified.

Send approvalActions: true on the stateless APNs enqueue only for a live
exact approval whose AskView lock_screen pair revalidates as two distinct
in-bounds decisions with no questions, whose opaque reference and pairing
hint are the worker's canonical 43-character forms, and whose paired phone
is currently opted in with a matching active APNs installation. Every other
alert keeps the earlier body byte for byte, so ordinary, durable and
Firebase requests are unchanged.

Before retrying an actionable send, recheck liveness, the durable generation
and the phone's opt-in, dropping it to the ordinary alert when the opt-in is
gone. A worker that predates the field refuses the whole body with
400 invalid_request before the provider is called; the sender retries that
exact refusal once without the field so tap-through still works, and never on
a timeout, transport failure or any other status.

The frame's decisions and questions are revalidated through
LockScreenDecisions::validate, so a third choice or a question cannot inherit
the pair. Only the boolean crosses the wire: no decision index or token is
sent beyond the existing opaque reference.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Dec 3, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-12-03T19:05:23.785515Z 0eba9af Draft marked ready
🔒 Security Review ✅ Completed 2026-12-03T19:09:05.115102Z 0eba9af Draft marked ready
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@n0rpan

n0rpan commented Dec 3, 2026

Copy link
Copy Markdown
Collaborator Author

/queue a982b81

@n0rpan

n0rpan commented Dec 3, 2026 •

Copy link
Copy Markdown
Collaborator Author

In line to merge. Commit 0eba9af is reviewed with nothing blocking; it has entered the merge queue.

n0rpan commented Dec 3, 2026

Copy link
Copy Markdown
Collaborator Author

Coordination with #371 and #380: #371 and this PR both rewrite the enqueue/retry loop in native_notifications; #380 and this PR also update the same ActiveAsks logic. Please run one combined test with APNs and FCM targets: a held approval sends nothing until released, then only the opted-in APNs route gets actions; a Finished/Failed event still uses the durable FCM route. Keep the legacy APNs fallback on the ordinary alert path only.

@n0rpan

n0rpan commented Dec 3, 2026

Copy link
Copy Markdown
Collaborator Author

/queue 0eba9af

@n0rpan

n0rpan commented Dec 3, 2026

Copy link
Copy Markdown
Collaborator Author

@codex security review

Asked for by the maintainer’s queue request, for commit 0eba9af.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Can't wait for the next one!

Reviewed commit: 0eba9afbb7

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

@n0rpan
n0rpan marked this pull request as draft December 3, 2026 19:04
@n0rpan
n0rpan marked this pull request as ready for review December 3, 2026 19:04
@n0rpan

n0rpan commented Dec 3, 2026 •

Copy link
Copy Markdown
Collaborator Author

I ran the requested mixed APNs/FCM case on a local integration of #380 (667701c), #384 (0eba9af), #365, #368, #371 (bf6640f) and #396 (e321f65) against main at 20f8288.

The test fed held, released and repeated listings of the same approval into the host with three confirmed phone enrollments. The held listing produced zero sends. Release sent the action request only to the opted-in APNs phone. Its explicit legacy-worker refusal produced exactly one ordinary retry with the same reference. The other APNs phone and the FCM phone each received one ordinary approval. Relisting produced no further sends.

With the same enrollments on the durable relay, Finished and Failed each took the typed FCM path with registration generation 1. A third typed send that returned capability unavailable produced zero ordinary calls. The test used the real host projection, on-disk enrollment and preference stores, and sender loop with fixture relay responses. Physical provider delivery remains unverified.

The host-web library suite passed 237 tests, including released_approval_and_durable_sessions_route_to_their_eligible_phones, with seven fixture launchers ignored. The Node relay suite passed all 208 tests. Integration required preserving both hold tracking and the current frame’s validated lock-screen pair in ActiveAsks::replace, and keeping the legacy retry inside the ordinary delivery path. The individual PR heads still need those resolutions when restacked.

I repeated the 237-test host suite with #380 at a60aeb2 after its test-only update. The mixed routing test and the moved held_for_parent_is_additive_to_the_v1_ask protocol test both passed.

I reran the same test on the published #371 78ca4408 retry implementation and #396 2b18e164, combined with #368 49e655e6, #380 62ff287a and #425 2d6944c9. Those heads merged together locally. All 239 host-web library tests passed, including the mixed-route case, with nine fixture launchers ignored. The host engine’s held-generation test passed separately.

@n0rpan
n0rpan added this pull request to the merge queue Dec 3, 2026
Merged via the queue into main with commit efafd23 Dec 3, 2026
28 checks passed
@n0rpan
n0rpan deleted the mobile/apns-action-host-main branch December 3, 2026 20:49
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