Skip to content

fix(ios): stop node retries while the Gateway rate-limits auth - #196796

Merged
obviyus merged 1 commit into
mainfrom
fix/ios-node-pause-rate-limit
Nov 10, 2026
Merged

obviyus merged 1 commit into
mainfrom
fix/ios-node-pause-rate-limit

Conversation

@obviyus

@obviyus obviyus commented Nov 10, 2026

Copy link
Copy Markdown
Collaborator

What Problem This Solves

Refs #190773 (the AUTH_RATE_LIMITED lockout part; the separate missed-tick reconnect cancellation in that issue is not addressed here).

When the Gateway locks out auth (AUTH_RATE_LIMITED), the iOS operator connection stops, but the node connection keeps retrying against the locked Gateway every ~30 s for as long as the app is open. Each attempt is another rejected handshake, which matches the field report (24 node vs ~4 operator rejects per burst).

Root cause

NodeAppModel.recordNodeGatewayConnectionError has a branch for a node problem that equals the operator's active problem ("a node cancellation may echo an active operator approval failure"). That branch only updates the displayed status. It never disables gatewayAutoReconnectEnabled, which applyGatewayConnectionProblem does for every other pauseReconnect problem. So when both roles hit the same rate limit, the node loop's pauseReconnect path never actually pauses.

Change

In that branch, a shared pauseReconnect problem that isn't a pairing approval now disables auto-reconnect, the same as the node's own problems. Pairing approvals keep their existing owner-specific handling. The user resumes with Wait and retry, as before.

Evidence

Throwaway Gateway on loopback with password auth, the default limiter, and rateLimit.exemptLoopback=false. Steps: connect the iPhone 17 simulator, lock out the IP with wrong-password attempts, rotate the password, then count the app's rejected handshakes for 120 s.

operator rejects node rejects after 120 s
main 3 (first 2 s) 8, backoff growing to one every 30 s, still going "Too many failed attempts"
this PR 3 (first 3 s) 2 (first 3 s), then none for 5+ min same banner, waiting for the user
this PR, after lockout expires + password set back + Wait and retry Connected

Tests:

  • New node echo of an operator rate limit stops reconnect attempts (GatewayReconnectErrorRetentionTests) fails on main (gatewayAutoReconnectEnabled stays true) and passes with the fix.
  • GatewayConnectionControllerTests + GatewayReconnectErrorRetentionTests: 97 pass.
  • SwiftFormat clean.

Size: +6 production lines (2 of them a comment), +18 test lines.

@clawsweeper

clawsweeper Bot commented Nov 10, 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.

@obviyus

obviyus commented Nov 10, 2026

Copy link
Copy Markdown
Collaborator Author

App state after the 120 s lockout window (main vs this PR), and after Wait and retry once the lockout expired.

main: still retrying through the lockout

PR: banner shown, node retries stopped

PR: Wait and retry after lockout reconnects

@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. P2 Normal backlog priority with limited blast radius. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. 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. labels Nov 10, 2026
@clawsweeper

clawsweeper Bot commented Nov 10, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR pauses iOS node reconnects when they encounter the same non-pairing authentication failure already reported by the operator connection.

Example: Both iOS connections receive AUTH_RATE_LIMITED from a password-authenticated Gateway.

  • Before: The operator stops, but the node continues rejected handshakes during the lockout.
  • After: Node retries pause, the existing banner remains visible, and Wait and retry can reconnect after the lockout expires.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The focused patch has no identified defect and preserves existing state ownership; screenshots support recovery, while handshake counts are author-reported and the linked issue is only partly resolved.
Proof confidence 🐚 platinum hermit (4/6) This collaborator-authored PR is outside the ordinary contributor proof gate; its isolated Gateway and iPhone simulator scenario reports stopped retries and successful explicit recovery, with inspected screenshots confirming the displayed lockout and recovered connection.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Partial
User problem: The iOS app keeps making rejected node connections while its Gateway authentication banner tells the user to wait.
Reason: The collaborator-authored direction restores an existing pause contract with a narrow repair; using a related reference correctly leaves the broader report open.

Regression provenance

Regression provenance — verified: source commit 3261667b7384 by Peter Steinberger; canonical PR #105875 (blame-to-merge-commit).

Merge readiness

✅ Ready for maintainer review

Keep this PR open: it repairs a current iOS retry-control defect with a focused change and no identified correctness findings; the broader linked issue remains only partly addressed.

Priority: P2
Reviewed head: 60aa393b0f1aa525f7d6e1bfd72c40dc825a1180

Before merge

None.

Findings

None.

Agent review details

How this fits together

The iOS app maintains operator and node Gateway connections; NodeAppModel maps their errors into presentation and reconnect control, while the existing connection controller handles explicit recovery.

flowchart TD
  A[Gateway auth rejection] --> B[Connection problem mapper]
  B --> C[NodeAppModel error owner]
  C --> D[Reconnect pause flag]
  D --> E[Node reconnect loop]
  C --> F[Existing recovery banner]
  F --> G[Explicit retry controller]
  G --> E
Loading

Technical review

Best possible solution:

Use the existing reconnect flag to enforce shared non-pairing pauses while preserving pairing ownership and explicit in-app recovery.

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

The current-main branch and reconnect-loop control establish the failure path, and the author supplies a concrete simulator reproduction; this read-only review did not independently execute it.

Is this the best way to solve the issue?

This is the smallest complete repair for the stated retry defect: it restores the existing pause invariant without adding state, changing limiter policy, or disturbing pairing ownership.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Operator-matching node errors and retained reconnect presentation keeps the original intent (3261667: Keep errors readable during reconnect while separating operator pairing authority from node and retained presentation state.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 3261667 adds apps/ios/Sources/Model/NodeAppModel.swift:4668 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 3261667b7384; files: apps/ios/Sources/Model/NodeAppModel.swift)

PR surface

Source +5, Tests +18. Total +23 across 2 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 1 5 0 +5
Tests 1 18 0 +18
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 23 0 +23

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 focused repair stops unnecessary rejected handshakes during an existing lockout while retaining visible in-app recovery.
  • add proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🐚 platinum hermit and patch quality is 🦞 diamond lobster.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P2: This focused repair stops unnecessary rejected handshakes during an existing lockout while retaining visible in-app recovery.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🐚 platinum hermit and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence.

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.

Reviewed November 10, 2026, 1:37 PM ET / 18:37 UTC.

@obviyus
obviyus merged commit 0409efb into main Nov 10, 2026
87 checks passed
@obviyus
obviyus deleted the fix/ios-node-pause-rate-limit branch November 10, 2026 18:56
@obviyus

obviyus commented Nov 10, 2026

Copy link
Copy Markdown
Collaborator Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: ios App: ios P2 Normal backlog priority with limited blast radius. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: XS 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