Skip to content

fix(ios): approval alerts retain an earlier ID role - #200360

Merged
joshavant merged 2 commits into
mainfrom
fix/ios-approval-id-policy
Nov 17, 2026
Merged

joshavant merged 2 commits into
mainfrom
fix/ios-approval-id-policy

Conversation

@joshavant

@joshavant joshavant commented Nov 17, 2026 •

Copy link
Copy Markdown
Collaborator

What Problem This Solves

Fixes iOS approval notifications continuing to use an earlier OpenClaw ID role after the member's access changes.

User Impact

New approval alerts follow current ID membership, permissions, and request visibility. Separately paired local devices keep their local permissions, and cleanup notifications can still dismiss earlier prompts. No new configuration is required. Earlier preview native pairings without ID attribution must be removed and paired again through OpenClaw ID before reuse; existing local approvals are not reassigned automatically.

Why This Change Was Made

The iOS delivery owner now evaluates the complete approval record using current pairing, membership, and session facts, then checks again when the push provider starts. Native operator pairing saves ID attribution before installing its approval, including tokenless connections.

If saving attribution succeeds but a same-key ID regrant later fails, that device can remain bound to ID and require owner recovery. This conservative outcome does not grant additional access; unchanged local reconnects are unaffected.

Evidence

  • 79 focused tests passed: approval push policy, native authentication/pairing retry, and direct/relay APNs behavior. Reused passing evidence for 156 unchanged consumer checks.
  • Formatting, targeted lint, core types, and all four affected test type graphs passed.
  • CI caught an obsolete assertion-baseline allowance after the cast was removed. Follow-up 21064fa8dfbff9de64014d5864385d7c8c140413 removes that one entry; the assertion guard passes in the isolated VM (2,363 files, 5,348 grandfathered assertions). Runtime source is unchanged from the compiled replay below.
  • Both regressions failed against pristine source for the intended behavior: stale member selection and native approval acceptance despite a binding-write failure.
  • Fresh local autoreview of the complete change against 910f6b9427d7550a1d8607f25946d7f5ec4e0014 completed with no actionable P0–P2 findings. The review noted limits around unchanged binding and provider internals; a separate independent source review covered those owners.
  • Clean pnpm build:runtime passed for commit 526e2190718e4cbb87a5041cdfa40b03d1cd7b39, with zero source overrides and matching source inventories before/after.
  • Isolated compiled Gateway replay passed through ordinary signed enrollment, iOS-protocol operator/node pairing, APNs registration, role downgrade, and approval expiry. The member received the pre-downgrade alert; afterward, exactly the same new approval reached an independent local device once and the member zero times through final shutdown. The historical admin token and linked local admin role remained intact.
  • Independent verification validated all six signed relay HTTP sends, frozen build inputs, unchanged compiled artifacts, and joined fixture cleanup.
Redacted compiled-Gateway replay receipt

This excerpt comes from the frozen replay receipt, captured relay HTTP requests, and independent export-verifier result. Request and recipient identifiers use consistent aliases; keys, signatures, device/account identifiers, endpoints, and command content are omitted. The six events below are the actual observed send sequence. The post-change request expired normally after its complete 15-second pending lifetime.

{
  "build": {
    "version": "2026.11.4",
    "commit": "526e2190718e4cbb87a5041cdfa40b03d1cd7b39",
    "builtAt": "2026-11-17T00:39:50.181Z",
    "buildId": "ios-approval-526e2190718e"
  },
  "manualStateInjection": false,
  "sourceOverrides": 0,
  "observedSignedRelaySends": [
    {
      "request": "before-role-change",
      "recipient": "independent local device",
      "pushType": "alert",
      "kind": "plugin.approval.requested"
    },
    {
      "request": "before-role-change",
      "recipient": "ID member",
      "pushType": "alert",
      "kind": "plugin.approval.requested"
    },
    {
      "request": "before-role-change",
      "recipient": "independent local device",
      "pushType": "background",
      "kind": "plugin.approval.resolved"
    },
    {
      "request": "before-role-change",
      "recipient": "ID member",
      "pushType": "background",
      "kind": "plugin.approval.resolved"
    },
    {
      "request": "after-role-change",
      "recipient": "independent local device",
      "pushType": "alert",
      "kind": "plugin.approval.requested"
    },
    {
      "request": "after-role-change",
      "recipient": "independent local device",
      "pushType": "background",
      "kind": "plugin.approval.resolved"
    }
  ],
  "currentAuthority": {
    "originalSocketClosed": true,
    "freshMemberScopes": [
      "operator.read"
    ],
    "approvalListRefused": "FORBIDDEN"
  },
  "postDowngrade": {
    "pendingLifetimeMs": 15000,
    "terminalReason": "timeout",
    "entirePendingLifetimeJoined": true,
    "memberAlertCountThroughFinalShutdown": 0
  },
  "independentVerification": {
    "independentlyVerifiedSignedSends": 6,
    "historicalAdminTokenRetained": true,
    "linkedLocalAdminRoleRetained": true,
    "compiledEntries": 34168,
    "compiledUnchanged": true,
    "cleanupJoined": true,
    "gracefulProcessShutdown": false
  }
}

cleanupJoined records that all fixture processes were joined. The relay exited after the requested SIGTERM, so gracefulProcessShutdown remains false. No physical-device or Apple APNs delivery is claimed.

Hosted CI: the Windows lifecycle shard fails the same 17 tests as scheduled main CI, with the same spawn-broker EEXIST startup error. The APNs portion of that shard passed all 64 tests. This pre-existing failure remains visible.

No live services were changed. Physical iOS, Apple APNs, hosted relay, installed-package, and deployed-service validation remain outside this local qualification.

@clawsweeper

clawsweeper Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@joshavant
joshavant marked this pull request as ready for review November 17, 2026 02:15
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: ios App: ios gateway Gateway runtime size: L labels Nov 17, 2026
@github-actions

github-actions Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ Security sensitive changes

This maintainer PR changes sensitive security components.

No secops approval is required. This comment is informational because the PR author has Maintain or Admin access.

  • Current SHA: 21064fa8dfbff9de64014d5864385d7c8c140413
  • Maintainer: @joshavant
  • Repository role: admin

These security sensitive changes were made:

  • src/gateway/exec-approval-ios-push.ts: Controls sandbox containment or tool execution authority. Check filesystem and network isolation, approval scope, and command allowlists.
  • src/gateway/ios-approval-push-authority.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.
  • src/gateway/server/ws-connection/connect-device-pairing.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.

Carefully review these changes before merging.

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 17, 2026
@clawsweeper

clawsweeper Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR applies current OpenClaw ID permissions to iOS approval alerts and saves native device attribution before approving access.

Example: An ID member is downgraded from approval access to operator.read while retaining a historical admin token.

  • Before: New approval alerts can still reach the member using the stored token's broader scopes.
  • After: The member receives no new approval alert, while an independently paired local device remains eligible.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Useful, coherent repair with production Gateway and relay evidence; no actionable findings remain.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The published compiled-Gateway replay exercises signed enrollment, native pairing, APNs registration, member downgrade, real signed relay HTTP sends, and expiry cleanup, showing local delivery preserved and downgraded-member delivery suppressed; physical Apple delivery is outside the demonstrated scope.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: An ID member can keep receiving approval alerts after losing the permissions required to review them.
Reason: The maintainer-authored direction restores current membership authority while preserving separately approved local access and explicitly accepting preview-device recovery tradeoffs.

Merge readiness

✅ Ready for maintainer review

This PR fixes a current authorization mismatch in iOS approval notifications; no actionable patch defects were found, and the remaining failed CI gate matches an inherited Windows failure.

Priority: P2
Reviewed head: 21064fa8dfbff9de64014d5864385d7c8c140413

Before merge

None.

Findings

None.

Agent review details

How this fits together

Gateway approval delivery takes pending approval records, resolves paired iOS recipients against current identity and session policy, and sends alerts or cleanup notifications through direct APNs or its relay.

flowchart TD
  A[Pending approval record] --> B[iOS delivery owner]
  C[Pairing and ID membership] --> D[Current approval visibility]
  E[Profile and session facts] --> D
  B --> D
  D --> F[APNs transport]
  F --> G[iOS notification]
  B --> H[Cleanup notification]
Loading

Technical review

Best possible solution:

Keep current ID authorization in the iOS delivery adapter, record attribution before granting access, and preserve independent local grants and cleanup delivery.

Do we have a high-confidence way to reproduce the issue?

Current-main source exposes the stale-token recipient path, and the submitted compiled-Gateway replay demonstrates the corrected downgrade behavior; no target code was executed during this review.

Is this the best way to solve the issue?

The patch uses existing identity, pairing, profile, and session owners, removes caller-side visibility plumbing, and keeps the APNs-specific adaptation in one place.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against f57dbb4ff67e.

Provenance checked

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit bdcf6bd adds src/gateway/exec-approval-ios-push.ts:511 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: bdcf6bdfdd84; files: src/gateway/exec-approval-ios-push.ts)
  • Josh Lehman: Raw commit c1b75da adds src/gateway/server/ws-connection/connect-device-pairing.ts:286 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: c1b75daf7946; files: src/gateway/server/ws-connection/connect-device-pairing.ts)

PR surface

Source +171, Tests +278, Docs +7, Other -1. Total +455 across 16 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 6 257 86 +171
Tests 8 389 111 +278
Docs 1 7 0 +7
Config 0 0 0 0
Generated 0 0 0 0
Other 1 0 1 -1
Total 16 653 198 +455

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Labels

Label changes:

  • add P2: This is a concrete authorization bug affecting approval notifications on the ID-managed iOS path.
  • add merge-risk: 🚨 compatibility: The maintainer explicitly accepts re-pairing unattributed preview devices and possible owner recovery after a failed same-key regrant.
  • add merge-risk: 🚨 security-boundary: The patch changes recipient authorization and the ordering of native identity binding before an approval grant.
  • add proof: sufficient: Contributor real behavior proof is sufficient.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P2: This is a concrete authorization bug affecting approval notifications on the ID-managed iOS path.
  • merge-risk: 🚨 security-boundary: The patch changes recipient authorization and the ordering of native identity binding before an approval grant.
  • merge-risk: 🚨 compatibility: The maintainer explicitly accepts re-pairing unattributed preview devices and possible owner recovery after a failed same-key regrant.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (1 earlier review cycle)
  • reviewed 2026-11-17T02:51:12.777Z sha 21064fa :: needs maintainer review before merge. :: none

Reviewed November 16, 2026, 10:00 PM ET / November 17, 2026, 03:00 UTC (Revision 2).

@joshavant

Copy link
Copy Markdown
Collaborator Author

@clawsweeper re-review

The Evidence section now includes the requested redacted compiled-Gateway receipt: the six observed relay sends, current member authority, the full pending lifetime, expiry cleanup, and independent verification results. Runtime source remains unchanged; the follow-up only retires the obsolete assertion-baseline entry.

@clawsweeper

clawsweeper Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 17, 2026
@joshavant
joshavant merged commit ff2cb7e into main Nov 17, 2026
179 of 183 checks passed
@joshavant
joshavant deleted the fix/ios-approval-id-policy branch November 17, 2026 03:43
@joshavant

Copy link
Copy Markdown
Collaborator Author

Merged via explicitly authorized admin squash with attributed pre-existing CI failures.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 17, 2026
* fix(ios): use current ID policy for approval alerts

* chore: retire the removed approval assertion allowance
RomneyDa added a commit that referenced this pull request Nov 19, 2026
* fix(ios): use current ID policy for approval alerts

* chore: retire the removed approval assertion allowance

(cherry picked from commit ff2cb7e)

Companion audit: iOS notification authority now uses existing profile, device and session owners; paired-device binding precedes granting.

Co-authored-by: RomneyDa <[email protected]>
(cherry picked from commit 01f9690a9039d47488fdee5e382de412db3add37)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: ios App: ios docs Improvements or additions to documentation gateway Gateway runtime merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. security-sensitive-changed size: L status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant