Repository navigation
feat(ios): render plugin approvals as native Allow/Deny notifications - #108709
Conversation
There was a problem hiding this comment.
💡 Codex Review
https://github.com/openclaw/openclaw/blob/c9760e052c2f2974d917ad86da9502c9ca0fd1a0/apps/ios/Sources/Model/NodeAppModel.swift#L5722
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".
| static let requestedKind = "plugin.approval.requested" | ||
| static let resolvedKind = "plugin.approval.resolved" |
There was a problem hiding this comment.
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 👍 / 👎.
ebe9aa3 to
04ad811
Compare
There was a problem hiding this comment.
💡 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".
| guard ApprovalKind(rawValue: prompt.kind ?? "") == push.kind else { | ||
| self.removePendingWatchExecApprovalRecoveryPush(push) | ||
| await ApprovalNotificationBridge.removeNotifications( | ||
| for: push, | ||
| notificationCenter: self.notificationCenter) |
There was a problem hiding this comment.
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 👍 / 👎.
04ad811 to
c979651
Compare
There was a problem hiding this comment.
💡 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".
| guard let kind = ApprovalKind(rawValue: prompt.kind ?? ""), | ||
| kind == .exec || kind == .plugin | ||
| else { return false } |
There was a problem hiding this comment.
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 👍 / 👎.
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).
c979651 to
74d1d52
Compare
|
Codex review: needs real behavior proof before merge. Reviewed July 16, 2026, 11:14 AM ET / 15:14 UTC. Summary 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.
Stored data model Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest 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 changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Other +1504. Total +1504 across 29 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
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
|
|
Merged via squash.
|
…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
…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
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
approvetier), 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
.pluginpresentation 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:ApprovalNotificationBridgewith 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 akind; legacy persisted prompts without a kind decode as exec.didReceiveRemoteNotification/willPresent/didReceive), mirroring exec..plugincase in the snapshot mapping that mapsPluginApprovalPresentation(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 sendskind: pluginover the existing unifiedapproval.resolve.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
NodeAppModelInvokeTests(222). Xcode SwiftFormat + SwiftLint pass (format run only on the touched Swift files). Native i18nnative:i18n:checkpasses (changed=false).git diff --checkclean.GatewayModels.swift/ protocol enum changes.iosCI lane is the authoritative build/test gate; the logic is unit-covered (parsing, category isolation, routing, restoration, plugin resolution).