Repository navigation
fix(ios): keep reconnect errors visible - #105875
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0416342dd7
ℹ️ 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".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ff3711e609
ℹ️ 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".
| { | ||
| // A retry may already be running; keep its previous error readable until success clears it. | ||
| if let localFailure { return .failedStatus(message: localFailure, allowsRetry: false) } | ||
| if let problem { return .failed(problem) } |
There was a problem hiding this comment.
Disable problem actions while reconnecting
With this precedence, the onboarding problem banner stays in the .failed branch while connectingGateway is set by retryLastAttempt or the certificate-trust path. That branch still renders an enabled Retry/Trust button, and retryLastAttempt has no in-flight guard, so a user who taps the unchanged button again during reconnect can start overlapping attempts that cancel/restart the previous handoff instead of seeing a busy state. Keep the old problem visible, but also surface or disable the active action when connectingDetail is present.
Useful? React with 👍 / 👎.
|
Codex review: needs real behavior proof before merge. Reviewed July 13, 2026, 4:51 AM ET / 08:51 UTC. Summary PR surface: Other +160. Total +160 across 11 files. Reproducibility: yes. at source level for the review defects: setup-code connection with an existing local failure, another Retry or Trust tap while reconnecting, and a different-target TLS preflight provide concrete paths. No live simulator artifact demonstrates them. Review metrics: none identified. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Risk before merge
Maintainer options:
Next step before merge
Maintainer decision needed
Security Review findings
Review detailsBest possible solution: Use an explicit target- and attempt-owned presentation state: retain an error only for the same active target, expose reconnect busy state while disabling its actions, replace it when setup or preflight establishes newer information, and verify the rebased behavior with focused tests plus a redacted simulator or device recording. Do we have a high-confidence way to reproduce the issue? Yes at source level for the review defects: setup-code connection with an existing local failure, another Retry or Trust tap while reconnecting, and a different-target TLS preflight provide concrete paths. No live simulator artifact demonstrates them. Is this the best way to solve the issue? No. Sticky same-target diagnostics may be valuable, but precedence checks without explicit target, attempt, action, and owner state are not the safest maintainable implementation. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against d38fc3e2f06c. Label changesLabel justifications:
Evidence reviewedPR surface: Other +160. Total +160 across 11 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
Review history (7 earlier review cycles)
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b7eec503cb
ℹ️ 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 currentStableID = self.activeGatewayConnectConfig?.effectiveStableID | ||
| ?? self.connectedGatewayID, | ||
| !GatewayStableIdentifier.matches(currentStableID, stableID) | ||
| else { return } |
There was a problem hiding this comment.
Clear stale problems when the route was reset
Fresh evidence since the earlier stale-problem thread: setup-link switches call resetGatewaySessionsForTargetSwitch, which clears activeGatewayConnectConfig and connectedGatewayID but leaves lastGatewayProblem; the subsequent manual connect reaches this guard with no currentStableID, so it returns without clearing. In that setup-link/deep-link switch after a prior gateway error, the new problem-over-progress precedence keeps rendering the old gateway’s failure during the replacement connect instead of the new progress. Please either clear retained problems when no current route remains, or carry the previous route ID through the reset so this check can still identify the switch.
Useful? React with 👍 / 👎.
43477c9 to
3737912
Compare
|
Land-ready proof for exact head
Proof scope: broad hosted CI intentionally not awaited per maintainer direction. No physical iPhone was attached for source-blind visual proof. |
252f85c to
8862da2
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8862da24c7
ℹ️ 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".
| if !preservingGatewayProblem { | ||
| // Same-target reconnects keep the prior failure readable until success or a new failure. | ||
| // Initial connects and target changes must not inherit another gateway's problem state. | ||
| self.operatorGatewayProblem = nil | ||
| self.clearGatewayConnectionProblem() |
There was a problem hiding this comment.
Clear stale operator problems when no operator loop starts
When a same-stable-ID reconnect changes credentials so shouldStartOperatorGatewayLoop is false (for example a bootstrap/setup-code retry after an operator auth failure), this branch preserves both lastGatewayProblem and the private operatorGatewayProblem. Since no operator loop is started to call clearOperatorGatewayConnectionProblemIfCurrent(), handleNodeGatewayConnected() later calls clearGatewayConnectionProblem() and republishes that stale operator problem, leaving the UI showing the old error after the replacement route succeeds. Preserve the visible problem for in-flight retries, but clear operator-owned state when the new config will not start that owner.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 67f853b254
ℹ️ 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".
| if !preservingGatewayProblem { | ||
| // Same-target reconnects keep the prior failure readable until success or a new failure. | ||
| // Initial connects and target changes must not inherit another gateway's problem state. | ||
| self.operatorGatewayProblem = nil | ||
| self.clearGatewayConnectionProblem() |
There was a problem hiding this comment.
Clear operator pause state before retry loops resume
When a same-target retry follows an operator/pairing failure, this preserving path leaves operatorGatewayProblem installed even though gatewayPairingPaused is temporarily cleared. If the node session connects before the operator loop, handleNodeGatewayConnected() calls clearGatewayConnectionProblem(), which republishes that retained operator problem and sets gatewayPairingPaused back to true; the operator loop then stays in gatewayReconnectLoopDelay() instead of checking the now-approved pairing. Fresh path beyond the earlier no-operator-loop case: this can also block retries when the operator loop is present but has not reached its connect attempt yet.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 69793bdac7
ℹ️ 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".
| // Preflight has not committed the replacement target yet. Keep the readable snapshot | ||
| // while retiring live pairing control; the committed route switch clears the snapshot. | ||
| self.operatorGatewayProblem = nil |
There was a problem hiding this comment.
Clear retained errors when TLS preflight fails
Fresh evidence beyond the earlier stale-target comments: manual TLS preflight failures never reach connectToGateway/clearGatewayProblemForCommittedTargetSwitch—GatewayConnectionController.connectManual only writes the probe error to gatewayStatusText and returns. When the user manually connects to a different TLS gateway with no stored fingerprint after a retained error, preserving lastGatewayProblem here makes onboarding/status surfaces keep showing the previous gateway's problem instead of the new probe failure; clear or replace the retained problem on preflight failure or target mismatch.
Useful? React with 👍 / 👎.
69793bd to
3efb98d
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3efb98d5b4
ℹ️ 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".
| if !preservingGatewayProblem { | ||
| // Same-target reconnects keep the prior failure readable until success or a new failure. | ||
| // Initial connects and target changes must not inherit another gateway's problem state. | ||
| self.clearGatewayConnectionProblem() |
There was a problem hiding this comment.
Disable retained toast actions during reconnects
When a same-target retry or certificate-trust reconnect preserves the prior problem here, the main app toast also remains visible: RootTabs.swift:708-727 renders appModel.lastGatewayProblem with an enabled primary action, and RootTabs.swift:1286-1298 starts trustRotatedGatewayCertificate/connectActiveGateway again with no in-flight guard. In the main app, a user can tap Retry/Review repeatedly during the active reconnect, invalidating and restarting the connection attempt instead of seeing a busy/disabled action; please gate the retained problem action for this non-onboarding toast as well.
Useful? React with 👍 / 👎.
* fix(ios): keep reconnect errors visible * fix(ios): clear stale errors on gateway switch * chore(ios): keep release notes in PR * fix(ios): reset status when switching gateways * fix(ios): retain errors through same-target reconnect * fix(ios): unpause explicit pairing retries * fix(ios): isolate retained reconnect errors * chore(i18n): resync rebased native inventory * fix(ios): separate reconnect display state
What Problem This Solves
When the iOS app reconnects to the same gateway, the useful connection error was replaced by “Reconnecting…” after a second or two. Users could not read the failure or open its details.
Why This Change Was Made
Retain the last gateway problem as presentation history while a same-target reconnect starts. Keep live node and operator problems separate from that snapshot, so a stale pairing error cannot control a new retry while an active pairing approval still keeps its control state.
Successful connections and new failures replace the retained snapshot. Selecting a different gateway clears it.
This is AI-assisted work. The state precedence and lifecycle boundaries were checked manually and with the repository autoreview gate.
User Impact
The previous gateway error remains readable while iOS reconnects in the background. Explicit retries do not inherit stale pairing pauses; active approval requests remain visible and paused.
Evidence
3efb98d5b4ae34b8897400cf19c9c12b9ff92f58.xcodebuild test -project apps/ios/OpenClaw.xcodeproj -scheme OpenClaw -destination 'platform=iOS Simulator,id=1D711F07-E4B8-4236-B814-6BA6335F92B4' -derivedDataPath /tmp/openclaw-ios-105875.wrhBSC -resultBundlePath /tmp/openclaw-ios-105875-retention-suite-v2.xcresult CODE_SIGNING_ALLOWED=NO -only-testing:OpenClawTests/GatewayReconnectErrorRetentionTests.node --import tsx scripts/native-app-i18n.ts syncreportedchanged=false;git diff --checkpassed.