Skip to content

feat(ios): render plugin approvals as native Allow/Deny notifications - #108709

Merged
steipete merged 7 commits into
mainfrom
feat/ios-plugin-approval-notifications
Jul 16, 2026
Merged

steipete merged 7 commits into
mainfrom
feat/ios-plugin-approval-notifications

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

The gateway now sends APNs pushes for plugin approvals (#108505), but iOS only handled exec approvals — plugin pushes matched no category and nothing fired. This makes the iOS app show a native Allow/Deny notification for plugin approvals (e.g. the 1Password broker's approve tier), which iOS mirrors to a paired Apple Watch. Completes the user-facing half of watch approvals; follows #105924.

Why This Change Was Made

The fetch/resolve RPCs and the .plugin presentation were already kind-generic on the wire (approval.get / approval.resolve, ApprovalKind.plugin, PluginApprovalPresentation); the only blockers were client-side exec-only guards and the missing plugin notification category. This widens those guards and adds the plugin push path, reusing the exec machinery:

  • Extracted a shared ApprovalNotificationBridge with thin exec/plugin wrappers owning their own kind constants (plugin.approval.requested/resolved), category (openclaw.plugin-approval), review action, and identifier prefixes. The parse core was already payload-driven. The parsed prompt now carries a kind; legacy persisted prompts without a kind decode as exec.
  • Registered the plugin category and routed plugin pushes in the app delegate (didReceiveRemoteNotification / willPresent / didReceive), mirroring exec.
  • Added a .plugin case in the snapshot mapping that maps PluginApprovalPresentation (title → heading, description → body, pluginId/toolName/severity → metadata, allowedDecisions → the allow-once/always/deny flags) and widened the exec-only validation, current-check, cache-restore, and resolve guards to accept plugin. Resolve sends kind: plugin over the existing unified approval.resolve.
  • Parameterized the dialog copy by kind so plugin approvals show plugin-appropriate wording; decision buttons are unchanged (already derived from allowedDecisions).

Watch snapshot publication stays exec-only (the current-check was split into a watch-specific exec-only variant and a general exec+plugin one), so exec watch behavior is unchanged; the phone notification still mirrors to the watch via WatchConnectivity. No server or shared-protocol changes.

User Impact

Operators get a native Allow/Deny notification on iPhone (and mirrored to Apple Watch) for plugin approvals, in addition to the existing chat forward. Exec approval behavior is unchanged.

Evidence

  • Simulator suites green: exec bridge, plugin bridge, and model suites (235 tests); NodeAppModelInvokeTests (222). Xcode SwiftFormat + SwiftLint pass (format run only on the touched Swift files). Native i18n native:i18n:check passes (changed=false). git diff --check clean.
  • No server TypeScript, no GatewayModels.swift / protocol enum changes.
  • Autoreview clean.
  • Not verifiable locally: live APNs tap visual proof (simulator unpaired, no notification auth). The ios CI lane is the authoritative build/test gate; the logic is unit-covered (parsing, category isolation, routing, restoration, plugin resolution).

@openclaw-barnacle openclaw-barnacle Bot added app: ios App: ios size: XL maintainer Maintainer-authored PR labels Jul 16, 2026

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

💡 Codex Review

https://github.com/openclaw/openclaw/blob/c9760e052c2f2974d917ad86da9502c9ca0fd1a0/apps/ios/Sources/Model/NodeAppModel.swift#L5722
P2 Badge Filter plugin approvals out of Watch counts

When a plugin approval is fetched, this widened guard now accepts it and upsertWatchExecApprovalPrompt still writes it into watchExecApprovalPromptsByID; the Watch approval snapshot later filters that map to exec-only items (apps/ios/Sources/Model/NodeAppModel.swift:5975), but the Watch app snapshot badge uses the raw map count (apps/ios/Sources/Model/NodeAppModel.swift:6217). With a paired Watch and only plugin approvals pending, the Watch UI reports approvals waiting/Open all approvals while the exec approval list has no rows to display or resolve. Keep plugin prompts out of the watch map or count only watch-current exec prompts.

ℹ️ 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 on lines +421 to +422
static let requestedKind = "plugin.approval.requested"
static let resolvedKind = "plugin.approval.resolved"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Badge Handle live plugin approval events

These plugin notification kinds cover APNs payloads, but connected gateway broadcasts are still plugin.approval.requested/plugin.approval.resolved (src/gateway/server-methods/plugin-approval.ts:146 and :245), while handleOperatorGatewayServerEvent only switches on the exec constants (apps/ios/Sources/Model/NodeAppModel.swift:1570). In foreground sessions, or when notification permission/relay delivery is unavailable, plugin approvals are ignored instead of showing the new prompt/inbox, so the requesting plugin can wait until timeout. Add the plugin requested/resolved cases to the same gateway-event path and pass .plugin through resolution/readback.

Useful? React with 👍 / 👎.

@steipete
steipete force-pushed the feat/ios-plugin-approval-notifications branch from ebe9aa3 to 04ad811 Compare July 16, 2026 08:20

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

Copy link
Copy Markdown
Contributor

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: 04ad811268

ℹ️ 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 on lines +7100 to +7104
guard ApprovalKind(rawValue: prompt.kind ?? "") == push.kind else {
self.removePendingWatchExecApprovalRecoveryPush(push)
await ApprovalNotificationBridge.removeNotifications(
for: push,
notificationCenter: self.notificationCenter)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Badge Recover delivered plugin notifications after relaunch

When the app relaunches without an in-memory queued push, this hydration path can only process pushes returned by pendingExecApprovalPushesForWatchRecovery(), but that helper still scans Notification Center with ExecApprovalNotificationBridge.parseRequestedPush, which is exec-only. Delivered plugin APNs alerts therefore never become approvalPushes, so opening the app from the icon/background recovery after receiving a plugin approval leaves the approval out of the restored inbox unless the user taps the notification or another push arrives; use the shared approval parser for delivered notifications too.

Useful? React with 👍 / 👎.

@steipete
steipete force-pushed the feat/ios-plugin-approval-notifications branch from 04ad811 to c979651 Compare July 16, 2026 09:41

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

Copy link
Copy Markdown
Contributor

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: c979651d0a

ℹ️ 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 on lines +5528 to +5530
guard let kind = ApprovalKind(rawValue: prompt.kind ?? ""),
kind == .exec || kind == .plugin
else { return false }

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Badge Filter plugin prompts out of the Watch approval cache

Allowing .plugin through this current-check also lets upsertWatchExecApprovalPrompt and persisted restore store plugin approvals in watchExecApprovalPromptsByID. The actual Watch approval delivery now filters with isWatchExecApprovalPromptCurrent, but makeWatchAppSnapshot still reports pendingApprovalCount from this same dictionary and the Watch UI uses that count even when no exec approval is loaded, so a fetched or restored plugin approval can show a pending-approval badge/count on the Watch with an empty approval list. Keep the phone inbox cache separate from the Watch cache, or count only exec prompts for Watch state.

Useful? React with 👍 / 👎.

steipete added 7 commits July 16, 2026 07:57
Extend the iOS approval handling from exec to plugin approvals so the native
push the gateway now sends (#108505) shows a phone notification with Allow/Deny.
Extract a shared ApprovalNotificationBridge with exec/plugin wrappers owning
their own kind constants and category; tag the parsed prompt with its kind;
register the plugin category and route plugin pushes in the app delegate; add a
.plugin case that maps the plugin presentation (title/description/pluginId/
severity) into the existing prompt and widens the exec-only validation, current,
cache-restore, and resolve guards to accept plugin; parameterize the dialog copy
by kind. Watch snapshot publication stays exec-only; the phone notification still
mirrors to the watch via WatchConnectivity. Reuses the unified approval.get/
approval.resolve RPCs (already kind-generic); no server or protocol changes.
…hods

Sync apps/ios/Resources/Localizable.xcstrings for the new plugin-approval
strings (native inventory sync alone did not cover the Apple catalog).
Remove the superseded per-bridge registerCategory variants and the redundant
exec parseResolvedPush wrapper flagged by the iOS Periphery dead-code scan;
registration uses ApprovalNotificationBridge.registerCategories and the shared
parse helpers.
Codex generated OpenClaw.xcodeproj for its simulator test run and the initial
apps/ios directory commit force-added it; xcodegen regenerates it in CI, so it
must not be tracked (matches main).
@steipete
steipete force-pushed the feat/ios-plugin-approval-notifications branch from c979651 to 74d1d52 Compare July 16, 2026 15:03
@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. feature: ✨ showcase ClawSweeper spotlight: unusually compelling feature idea for maintainer attention. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. labels Jul 16, 2026
@clawsweeper

clawsweeper Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed July 16, 2026, 11:14 AM ET / 15:14 UTC.

Summary
The PR extends the iOS notification bridge, approval model, dialog, persistence, recovery, and resolution paths to render plugin approvals with native Allow/Deny actions alongside exec approvals.

PR surface: Other +1504. Total +1504 across 29 files.

Reproducibility: not applicable. as a bug reproduction: this is the planned iOS client half of a new plugin-approval notification capability, and the merged gateway half plus current exec-only client paths establish the implementation gap.

Review metrics: 2 noteworthy metrics.

  • Persisted approval compatibility: 1 kind field added; legacy default retained. Previously stored exec notification prompts decode as exec, avoiding an upgrade-time loss of pending approval state.
  • Native approval categories: 1 plugin category added. The new category creates an additional native authorization entry point whose identifiers and routing must remain isolated from exec approvals.

Stored data model
Persistent data-model change detected: serialized state: apps/ios/Tests/ExecApprovalNotificationBridgeTests.swift. Confirm migration or upgrade compatibility proof before merge.

Merge readiness
Overall: 🐚 platinum hermit
Proof: 🌊 off-meta tidepool
Patch quality: 🐚 platinum hermit
Result: ready for maintainer review.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • none.

Risk before merge

  • [P1] This changes a native authorization surface: an incorrect kind, identifier, stale-state, or action mapping could approve or deny a plugin-controlled tool request other than the UI state the operator believes they are resolving.
  • [P1] The PR body does not demonstrate a real APNs notification tap and action round trip; simulator tests cannot fully exercise Apple notification delivery, paired-device mirroring, or real lifecycle transitions.

Maintainer options:

  1. Verify the native authorization round trip (recommended)
    Review the exact head and, when practical, capture a redacted real-device plugin notification, tap, Allow/Deny resolution, and stale-notification cleanup before landing.
  2. Accept simulator-only validation
    Maintainers may intentionally accept the remaining uncertainty around real APNs delivery and paired-Watch mirroring because the PR is maintainer-labeled and the kind-routing logic is unit-covered.

Next step before merge

  • [P1] No concrete automated repair is identified; this protected maintainer PR should proceed through exact-head iOS review and normal landing gates.

Security
Cleared: The diff adds no dependency or secret-handling surface and reuses the existing authenticated, scope-gated approval fetch/resolve contract with explicit plugin kind separation.

Review details

Best possible solution:

Keep one kind-aware iOS approval pipeline that preserves exec behavior, excludes plugin prompts from exec-only Watch state, and validates notification, tap, authenticated fetch, decision, resolution cleanup, and optional Watch mirroring on the exact merge head.

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

Not applicable as a bug reproduction: this is the planned iOS client half of a new plugin-approval notification capability, and the merged gateway half plus current exec-only client paths establish the implementation gap.

Is this the best way to solve the issue?

Yes, subject to exact-head review. Extending the existing authenticated approval fetch/resolve architecture with an explicit kind and isolated notification category is narrower and more maintainable than adding a second plugin-specific approval stack.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 28323b4480a2.

Label changes

Label changes:

  • add P2: This is a bounded iOS approval-workflow feature with meaningful operator value but no established urgent regression on the core runtime.
  • add merge-risk: 🚨 security-boundary: The PR adds native Allow/Deny handling for plugin-controlled tool requests, so incorrect kind or stale-request routing could affect authorization decisions.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add feature: ✨ showcase: ClawSweeper spotlight: unusually compelling feature idea for maintainer attention. Native phone and Watch approval actions make approval-gated plugins practically usable away from chat while preserving authenticated detail fetch and explicit human authorization.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The PR is maintainer-labeled, so the external-contributor proof gate does not apply; its simulator tests and pending iOS CI remain supplemental rather than real APNs/device proof.

Label justifications:

  • P2: This is a bounded iOS approval-workflow feature with meaningful operator value but no established urgent regression on the core runtime.
  • merge-risk: 🚨 security-boundary: The PR adds native Allow/Deny handling for plugin-controlled tool requests, so incorrect kind or stale-request routing could affect authorization decisions.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • feature: ✨ showcase: ClawSweeper spotlight: unusually compelling feature idea for maintainer attention. Native phone and Watch approval actions make approval-gated plugins practically usable away from chat while preserving authenticated detail fetch and explicit human authorization.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The PR is maintainer-labeled, so the external-contributor proof gate does not apply; its simulator tests and pending iOS CI remain supplemental rather than real APNs/device proof.
Evidence reviewed

PR surface:

Other +1504. Total +1504 across 29 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 0 0 0 0
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 29 1702 198 +1504
Total 29 1702 198 +1504

What I checked:

Likely related people:

  • ngutman: Introduced and landed the existing iOS exec-approval APNs, authenticated fetch, modal, cleanup, and resolution architecture that this branch generalizes. (github.com) (role: introduced behavior; confidence: high; commits: fdcccb5096, 28955a3; files: apps/ios/Sources/Push/ExecApprovalNotificationBridge.swift, apps/ios/Sources/Model/NodeAppModel.swift, apps/ios/Sources/OpenClawApp.swift)
  • steipete: Authored the merged gateway-side plugin APNs implementation and is carrying the corresponding iOS integration, establishing relevant merged history beyond merely proposing this PR. (role: recent adjacent contributor; confidence: high; commits: bdcf6bdfdd84; files: src/gateway/server-methods/plugin-approval.ts, apps/ios/Sources/Model/NodeAppModel.swift, apps/ios/Sources/OpenClawApp.swift)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

How this review workflow works
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@steipete
steipete merged commit aebea48 into main Jul 16, 2026
201 of 204 checks passed
@steipete
steipete deleted the feat/ios-plugin-approval-notifications branch July 16, 2026 16:50
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 17, 2026
…openclaw#108709)

* feat(ios): render plugin approvals as native Allow/Deny notifications

Extend the iOS approval handling from exec to plugin approvals so the native
push the gateway now sends (openclaw#108505) shows a phone notification with Allow/Deny.
Extract a shared ApprovalNotificationBridge with exec/plugin wrappers owning
their own kind constants and category; tag the parsed prompt with its kind;
register the plugin category and route plugin pushes in the app delegate; add a
.plugin case that maps the plugin presentation (title/description/pluginId/
severity) into the existing prompt and widens the exec-only validation, current,
cache-restore, and resolve guards to accept plugin; parameterize the dialog copy
by kind. Watch snapshot publication stays exec-only; the phone notification still
mirrors to the watch via WatchConnectivity. Reuses the unified approval.get/
approval.resolve RPCs (already kind-generic); no server or protocol changes.

* chore(i18n): sync native inventory after rebase

* chore(ios): drop accidentally committed local Version.xcconfig build override

* fix(ios): sync Apple i18n catalog and remove dead approval-bridge methods

Sync apps/ios/Resources/Localizable.xcstrings for the new plugin-approval
strings (native inventory sync alone did not cover the Apple catalog).
Remove the superseded per-bridge registerCategory variants and the redundant
exec parseResolvedPush wrapper flagged by the iOS Periphery dead-code scan;
registration uses ApprovalNotificationBridge.registerCategories and the shared
parse helpers.

* chore(ios): drop generated SwiftSources filelist; reconcile native i18n inventory

* chore(ios): drop generated Xcode project from tracking

Codex generated OpenClaw.xcodeproj for its simulator test run and the initial
apps/ios directory commit force-added it; xcodegen regenerates it in CI, so it
must not be tracked (matches main).

* chore(ios): reconcile native i18n inventory after rebase
zooqueen pushed a commit to zooqueen/openclaw that referenced this pull request Sep 11, 2026
…openclaw#108709)

* feat(ios): render plugin approvals as native Allow/Deny notifications

Extend the iOS approval handling from exec to plugin approvals so the native
push the gateway now sends (openclaw#108505) shows a phone notification with Allow/Deny.
Extract a shared ApprovalNotificationBridge with exec/plugin wrappers owning
their own kind constants and category; tag the parsed prompt with its kind;
register the plugin category and route plugin pushes in the app delegate; add a
.plugin case that maps the plugin presentation (title/description/pluginId/
severity) into the existing prompt and widens the exec-only validation, current,
cache-restore, and resolve guards to accept plugin; parameterize the dialog copy
by kind. Watch snapshot publication stays exec-only; the phone notification still
mirrors to the watch via WatchConnectivity. Reuses the unified approval.get/
approval.resolve RPCs (already kind-generic); no server or protocol changes.

* chore(i18n): sync native inventory after rebase

* chore(ios): drop accidentally committed local Version.xcconfig build override

* fix(ios): sync Apple i18n catalog and remove dead approval-bridge methods

Sync apps/ios/Resources/Localizable.xcstrings for the new plugin-approval
strings (native inventory sync alone did not cover the Apple catalog).
Remove the superseded per-bridge registerCategory variants and the redundant
exec parseResolvedPush wrapper flagged by the iOS Periphery dead-code scan;
registration uses ApprovalNotificationBridge.registerCategories and the shared
parse helpers.

* chore(ios): drop generated SwiftSources filelist; reconcile native i18n inventory

* chore(ios): drop generated Xcode project from tracking

Codex generated OpenClaw.xcodeproj for its simulator test run and the initial
apps/ios directory commit force-added it; xcodegen regenerates it in CI, so it
must not be tracked (matches main).

* chore(ios): reconcile native i18n inventory after rebase
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: ios App: ios feature: ✨ showcase ClawSweeper spotlight: unusually compelling feature idea for maintainer attention. maintainer Maintainer-authored PR merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XL 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