Skip to content

iOS/Gateway: harden pairing resolution and settings-driven capability refresh#22120

Merged
mbelinky merged 2 commits intomainfrom
pr/ios-gateway-pairing-reliability
Feb 20, 2026
Merged

iOS/Gateway: harden pairing resolution and settings-driven capability refresh#22120
mbelinky merged 2 commits intomainfrom
pr/ios-gateway-pairing-reliability

Conversation

@mbelinky
Copy link
Copy Markdown
Contributor

@mbelinky mbelinky commented Feb 20, 2026

Summary

  • prefer connected node matches when duplicate display names exist
  • improve nodes invoke pairing-required error text with actionable hint
  • refresh active iOS gateway registration when settings permissions/capabilities change

Files

  • src/shared/node-match.ts
  • src/shared/shared-misc.test.ts
  • src/agents/tools/nodes-tool.ts
  • apps/ios/Sources/Gateway/GatewayConnectionController.swift
  • apps/ios/Sources/Settings/SettingsTab.swift

Validation

  • pnpm test -- src/shared/shared-misc.test.ts

Greptile Summary

This PR hardens pairing resolution and settings-driven capability refresh in iOS gateway connections. The changes address three main areas:

  • Node matching with duplicate names: Modified resolveNodeIdFromCandidates in src/shared/node-match.ts to prefer connected nodes when multiple nodes share the same display name (common during re-pairing/reinstall flows)
  • Improved pairing error messages: Enhanced nodes-tool.ts to extract pairing request IDs from error messages and provide actionable hints for users to approve pending pairing requests
  • iOS capability refresh: Added refreshActiveGatewayRegistrationFromSettings() method to rebuild gateway registration when location permissions change, ensuring capability updates take effect immediately

The implementation is well-tested with new unit tests covering both the connected node preference logic and ambiguous match scenarios. The Swift code follows proper guard patterns and MainActor execution for UI updates.

Confidence Score: 3/5

  • Safe to merge with noted capability refresh gaps for camera and voice wake settings
  • The core changes are well-implemented with proper tests and guard clauses. However, the PR introduces capability refresh for location settings but misses the same pattern for camera and voice wake settings, creating an inconsistent user experience where some capability changes take effect immediately while others require reconnection
  • apps/ios/Sources/Settings/SettingsTab.swift needs refresh calls added for camera and voice wake toggles to match the location setting pattern

Last reviewed commit: 41bbd41

@openclaw-barnacle openclaw-barnacle bot added app: ios App: ios agents Agent runtime and tooling size: S maintainer Maintainer-authored PR labels Feb 20, 2026
@mbelinky mbelinky self-assigned this Feb 20, 2026
Copy link
Copy Markdown
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

5 files reviewed, 2 comments

Edit Code Review Agent Settings | Greptile

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Feb 20, 2026

Additional Comments (2)

apps/ios/Sources/Settings/SettingsTab.swift
cameraEnabled changes affect capabilities (currentCaps() checks camera.enabled at GatewayConnectionController.swift:789-793) but don't trigger refreshActiveGatewayRegistrationFromSettings() like location changes do. Camera capability updates won't take effect until next reconnect.

Consider adding the refresh callback:

                        self.featureToggle(
                            "Allow Camera",
                            isOn: self.$cameraEnabled,
                            help: "Allows the gateway to request photos or short video clips while OpenClaw is foregrounded.") { _ in
                                self.gatewayController.refreshActiveGatewayRegistrationFromSettings()
                            }
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/ios/Sources/Settings/SettingsTab.swift
Line: 276-279

Comment:
`cameraEnabled` changes affect capabilities (`currentCaps()` checks `camera.enabled` at GatewayConnectionController.swift:789-793) but don't trigger `refreshActiveGatewayRegistrationFromSettings()` like location changes do. Camera capability updates won't take effect until next reconnect.

Consider adding the refresh callback:
```suggestion
                        self.featureToggle(
                            "Allow Camera",
                            isOn: self.$cameraEnabled,
                            help: "Allows the gateway to request photos or short video clips while OpenClaw is foregrounded.") { _ in
                                self.gatewayController.refreshActiveGatewayRegistrationFromSettings()
                            }
```

How can I resolve this? If you propose a fix, please make it concise.

apps/ios/Sources/Settings/SettingsTab.swift
voiceWakeEnabled changes affect capabilities (currentCaps() checks voiceWake.enabled at GatewayConnectionController.swift:795-796) but don't trigger refreshActiveGatewayRegistrationFromSettings(). Voice wake capability updates won't take effect until next reconnect.

Add refresh after setVoiceWakeEnabled:

                        self.featureToggle(
                            "Voice Wake",
                            isOn: self.$voiceWakeEnabled,
                            help: "Enables wake-word activation to start a hands-free session.") { newValue in
                                self.appModel.setVoiceWakeEnabled(newValue)
                                self.gatewayController.refreshActiveGatewayRegistrationFromSettings()
                            }
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/ios/Sources/Settings/SettingsTab.swift
Line: 251-256

Comment:
`voiceWakeEnabled` changes affect capabilities (`currentCaps()` checks `voiceWake.enabled` at GatewayConnectionController.swift:795-796) but don't trigger `refreshActiveGatewayRegistrationFromSettings()`. Voice wake capability updates won't take effect until next reconnect.

Add refresh after `setVoiceWakeEnabled`:
```suggestion
                        self.featureToggle(
                            "Voice Wake",
                            isOn: self.$voiceWakeEnabled,
                            help: "Enables wake-word activation to start a hands-free session.") { newValue in
                                self.appModel.setVoiceWakeEnabled(newValue)
                                self.gatewayController.refreshActiveGatewayRegistrationFromSettings()
                            }
```

How can I resolve this? If you propose a fix, please make it concise.

@mbelinky mbelinky force-pushed the pr/ios-gateway-pairing-reliability branch from 41bbd41 to 55b8a93 Compare February 20, 2026 18:56
@mbelinky mbelinky merged commit 5828708 into main Feb 20, 2026
11 checks passed
@mbelinky mbelinky deleted the pr/ios-gateway-pairing-reliability branch February 20, 2026 18:57
@mbelinky
Copy link
Copy Markdown
Contributor Author

Merged via squash.

Thanks @mbelinky!

MisterGuy420 pushed a commit to MisterGuy420/openclaw-dev that referenced this pull request Feb 20, 2026
… refresh (openclaw#22120)

Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: 55b8a93
Co-authored-by: mbelinky <[email protected]>
Co-authored-by: mbelinky <[email protected]>
Reviewed-by: @mbelinky
rodrigogs pushed a commit to rodrigogs/openclaw that referenced this pull request Feb 20, 2026
… refresh (openclaw#22120)

Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: 55b8a93
Co-authored-by: mbelinky <[email protected]>
Co-authored-by: mbelinky <[email protected]>
Reviewed-by: @mbelinky
MisterGuy420 pushed a commit to MisterGuy420/openclaw-dev that referenced this pull request Feb 20, 2026
… refresh (openclaw#22120)

Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: 55b8a93
Co-authored-by: mbelinky <[email protected]>
Co-authored-by: mbelinky <[email protected]>
Reviewed-by: @mbelinky
Hansen1018 added a commit to Hansen1018/openclaw that referenced this pull request Feb 21, 2026
… refresh (openclaw#22120)

Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: 55b8a93
Co-authored-by: mbelinky <[email protected]>
Co-authored-by: mbelinky <[email protected]>
Reviewed-by: @mbelinky
vincentkoc pushed a commit that referenced this pull request Feb 21, 2026
… refresh (#22120)

Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: 55b8a93
Co-authored-by: mbelinky <[email protected]>
Co-authored-by: mbelinky <[email protected]>
Reviewed-by: @mbelinky
dgarson pushed a commit to dgarson/clawdbot that referenced this pull request Feb 21, 2026
… refresh (openclaw#22120)

Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: 55b8a93
Co-authored-by: mbelinky <[email protected]>
Co-authored-by: mbelinky <[email protected]>
Reviewed-by: @mbelinky
mmyyfirstb pushed a commit to mmyyfirstb/openclaw that referenced this pull request Feb 21, 2026
… refresh (openclaw#22120)

Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: 55b8a93
Co-authored-by: mbelinky <[email protected]>
Co-authored-by: mbelinky <[email protected]>
Reviewed-by: @mbelinky
obviyus pushed a commit to guirguispierre/openclaw that referenced this pull request Feb 22, 2026
… refresh (openclaw#22120)

Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: 55b8a93
Co-authored-by: mbelinky <[email protected]>
Co-authored-by: mbelinky <[email protected]>
Reviewed-by: @mbelinky
mreedr pushed a commit to mreedr/openclaw-custom that referenced this pull request Feb 24, 2026
… refresh (openclaw#22120)

Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: 55b8a93
Co-authored-by: mbelinky <[email protected]>
Co-authored-by: mbelinky <[email protected]>
Reviewed-by: @mbelinky
zooqueen pushed a commit to hanzoai/bot that referenced this pull request Mar 6, 2026
… refresh (openclaw#22120)

Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: 55b8a93
Co-authored-by: mbelinky <[email protected]>
Co-authored-by: mbelinky <[email protected]>
Reviewed-by: @mbelinky
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling app: ios App: ios maintainer Maintainer-authored PR size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant