Skip to content

fix: iOS reconnects stop requesting approval after capability loss#102661

Merged
steipete merged 1 commit into
mainfrom
codex/fix-ios-reapproval
Jul 9, 2026
Merged

fix: iOS reconnects stop requesting approval after capability loss#102661
steipete merged 1 commit into
mainfrom
codex/fix-ios-reapproval

Conversation

@steipete

@steipete steipete commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Closes #98038

What Problem This Solves

Fixes an issue where approved iOS devices could be sent back to the approval flow after reconnecting when transient device capabilities or permissions became unavailable, including Apple Watch reachability changes.

Why This Change Was Made

Treats an existing pairing approval as the maximum authority granted to the device. Reconnection now requires approval only when the device requests a new command, capability, or enabled permission; losing a previously declared capability or permission only narrows the live session and does not mutate the durable approval.

User Impact

Previously approved iPhones can reconnect after ordinary availability changes without repeated approval prompts. New authority still requires explicit approval.

Evidence

  • Blacksmith Testbox tbx_01kx35rs5ramy75wvs0jn0v4kt: focused Gateway pairing/reconnect tests, 6 files and 66 tests passed.
  • Blacksmith Testbox tbx_01kx35rs5ramy75wvs0jn0v4kt: check:changed passed, including typechecks, lint, import-cycle checks, and policy guards.
  • Regression coverage proves both sides of the invariant: permission/capability upgrades create a pending approval, while permission/capability loss reconnects without one and leaves the stored approval unchanged.
  • Fresh Codex autoreview reported no accepted or actionable findings.

The proof exercises the same Gateway WebSocket connect and pairing path used by iOS; no physical-device run was performed.

@steipete
steipete requested a review from a team as a code owner July 9, 2026 10:29
@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime size: S maintainer Maintainer-authored PR labels Jul 9, 2026
@steipete

steipete commented Jul 9, 2026

Copy link
Copy Markdown
Contributor Author

Land-ready review complete at 0fc3a8bdf1207f2638fde0c15b81db21bb69860e.

Proof:

  • Blacksmith Testbox tbx_01kx35rs5ramy75wvs0jn0v4kt: pnpm test src/gateway/node-connect-reconcile.test.ts src/gateway/server.node-pairing-authz.test.ts — 6 test files, 66 tests passed.
  • Blacksmith Testbox tbx_01kx35rs5ramy75wvs0jn0v4kt: pnpm check:changed — typechecks, lint, import-cycle checks, and policy guards passed.
  • Fresh Codex autoreview: no accepted or actionable findings.
  • Review artifact verdict: best fix at the Gateway approval boundary; no security findings. Authority increases still require approval, while capability/permission loss only narrows the live connection and does not rewrite durable approval.

Proof gap: no physical iPhone run. The focused suite includes the production Gateway WebSocket pair/reconnect path and reproduces the transient watchReachable downgrade that triggered the issue.

@clawsweeper

clawsweeper Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper status: review started.

I am starting a fresh review of this pull request: fix: iOS reconnects stop requesting approval after capability loss This is item 1/1 in the current shard. Shard 0/1.

This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking.

Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted.

@steipete
steipete merged commit 5b0e970 into main Jul 9, 2026
119 of 124 checks passed
@steipete
steipete deleted the codex/fix-ios-reapproval branch July 9, 2026 10:36
@steipete

steipete commented Jul 9, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

@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: 0fc3a8bdf1

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

caps: declaredCaps,
commands: declared,
permissions: declaredPermissions ?? (hasPermissionChange ? {} : undefined),
permissions: declaredPermissions ?? (permissionUpgrade ? {} : undefined),

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 Avoid preserving stale pending permissions on upgrades

When a paired node already has a pending permission reapproval and then reconnects with a command/capability upgrade but omits the permissions map, this now sends permissions: undefined; requestNodePairing treats undefined as “reuse the latest pending permissions” (src/infra/node-pairing.ts:215), so the replacement request can carry forward and later approve a stale permission that the current reconnect did not request. This only arises with an existing pending permission request plus a simultaneous non-permission upgrade, but it can broaden the durable approval beyond the live declaration; pass an explicit empty permission surface for omitted permissions in this reapproval path instead of letting pairing-state merge fill it from old pending state.

Useful? React with 👍 / 👎.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 10, 2026
wheakerd pushed a commit to wheakerd/clawdbot that referenced this pull request Jul 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gateway Gateway runtime maintainer Maintainer-authored PR size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

iOS app: node requests re-approval on every reconnect (token persistence bug)

1 participant